I saw the vertex shader calculation of the depth renderer:
#ifdef STORE_CAMERASPACE_Z
vViewPos = view * worldPos;
#else
#ifdef USE_REVERSE_DEPTHBUFFER
vDepthMetric = ((-gl_Position.z + depthValues.x) / (depthValues.y));
#else
vDepthMetric = ((gl_Position.z + depthValues.x) / (depthValues.y));
#endif
#endif
In vDepthMetric, the gl_Position. z value is in the ndc space, and the depthValues value is in the camera view space. Why can these two be calculated together?