Sign in to follow this  

render any float value to 32bit depth buffer

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

Using directx 10

 

I changed 

DepthClipEnable = FALSE;

 

and changed the viewport to

vpTRY.MinDepth = 0.0f;
vpTRY.MaxDepth = 16777216.0f;
 
but I still can't render a 10.0f float value to the 32 bit depth buffer
 
What else do I need to configure?
Edited by lomateron

Share this post


Link to post
Share on other sites
According to the documentation, MinDepth/MaxDepth have a valid range of between 0 and 1, and that the viewport scaling function is:
Z' = MinDepth + Z * (MaxDepth - MinDepth)

Your code should be producing an error at the moment due to that invalif value.
I'm not sure if you actually can render arbitrary float values to the ZB, or if you can only store fractions in [0,1]

Share this post


Link to post
Share on other sites
You may need the depth buffer format to be floating point. When you create the texture2d for the depth buffer, set the format to be
 
DXGI_FORMAT_D32_FLOAT                   
I've never actually made a floating point depth buffer and I'm not sure what graphics cart support this has but it is worth a shot.

Share this post


Link to post
Share on other sites

D32_FLOAT is a special format, designed to be within 0..1 range.

If you want to output larger values you can use a R32_FLOAT as render target (note: not depth stencil) and write your custom Z value in that, which will accept >1 values :)

Share this post


Link to post
Share on other sites

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