Closed colingeniet closed 1 year ago
I think this is caused by undefined behaviour in lcd.frag
: in
// apply contrast
color.rgb = ((color.rgb - 0.5) * contrast) + 0.5;
color = pow(color, gammaInv);
color = color * gl_FrontMaterial.emission.rgb;
there is no guarantee that color
is non-negative, and it is undefined behaviour if it is negative. Adding
diff --git a/Aircraft/JA37/Models/Effects/displays/lcd.frag b/Aircraft/JA37/Models/Effects/displays/lcd.frag
index 07159d78..1b91ddc3 100644
--- a/Aircraft/JA37/Models/Effects/displays/lcd.frag
+++ b/Aircraft/JA37/Models/Effects/displays/lcd.frag
@@ -79,6 +79,7 @@ void main (void) {
// apply contrast
color.rgb = ((color.rgb - 0.5) * contrast) + 0.5;
+ color = max(color, 0.0);
color = pow(color, gammaInv);
color = color * gl_FrontMaterial.emission.rgb;
solves the issue for me.
To reproduce: