#version 100 precision mediump int; precision mediump float; varying vec2 depth; void main() { #if LINEAR_RANGE float finalDepth = depth.x; #else float finalDepth = depth.x / depth.y; #endif // just smear across all components // therefore this one needs high individual channel precision gl_FragColor = vec4(finalDepth, finalDepth, finalDepth, 1.0); }