TheRealMJP / DeferredTexturing

A rendering sample that demonstrates bindless deferred texturing using D3D12

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

commented

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!