Jump to content
  • Advertisement
Sign in to follow this  
ladzin

Early-Z

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

Hello, I'm wondering what exactly are the conditions on modern GPUs (e.g. GeForce 8800) for early-Z to be enabled. All I found on the web are some hints that something has been improved... It seems to me early-Z gets disabled when you're discarding fragments or modifying depth on pixel shader, but, are there some other conditions as well? What I'd need to do is to "carve out" parts of triangles, i.e., make certain fragments invisible/transparent (in order to render nice silhouettes), but still retain early-Z, as my pixel shader will be rather heavy. Deferred shading is of no help as the actual shading is trivial (the problem is in the carving -- it's something like relief mapping, but that's not important here I guess). Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ladzin
It seems to me early-Z gets disabled when you're discarding fragments or modifying depth on pixel shader

More the latter than the former. Good info here. BTW, alpha testing certainly won't disable early Z culling, and it sounds like that's what you're trying to do.

Share this post


Link to post
Share on other sites
Be sure to distinguish early-z from z-cull. Z-cull on Geforce 6, 7 and 8 is done on blocks of fragments after the coarse raster, and has the biggest performance impact. The only way to disable it is to write to depth in your pixel shader. Alpha tested (or texkill) fragments are culled no problem, the problem with them is that they stretch out the zcull near and far boundaries for each block (if z-writes are on), making subsequent zcull less efficient. On Geforce 8's there is also what Nvidia calls early-z, which is a per-pixel depth test BEFORE the pixel shader. Depth writes, alpha test and texkill all disable early-z and it happens after the pixel shader.

Share this post


Link to post
Share on other sites
regarding both early-z and z-cull; what happens if you do a depth pre-pass (as in something like crysis does; render only the depth to a depth buffer and also write the depth to a render target)?

Would doing a depth pre-pass allow you to safely use texkill, alpha testing, ect, in the color pass (with depth writing disabled) without disabling early z and z cull?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!