summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2020-03-06 20:34:32 +0000
committerDave Parks <davep@lindenlab.com>2020-03-06 20:34:32 +0000
commit3c5888e325fb4b450e6ed7f40d10c58cad348c1c (patch)
treeee984e8ba681a611024204acdab811a257ed03a3
parentf0a9b6c01bc1e348969e3c4ac1e929aefa538ea8 (diff)
parent0390dc2fec2afdc053f373813d419178a70b299c (diff)
Merged in davep/BUG-228263 (pull request #25)
Fix for mismatch on angular attenuation between sunlight on opaque and transparent objects from last commit.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl3
2 files changed, 5 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index e38eeab370..dc484317e9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -223,6 +223,7 @@ void main()
float da = dot(norm.xyz, light_dir.xyz);
da = clamp(da, -1.0, 1.0);
+ da = pow(da, 1.0/1.3);
float final_da = da;
final_da = clamp(final_da, 0.0f, 1.0f);
@@ -231,7 +232,7 @@ void main()
color.a = final_alpha;
- float ambient = da;
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0 - ambient);
@@ -262,7 +263,7 @@ vec3 post_atmo = color.rgb;
vec4 light = vec4(0,0,0,0);
color.rgb = scaleSoftClipFrag(color.rgb);
-
+
//convert to linear before applying local lights
color.rgb = srgb_to_linear(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index e4ebf0edee..d07de529ca 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -331,8 +331,9 @@ void main()
vec3 refnormpersp = normalize(reflect(pos.xyz, norm));
float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0);
+ da = pow(da, 1.0/1.3);
- float ambient = da;
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0 - ambient);