Clip space to world space with non-linear reverse depth buffer with WebGPU

You don’t have anything to do to handle reverse depth buffer:

In this PG, I simply display the output of worldFromUV. You will see the result is the same whether engine.useReverseDepthBuffer is true or false.

If you set a background plane (as I did in my PG), you get the same result with your PGs in both cases (using depth and not 1-depth in the reversed case), so your calculation must rely on the clear value used for the depth buffer (which is 0 in the reversed case, and 1 in the normal case).

1 Like