Jump to content
  • Advertisement
Sign in to follow this  
lomateron

render any float value to 32bit depth buffer

This topic is 1130 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!