Jump to content
  • Advertisement
Sign in to follow this  
dkcycovery

Discarding fragments behind opaque parts using alpha testing

This topic is 3394 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

Hi, I have a number of equal planes over each other in a mesh. They have a pretty small distance to each other, so each plane occludes the one below most of the time. Now, every fragment of the rasterized planes is assigned an alpha value in the pixel shader. If there is a fragment of the rasterized uppermost plane which already is opaque according to my alpha testing function, I don't want to waste time evaluating underlying fragments. This would imply that drawing the Mesh from top to bottom (if I am looking from above) would be much faster than drawing from bottom to top. However, this does not seem to be the case here. Both ways of drawing the mesh result in about the same (bad) performance. I am using the following render states in the effect file (XNA): AlphaBlendEnable = false; AlphaTestEnable = true; AlphaFunc = Greater; AlphaRef = 0.5; ZEnable = true; ZWriteEnable = true; Is there anything else I should take care of? Or is what I want not possible using alpha testing?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by dkcycovery
However, this does not seem to be the case here. Both ways of drawing the mesh result in about the same (bad) performance.


Are you sure that overdraw is causing your bottleneck? You may be CPU or geometry limited, in which case fiddling with the blend/test state won't have any performance impact.

If you shrink your display to something tiny (so that you're only drawing a handful of pixels) does the performance stay the same or go up? If it's the same then your bottleneck is elsewhere.

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!