1 void main() { 2 // Non-linear depth value 3 float z = gl_FragCoord.z; 4 // Near and far planes from the projection 5 // In practice, these values can be used to tweak 6 // the focus range 7 float n = UNI_near; 8 float f = UNI_far; 9 // Linear depth value 10 z = (2.0 * n) / (f + n - z * (f - n)); 11 12 gl_FragColor = vec4(z, z, z, 1.0); 13 } 14