I get it from Builtin/Functions/reverseLogDepth.glsl
:
float czm_reverseLogDepth(float logZ)
{
#ifdef LOG_DEPTH
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = pow(2.0, log2Depth) - 1.0;
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
#endif
return logZ;
}
What’s the param logZ
? Is the log depth value that can get from czm_unpackDepth
function?
What does this function return, the expression far * (1.0 - near / (depthFromNear + near)) / (far - near)
, if define LOG_DEPTH?
Without comments the builtin glsl function really confused me, or how should I learn what I am missing?
Thanks.