Sign in to follow this  

Discarding fragments behind opaque parts using alpha testing

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

This topic is 3150 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this