fixed light flickering when rotating an object.

This commit is contained in:
Anemunt
2025-12-27 21:46:33 -05:00
parent d05286cb50
commit 1bedff2aff
2 changed files with 17 additions and 19 deletions

View File

@@ -9,7 +9,9 @@ uniform float threshold = 1.0;
void main() {
vec3 c = texture(sceneTex, TexCoord).rgb;
float luma = dot(c, vec3(0.2125, 0.7154, 0.0721));
float bright = max(luma - threshold, 0.0);
vec3 masked = c * step(0.0, bright);
float knee = 0.25;
float w = clamp((luma - threshold) / max(knee, 1e-4), 0.0, 1.0);
w = w * w * (3.0 - 2.0 * w);
vec3 masked = c * w;
FragColor = vec4(masked, 1.0);
}