From 41e694c33efa17122c82950a0dc366d72019a5b2 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 27 Feb 2023 13:26:33 -0600
Subject: DRTVWR-559 Fix for local lights being applied to fullbright objects.

---
 .../app_settings/shaders/class3/deferred/materialF.glsl      | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index b00a6ed757..49529860be 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -382,11 +382,6 @@ void main()
     color.rgb = mix(atmosFragLightingLinear(color.rgb, additive, atten), fullbrightAtmosTransportFragLinear(color, additive, atten), emissive); 
     color.rgb = scaleSoftClipFragLinear(color.rgb);
 
-#ifdef WATER_FOG
-    vec4 temp = applyWaterFogView(pos, vec4(color, 0.0));
-    color = temp.rgb;
-#endif
-
     vec3 npos = normalize(-pos.xyz);
     vec3 light = vec3(0, 0, 0);
 
@@ -400,11 +395,18 @@ void main()
         LIGHT_LOOP(6)
         LIGHT_LOOP(7)
 
+    light *= 1.0-emissive;
     color += light;
 
+    glare *= 1.0-emissive;
     glare = min(glare, 1.0);
     float al = max(diffcol.a, glare) * vertex_color.a;
     
+#ifdef WATER_FOG
+    vec4 temp = applyWaterFogView(pos, vec4(color, 0.0));
+    color = temp.rgb;
+#endif
+
     frag_color = vec4(color, al);
 
 #else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer 
-- 
cgit v1.2.3