#version 300 es
precision highp float;

out vec4 fragColor;

in vec3 vNormal;

float near = 1.;
float far = 18.;

void main() {
     //fragColor = vec4(vec3(gl_FragCoord.z), 1.0);

    // 将 gl_FragCoord.z 转换为线性深度
    float z = gl_FragCoord.z;
    float linearDepth = (2.0 * near * far) / (far + near - z * (far - near));
    fragColor = vec4(vec3(linearDepth / far), 1.0);
}
