Using delta time produces visual artifacts
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Flesh Gregor
- Prole
- Posts: 9
- Joined: Thu May 07, 2009 9:30 pm
Using delta time produces visual artifacts
Sorry if this was brought up before, but does anyone else have this problem? If I change the x and y of a graphic using just a number the image looks fine, but if I multiply by delta time I get a blurring (like bad anti-aliasing) and the cx and cy of subsprites seems to want to change slightly (I'll get a 1px wide sliver of the subsprite to the right, left, top, or bottom, depending on which direction the sprite is moving). This only occurs when multiplying by delta time, and only after I've moved the image, and it happens on other computers as well. I can provide screen shots or a .love file if anyone wants proof.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Using delta time produces visual artifacts
Maybe because dt allows you to be at half pixels, so you might want to do a math.floor call somewhere, to see if that cleans it up.
- Flesh Gregor
- Prole
- Posts: 9
- Joined: Thu May 07, 2009 9:30 pm
Re: Using delta time produces visual artifacts
Thanks alot, I didn't know about the half pixel thing, but that fixed it.
Re: Using delta time produces visual artifacts
Yeah, that's one way to solve it, but using whole-pixels will make the animation less smooth. Using math.floor is often good enough, but you'll really notice it if you can compare the animation with other smoothly animated objects.
Another alternative is to pad your image with at least 1px transparent space, and expanding color data from the visible part of the image into the invisible part (but keeping alpha at 0). You can do this by:
... I should add this to the Wiki.
EDIT: Fixed copy/paste failure.
Another alternative is to pad your image with at least 1px transparent space, and expanding color data from the visible part of the image into the invisible part (but keeping alpha at 0). You can do this by:
- Using a format like .tga to completely control the alpha channel.
- Using the pngopt.exe tool bundled with HGE. (Windows only, included in the attached .love).
- NOT using love.image_optimize (which USED to do the same thing as pngopt, but mysteriously broke some time between 0.2.1 and 0.5.0 ).
- Left: unoptimized PNG with no rounding. You should see white slivers along the edges of the circle.
- Middle: optimized PNG with no rounding. Should be no artifacts.
- Right: unoptimized PNG with rounding. Should appear less smooth.
... I should add this to the Wiki.
EDIT: Fixed copy/paste failure.
- Attachments
-
- pngopt.love
- (220.32 KiB) Downloaded 208 times
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Using delta time produces visual artifacts
Wasn't the middle PNG the optimized one?rude wrote:
- Left: unoptimized PNG with no rounding. You should see white slivers along the edges of the circle.
- Middle: unoptimized PNG with no rounding. Should be no artifacts.
- Right: unoptimized PNG with rounding. Should appear less smooth.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 12 guests