1
\$\begingroup\$

I lately came around methods optimizing the use of the depth buffer, as the easiest solution reverse depth buffering is mentioned but I cannot wrap my head around why I would be gaining a better depth distribution with it.

First I thought it to be that way because floats use well floating point format so if I can map 90% of the scene to near zero i can benefit from floats great precision near zero but then I saw that those 8 bit for the exponent are being reserved by stencil so now I don't think they store exponent data?

Edit: Now that i was told unnorm are just fixed precision and have actually tested that it does improve depth resolution indeed I dont understand how it can improve Z-buffering without having exponent data has someone a theory regarding why? If the UNORMs have fixed precision it should´nt matter whether I map the 99% that don't lay 3 meters in front of the camera to one or to zero.

\$\endgroup\$
  • \$\begingroup\$ depth as written to the depth buffer is not linear \$\endgroup\$ – ratchet freak Mar 10 '16 at 15:14
  • \$\begingroup\$ Well thats clear and part of the problem I know that, but reversing far and nearplane does nothing more than mirroring the depth values along 0.5 so if UNORM floats don´t have exponent bits this will yield as few values for distant parts of the scene as before or am I mistaken? \$\endgroup\$ – user5716904 Mar 10 '16 at 15:25
  • \$\begingroup\$ UNORM is not a floating point value, its fixed point masked in an int \$\endgroup\$ – Maik Semder Mar 10 '16 at 18:58
  • \$\begingroup\$ Yes thats what I feared, so then there is actually no gain at all in reverse depth buffering using them? So I have to drop the stencils and change the format to a real float to benefit from reverse depth buffering? \$\endgroup\$ – user5716904 Mar 10 '16 at 19:02
  • \$\begingroup\$ yes, DXGI_FORMAT_D32_FLOAT is a 32 bit floating point depth buffer \$\endgroup\$ – Maik Semder Mar 10 '16 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.