Question about PositionFromDepth
omd24 opened this issue · comments
Would you please explain why we need to linearize depth when reconstructing the world position from depth value? Isn't the depth value after homogenous divide (and consequently the value stored in and read from depth buffer) nonlinear and therefore, shouldn't the reverse operation (i.e., going from NDC to world space) use that nonlinear depth value?
For the context, I'm asking about PositionFromDepth in Deferred.hlsl.
Hey there! That line to calculate linearDepth
actually looks like it's just a leftover from some earlier code that I neglected to delete. If you look you'll see it's not actually used in that function, only zw
is in the way that you described. Sorry about that!
Oops! 😅 Sorry for overlooking that, but thanks for clarifying!