Discarding fragments behind opaque parts using alpha testing

Started by
0 comments, last by OrangyTang 14 years, 11 months ago
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?
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.

This topic is closed to new replies.

Advertisement