From 49eae58bd0d1eceda18a3997454beb15a5e27cbd Mon Sep 17 00:00:00 2001
From: Graham Linden <graham@lindenlab.com>
Date: Thu, 6 Jun 2019 16:32:55 -0700
Subject: [PATCH] SL-10969

More tweaking ambient light.
---
 .../app_settings/shaders/class1/deferred/softenLightF.glsl  | 2 +-
 .../app_settings/shaders/class1/lighting/lightV.glsl        | 2 +-
 .../shaders/class1/windlight/atmosphericsFuncs.glsl         | 4 ++--
 .../app_settings/shaders/class2/deferred/softenLightF.glsl  | 3 +--
 .../app_settings/shaders/class3/lighting/lightV.glsl        | 6 +++---
 indra/newview/lldrawpooltree.cpp                            | 1 -
 indra/newview/lldrawpoolwlsky.cpp                           | 2 --
 7 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 13e0cb51694..7f7faffe78a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -111,7 +111,7 @@ void main()
         vec3 sun_contrib = final_da * sunlit;
 
 #if !defined(AMBIENT_KILL)
-        color.rgb = pow(amblit, vec3(1.0/1.3));
+        color.rgb = amblit * 2.0;
         color.rgb *= ambient;
 #endif
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
index 5e39d1629d2..751e7da53dd 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
@@ -35,7 +35,7 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
 	vec4 c = sumLights(pos, norm, color);
 
 #if !defined(AMBIENT_KILL)
-    c.rgb += atmosAmbient() * color.rgb * 0.5 * getAmbientClamp();
+    c.rgb += atmosAmbient() * color.rgb * getAmbientClamp();
 #endif
 
     return c;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 291e160cdc8..fa20d63a4aa 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -44,7 +44,7 @@ uniform float sun_moon_glow_factor;
 
 float getAmbientClamp()
 {
-    return 0.9;
+    return 1.0f;
 }
 
 void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
@@ -138,6 +138,6 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
 
     //brightness of surface both sunlight and ambient
     sunlit = sunlight.rgb * 0.5;
-    amblit = tmpAmbient.rgb * .5;
+    amblit = tmpAmbient.rgb * .25;
     additive *= vec3(1.0 - temp1);
 }
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 343e5c8ef53..92794ddaaea 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -119,8 +119,7 @@ void main()
         vec3 sun_contrib = min(scol, final_da) * sunlit;
 
 #if !defined(AMBIENT_KILL)
-        color.rgb = amblit * 0.5;
-        color.rgb = pow(color.rgb, vec3(1.0/1.1));
+        color.rgb = amblit * 2.0;
         color.rgb *= ambient;
 #endif
 
diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
index 6918ac3b8c7..cba87a1db7e 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
@@ -35,9 +35,9 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
 	vec4 c = sumLights(pos, norm, color);
 
 #if !defined(AMBIENT_KILL)
-    c.rgb += atmosAmbient() * color.rgb * 0.5 * getAmbientClamp();
+    c.rgb += atmosAmbient() * color.rgb * 2.0 * getAmbientClamp();
 #endif
-
-    return c; 
+ 
+    return c;
 }
 
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 5c7a819b8b4..b885008caea 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -97,7 +97,6 @@ void LLDrawPoolTree::render(S32 pass)
 	}
 
 	LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
-	//LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
 
 	gGL.getTexUnit(sDiffTex)->bind(mTexturep);
 				
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 968607de5d7..0542e39db42 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -513,7 +513,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
                 sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
                 sun_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
 
-                LLFacePool::LLOverrideFaceColor color_override(this, color);
                 face->renderIndexed();
 
                 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -565,7 +564,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
             moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
             moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
 
-            LLFacePool::LLOverrideFaceColor color_override(this, color);
             face->renderIndexed();
 
             gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-- 
GitLab