View Full Version : Anti-aliasing with fragment shaders and textures

07-25-2012, 12:56 PM
I have a texture mapped object that I am putting through a fragment shader. The original texture mapped to the object is anti-aliased, but I think that the fragment shader only works on the pixel level. So in my case, if I have an anti-aliased line, half the pixel might be black and half of it white. My fragment shader should act on black pixels, but I only want to apply it to the part of the pixel that is actually black. Is that possible?

Alfonse Reinheart
07-25-2012, 01:21 PM
Textures do not have parts of texels. Textures don't know if they're "anti-aliased" or not. They're just images. Half the texel can't be black, because a texel can only be one color at a time. If the texel was created from half-black and half-white, it is now grey. And it doesn't magically remember that it was created from half-black and half-white.

Unless you're using a multisample texture, but accessing them requires texelFetch anyway.