From 32b99572f872f38be1ffc712b3a1aa131352f383 Mon Sep 17 00:00:00 2001 From: Ruslan Kabatsayev Date: Fri, 3 Feb 2023 21:54:20 +0600 Subject: [PATCH] Fix handling of lighting factor when rendering lunar eclipse Otherwise there's a visible transition between eclipse and no-eclipse code that wasn't as visible before the switch to linear-color rendering of planets and nonlinear handling of the eclipse. --- data/shaders/planet.frag | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/data/shaders/planet.frag b/data/shaders/planet.frag index 281b566fd989a..21f46a4ae36f2 100644 --- a/data/shaders/planet.frag +++ b/data/shaders/planet.frag @@ -445,6 +445,7 @@ void main() //finalColor.xyz=mix(vec3(1., 1., 1.), finalColor.xyz, 1.-mixfactor); finalColor.xyz=mix(vec3(1., 1., 1.), finalColor.xyz, smoothstep(0., 1., 1.-mixfactor)); } + finalColor *= litColor; #ifdef IS_MOON if(final_illumination < 0.9999) { @@ -454,14 +455,10 @@ void main() // Current implementation is a legacy from older times. lowp vec4 color = vec4(linearToSRGB(finalColor.rgb), finalColor.a); lowp float alpha = clamp(shadowColor.a, 0.0, 0.7); // clamp alpha to allow some maria detail - finalColor = eclipsePush * (1.0-0.75*shadowColor.a) * mix(color * litColor, shadowColor, alpha); + finalColor = eclipsePush * (1.0-0.75*shadowColor.a) * mix(color, shadowColor, alpha); finalColor.rgb = srgbToLinear(finalColor.rgb); } - else #endif - { - finalColor *= litColor; - } //apply white rimlight finalColor.xyz = clamp( finalColor.xyz + vec3(outgas), 0.0, 1.0);