2014-05-13 13:40:30 -04:00
|
|
|
uniform sampler2D tex;
|
|
|
|
uniform float zn;
|
|
|
|
uniform float zf;
|
|
|
|
|
|
|
|
out float Depth;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2017-12-25 01:00:10 -05:00
|
|
|
vec2 uv = gl_FragCoord.xy / u_screen;
|
2014-05-13 13:40:30 -04:00
|
|
|
float d = texture(tex, uv).x;
|
|
|
|
float c0 = zn * zf, c1 = zn - zf, c2 = zf;
|
|
|
|
Depth = c0 / (d * c1 + c2);
|
|
|
|
}
|