stk-code_catmod/data/shaders/linearizedepth.frag
2014-08-02 00:50:56 +02:00

14 lines
247 B
GLSL

uniform sampler2D tex;
uniform float zn;
uniform float zf;
out float Depth;
void main()
{
vec2 uv = gl_FragCoord.xy / screen;
float d = texture(tex, uv).x;
float c0 = zn * zf, c1 = zn - zf, c2 = zf;
Depth = c0 / (d * c1 + c2);
}