21 lines
501 B
GLSL
21 lines
501 B
GLSL
#version 330 core
|
|
in vec2 vUv;
|
|
in float vShade;
|
|
in float vWorldY;
|
|
|
|
out vec4 FragColor;
|
|
|
|
uniform sampler2D atlas;
|
|
uniform float u_caveDarkStartY;
|
|
uniform float u_caveDarkEndY;
|
|
uniform float u_caveMinBrightness;
|
|
|
|
void main()
|
|
{
|
|
vec4 texel = texture(atlas, vUv);
|
|
float t = clamp((u_caveDarkStartY - vWorldY) /
|
|
(u_caveDarkStartY - u_caveDarkEndY), 0.0, 1.0);
|
|
float brightness = mix(1.0, u_caveMinBrightness, t);
|
|
FragColor = vec4(texel.rgb * vShade * brightness, 1.0);
|
|
}
|