32Bit Depth

Started by
3 comments, last by galop1n 6 years, 7 months ago

The "HLSL Development Cookbook" uses DXGI_FORMAT_D32_UNORM/DXGI_FORMAT_R32_UNORM formats for the shadow map DSV/RSV. Unfortunately, these DXGI formats do not seem to exist (and if they did, I probably created all my D(S)Vs with the DXGI_FORMAT_D32_UNORM). Are these formats removed or is it just another erratum in the already large set for that book?

The closest DXGI format is DXGI_FORMAT_D24_UNORM_S8_UINT, I presume?

🧙

Advertisement

Those formats have never existed. Even if they did, they wouldn't make much sense since the 32-bit fixed-point precision would be lost upon being converted to a 32-bit float. 

So yeah, the closest format is the D24_UNORM. You can also use D32_FLOAT, but if you use that then I would reversing your depth buffer  (as discussed in this earlier thread).

27 minutes ago, MJP said:

they wouldn't make much sense since the 32-bit fixed-point precision would be lost upon being converted to a 32-bit float

 I see: the IEEE 754 mantissa is 23 bits. Thanks.

🧙

It is worth to note that there is one case you may want the unorm behavior and d16 is usually enough. It is with orthographic projection ( directional lights  ), in that case, there is no perspective divide and you will achieve better precision by using a UNORM versus FLOAT. Plus you save half the memory of going 32bits.

This topic is closed to new replies.

Advertisement