14 lines
354 B
GLSL
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);
|
|
} |