Jump to content
  • Advertisement
Sign in to follow this  
Drakex

Some outputs of pixel shaders not being antialiased

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a quick cartoon pixel shader. Here's the lighting lines:
if(dot(iNormal,normalize(LightDirection))>0)
	oColor=float4(0.5,0.5,0.5,1);
else
	oColor=float4(1,1,1,1);
Something weird happens. I have antialiasing forced on in my video card drivers, and everything is antialiased just fine - except for the border between the light and dark sides of the objects that use this antialiasing shader. It's a jagged and sharp border. Is there any reason why this happens? Why would everything else be antialiased except this? I've seen pixel shaders that use a texture lookup instead of something like this code, and I suppose this is why, although I can't figure out why the border between light and dark isn't being antialiased!

Share this post


Link to post
Share on other sites
Advertisement
The normal supersampling algorithm only considers the edges of the polygons - because the texture filtering automatically handles the "antialiasing" of polygon innards. Using supersampling, the pixel shaders are still executed per-pixel instead of per-fragment, thus not antialiasing the shader result automatically.

The newer pixel shader profiles support per-pixel derivatives of the texture coordinates in screen space. You can use them to perform accurate filtering at the shader yourself, at the cost of more complex shader.

Finally, when using true multisampling, each pixel actually correspond with more than one fragment, so you get automatically antialiased pixel shaders at the cost of more memory and fillrate. You can't usually force this mode from the drivers, so you'll need to use the appropriate presentation parameters if you want to use this approach.

Share this post


Link to post
Share on other sites
You have confused super and multi-sampling. Super sampling runs your shader multiple times per final screen pixel, and not used too often nowadays.

Multisample only handles external polygon edges, and runs your shader once per final screen pixel.

Share this post


Link to post
Share on other sites
Quote:
Original post by SimmerD
You have confused super and multi-sampling. Super sampling runs your shader multiple times per final screen pixel, and not used too often nowadays.

Multisample only handles external polygon edges, and runs your shader once per final screen pixel.


Yea, I accidentally mixed up the terms. Sorry for that, otherwise the info should be correct [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!