summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2020-02-25 11:34:23 -0800
committerPtolemy <ptolemy@lindenlab.com>2020-02-25 13:25:15 -0800
commit22ec67975ccf7dd6da3dbddf94f503b14abee68e (patch)
tree3f757a79ad644a4efeb49dffd7e349cd873331aa
parent9d9b8901e4cb8f3e3d5eaf5beb76de6b00ec75e3 (diff)
SL-12574: Simplify Direct Ambient
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl8
2 files changed, 4 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 b1dce665a1..705cc2f04e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -81,11 +81,7 @@ void main()
norm.xyz = getNorm(tc);
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
- float da = dot(normalize(norm.xyz), light_dir.xyz);
- da = clamp(da, -1.0, 1.0);
-
- float final_da = da;
- final_da = clamp(final_da, 0.0, 1.0);
+ float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0);
vec4 diffuse_srgb = texture2DRect(diffuseRect, tc);
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
@@ -108,7 +104,7 @@ void main()
ambient *= ambient;
ambient = (1.0 - ambient);
- vec3 sun_contrib = final_da * sunlit;
+ vec3 sun_contrib = da * sunlit;
#if !defined(AMBIENT_KILL)
color.rgb = amblit;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index f49fad5517..593706867d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -85,11 +85,7 @@ void main()
float scol = 1.0;
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
- float da = dot(normalize(norm.xyz), light_dir.xyz);
- da = clamp(da, -1.0, 1.0);
-
- float final_da = da;
- final_da = clamp(final_da, 0.0, 1.0);
+ float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0);
vec4 diffuse_srgb = texture2DRect(diffuseRect, tc);
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
@@ -116,7 +112,7 @@ void main()
ambient *= ambient;
ambient = (1.0 - ambient);
- vec3 sun_contrib = min(scol, final_da) * sunlit;
+ vec3 sun_contrib = min(scol, da) * sunlit;
#if !defined(AMBIENT_KILL)
color.rgb = amblit;