Newer
Older
qd_cnooc_front / static / Cesium / Shaders / Builtin / Functions / reverseLogDepth.glsl
[wangxitong] on 27 Nov 2021 346 bytes first commit
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;
}