Sign in to follow this  

modified depth and early-z-cull

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

A most intricate problem that seems to show up again and again for me: I need to draw lots and lots of small objects. In the fragment shader I could modify the fragments depth so it could be deaper into the scene but will never move the closer to the camera. If the hardware would know this it could use early-z-cull but in reality as soon as you modify the depth of a fragment you shut down early-z-cull. Is there some way to emulate this functionality, because I really need the speed early-z-cull would provide. (Potentially have very large amount of overdraw) /David

Share this post


Link to post
Share on other sites
I'm 99% sure you can't force early Z-culling on, because that would require two depth tests in the worst case - one for early Z-culling, and a second after you modify the depth -- and I'm fairly certain the pipeline doesn't handle that.

If you can, maybe try using a Z pre-pass instead. That way you only encounter the heavy overdraw when writing depth (which is really fast, since framebuffer writes seem to be the big bottleneck).

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
If you can, maybe try using a Z pre-pass instead. That way you only encounter the heavy overdraw when writing depth (which is really fast, since framebuffer writes seem to be the big bottleneck).


Don't think that will be possible for me. I do a expensive raymarching inside the shader, don't want to do that twice.

Share this post


Link to post
Share on other sites
Quote:
Original post by FoxHunter2
In the z-pre pass you don't do anything complex, just write the linear eye-depth into a render target (if necessary at all, just something for pre-filling the depth buffer)


What will that help me, in the later more complex pass when I modify depth I still won't be using early-z-cull, per definition. Also I need to place a limit on how much I can add to the depth (Takes some thought)
If I do the raymarching in the z-pre pass I will get no early-z-cull, even if store the depth in second render target and reuse it I probably will get worse performance.


To better explain the problem. I need to render lots of small objects. The objects polygonal mesh will provide a bounding box for a raytrace so, depth for each fragment on the hull could be offset an amount into to object thereby adding an POSITIVE offset to the depth for each fragment. I need to write this depth to the depth buffer so that the objects will intersect correctly but I also want to use early-z-cull to avoid any unecessary raymarching.

Share this post


Link to post
Share on other sites

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