feat(rendering): add fog-distance darkness to chunk shaders

This commit is contained in:
2026-06-01 15:46:33 +02:00
parent 2e36d40386
commit aa1aa6fec6
2 changed files with 13 additions and 3 deletions

View File

@@ -1,13 +1,20 @@
#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);
FragColor = vec4(texel.rgb * vShade, 1.0);
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);
}