GLSL gl_FragCoord.z Calculation and Setting gl_FragDepth
问题 So, I've got an imposter (the real geometry is a cube, possibly clipped, and the imposter geometry is a Menger sponge) and I need to calculate its depth. I can calculate the amount to offset in world space fairly easily. Unfortunately, I've spent hours failing to perturb the depth with it. The only correct results I can get are when I go: gl_FragDepth = gl_FragCoord.z Basically, I need to know how gl_FragCoord.z is calculated so that I can: Take the inverse transformation from gl_FragCoord.z