stk-code_catmod/data/shaders/linearizedepth.frag
Vincent Lejeune 59484ea09a DS buffer is not linear and cant be mipmapped
Use the method provided by SAO paper (ie convert to linear and then
mipmap)
2014-05-13 19:40:30 +02:00

14 lines
219 B
GLSL

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