summaryrefslogtreecommitdiff
path: root/indra/newview
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
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')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl4
5 files changed, 17 insertions, 21 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...
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index f640dba59b..54bed38fb7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -120,7 +120,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
fa += 1.0f;
float dist_atten = ( fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f;
dist_atten *= dist_atten;
- dist_atten *= 2.0;
+ dist_atten *= 2.2f;
if (dist_atten <= 0)
{
@@ -143,13 +143,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
{
col = light_col*lit*diffuse;
amb_da += (da*0.5 + 0.5) * ambiance;
+ amb_da += (da*da*0.5+0.5) * ambiance;
+ amb_da = min(amb_da, 1.0f - lit);
}
- amb_da += (da*da*0.5+0.5) * ambiance;
- amb_da = min(amb_da, 1.0f - lit);
-
-#ifndef NO_AMBIANCE
- col.rgb += amb_da * 0.5 * light_col * diffuse;
-#endif
+ col.rgb += amb_da * 0.25 * light_col * diffuse;
if (spec.a > 0.0)
{
@@ -362,7 +359,7 @@ vec3 post_diffuse = color.rgb;
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
vec3 speccol = sun_contrib*scol*spec.rgb;
speccol = clamp(speccol, vec3(0), vec3(1));
- bloom = dot(speccol, speccol) / 6;
+ bloom = dot(speccol, speccol) / 6.0f;
color += speccol;
}
}
@@ -400,7 +397,7 @@ vec3 post_atmo = color.rgb;
vec3 light = vec3(0,0,0);
- #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w * 0.5);
+ #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 84642b2f98..d13a717761 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -146,7 +146,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.0;
color += speccol;
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index b05d544938..54ec534d14 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -224,14 +224,14 @@ void main()
col = dlit*lit*diff_tex*shadow;
// unshadowed for consistency between forward and deferred?
- amb_da += (da*0.5+0.5) * (1.0-shadow) * proj_ambiance;
+ amb_da += (da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
// use unshadowed for consistency between forward and deferred?
- amb_da += (da*da*0.5+0.5) * (1.0-shadow) * proj_ambiance;
+ amb_da += (da*da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
amb_da *= dist_atten * noise;
amb_da = min(amb_da, 1.0-lit);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index a3ff754849..2ef7cffe9d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -220,13 +220,13 @@ void main()
col = dlit*lit*diff_tex*shadow;
- amb_da += (da*0.5+0.5) * (1.0-shadow) * proj_ambiance;
+ amb_da += (da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
- amb_da += (da*da*0.5+0.5)*(1.0-shadow)*proj_ambiance;
+ amb_da += (da*da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
amb_da *= dist_atten * noise;
amb_da = min(amb_da, 1.0-lit);