grk464933/cw 4/shaders/shader_4_1.frag
2024-02-02 11:19:35 +01:00

14 lines
354 B
GLSL

#version 430 core
out vec4 fragColor;
float linearizeDepth(float depth, float near, float far) {
return (-2.0 * near * far) / ((far - near) * depth - (far + near));
}
void main()
{
float linearDepth = linearizeDepth(gl_FragCoord.z, 0.05, 20.0);
fragColor = vec4(1- linearDepth / 20.0, 1- linearDepth / 20.0, 1- linearDepth / 20.0, 1.0);
}