59484ea09a
Use the method provided by SAO paper (ie convert to linear and then mipmap)
14 lines
219 B
GLSL
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);
|
|
}
|