mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 19:28:49 -04:00
16 lines
331 B
GLSL
16 lines
331 B
GLSL
#version 430
|
|
out vec4 fragColor;
|
|
in vec2 texCoords;
|
|
|
|
uniform float zNear;
|
|
uniform float zFar;
|
|
|
|
layout(binding = 5) uniform sampler2D depthBuffer;
|
|
|
|
float zFromDepth(float depthBufferValue) {
|
|
return zNear*zFar/(depthBufferValue*(zNear - zFar) + zFar);
|
|
}
|
|
|
|
void main() {
|
|
fragColor.r = zFromDepth(texture(depthBuffer, texCoords).r);
|
|
} |