From 9c23ede9799a3277ae8e79f9832b3ea557fc069d Mon Sep 17 00:00:00 2001
From: Graham Linden <graham@lindenlab.com>
Date: Fri, 3 May 2019 09:12:53 -0700
Subject: [PATCH] SL-11075

Make alpha shader apply vert color everywhere.
---
 indra/newview/app_settings/settings.xml                       | 2 +-
 .../newview/app_settings/shaders/class1/deferred/alphaF.glsl  | 1 +
 .../newview/app_settings/shaders/class1/deferred/cloudsF.glsl | 4 ++--
 indra/newview/app_settings/shaders/class1/deferred/moonF.glsl | 3 ++-
 .../app_settings/shaders/class2/deferred/softenLightF.glsl    | 2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index fd4c2917d52..062c3f4caed 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8818,7 +8818,7 @@
     <key>Type</key>
     <string>Boolean</string>
     <key>Value</key>
-    <integer>0</integer>
+    <integer>1</integer>
   </map>
   <key>RenderLocalLights</key>
   <map>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 0a189ff416b..b00e2290a9e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -194,6 +194,7 @@ void main()
 #ifdef USE_VERTEX_COLOR
     float final_alpha = diffuse_linear.a * vertex_color.a;
     diffuse_srgb.rgb *= vertex_color.rgb;
+    diffuse_linear.rgb *= vertex_color.rgb;
 #else
     float final_alpha = diffuse_linear.a;
 #endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index c5eaacbd0bb..595efdf6fed 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -120,11 +120,11 @@ void main()
     vec4 color;
     color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient);
     color.rgb= max(vec3(0), color.rgb);
-    color.rgb = linear_to_srgb(color.rgb);
+    //color.rgb = linear_to_srgb(color.rgb);
 
 //alpha1 = 1.0;
 //color.rgb = cloudColorAmbient.rgb;
-
+color.rgb = vec3(1,0,1);
 
     /// Gamma correct for WL (soft clip effect).
     frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 8256d5f1061..80f232948ac 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -57,7 +57,8 @@ void main()
     // and shows true moon color at night
     vec3 luma_weights = vec3(0.3, 0.5, 0.3);
 
-    float mix = 1.0 - dot(normalize(sunlight_color.rgb), luma_weights);
+    vec4 light_color = max(sunlight_color, moonlight_color);
+    float mix = 1.0 - dot(normalize(light_color.rgb), luma_weights);
 
     vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0  - 1.0;
     c.rgb = pow(c.rgb, exp);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index a2fbec524e5..8fcd26eba93 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -153,7 +153,7 @@ vec3 post_diffuse = color.rgb;
                 float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
                 vec3 speccol = sun_contrib*scontrib*spec.rgb;
                 speccol = clamp(speccol, vec3(0), vec3(1));
-                bloom += dot (speccol, speccol) / 6;
+                bloom += dot (speccol, speccol) / 12;
                 color += speccol;
             }
         }
-- 
GitLab