For some overlays in my game I keep getting weird fringing when the image is being drawn at sub pixel accuracies.
looks like this:
It goes away if I use nearest neighbour filtering but then I get weird stepping as the camera moves.
Any ideas?
Weird filtering issue
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 6
- Joined: Fri Jul 12, 2013 2:43 pm
Re: Weird filtering issue
Ok, It seems that the problem is that the surrounding pixels are set to 255,255,255,0 so the white is affecting the pixels as they filter.
Shouldnt the filtering ignore the colouring of those pixels because the alpha is zero? Is there a mistake in the blend function somewhere?
Shouldnt the filtering ignore the colouring of those pixels because the alpha is zero? Is there a mistake in the blend function somewhere?
Re: Weird filtering issue
Apparently that's how it's supposed to work. The fix is to change those surrounding pixels to 0,0,0,0 and it should go away.
Re: Weird filtering issue
It actually has to do with the blend mode, but it's not a mistake. It's just how the alpha blend mode works. To get the expected blending you would have to prepare your image for premultiplied blending. That means multiplying the red, green, and blue channel with the alpha channel and then drawing the image with the premultiplied blend mode. viewtopic.php?f=4&t=75222&p=155021#p155021
The alpha blend mode will be changed in 0.9.0 slightly so this operation is not needed anymore.
The alpha blend mode will be changed in 0.9.0 slightly so this operation is not needed anymore.
Shallow indentations.
Who is online
Users browsing this forum: No registered users and 3 guests