summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-05-03 08:47:13 -0700
committerGraham Linden <graham@lindenlab.com>2019-05-03 08:47:13 -0700
commit906b0be675e5467665f65180924e6117700b4cbb (patch)
tree1974fe65c87890c6c2711f82a20088184c931b58 /indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
parentc4032528aff8ef1938e897ec583bbf25a3e713e1 (diff)
SL-11087, SL-11086, SL-11092
Fix sun/moon glow factor bustage. Make darkness an option. Fix moon fade shader logic getting confused when sun was below horizon.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl13
1 files changed, 6 insertions, 7 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index ecb1d599de..0a189ff416 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -119,9 +119,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
//distance attenuation
float dist = (la > 0) ? d/la : 1.0f;
fa += 1.0f;
- float dist_atten = (fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f;
+ float dist_atten = (fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 0.0f;
dist_atten *= dist_atten;
- dist_atten *= 2.0;
+ dist_atten *= 2.2f;
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
@@ -131,15 +131,14 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float lit = max(da * dist_atten,0.0);
float amb_da = ambiance;
- if (da > 0)
+ if (lit > 0)
{
col = lit * light_col * diffuse;
amb_da += (da*0.5+0.5) * ambiance;
+ amb_da += (da*da*0.5 + 0.5) * ambiance;
+ amb_da *= dist_atten;
+ amb_da = min(amb_da, 1.0f - lit);
}
- amb_da += (da*da*0.5 + 0.5) * ambiance;
- amb_da *= dist_atten;
- amb_da = min(amb_da, 1.0f - lit);
-
col.rgb += amb_da * 0.5 * light_col * diffuse;
// no spec for alpha shader...