summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/ShadersTest/res/raw/depth_fs.glsl
blob: 096843b1bb4491b7686b1a3b663560fa5bd52b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
void main() {
    // Non-linear depth value
    float z = gl_FragCoord.z;
    // Near and far planes from the projection
    // In practice, these values can be used to tweak
    // the focus range
    float n = UNI_near;
    float f = UNI_far;
    // Linear depth value
    z = (2.0 * n) / (f + n - z * (f - n));

    gl_FragColor = vec4(z, z, z, 1.0);
}