summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl4
7 files changed, 24 insertions, 16 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 15408b3475..759c49a0fa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -75,7 +75,7 @@ vec2 encode_normal (vec3 n);
vec3 scaleSoftClipFrag(vec3 l);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive, bool use_ao);
#ifdef HAS_SHADOW
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
@@ -201,6 +201,8 @@ void main()
}
#else
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;
+
float final_alpha = diffuse_linear.a * vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb;
diffuse_linear.rgb *= vertex_color.rgb;
@@ -210,11 +212,10 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false);
+ calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false);
vec2 abnormal = encode_normal(norm.xyz);
- vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;
float da = dot(norm.xyz, light_dir.xyz);
da = clamp(da, -1.0, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 4cbef89fef..38792601f6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -41,7 +41,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color);
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
vec3 scaleSoftClipFrag(vec3 l);
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cs);
@@ -304,6 +304,8 @@ void main()
float envIntensity = final_normal.z;
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+
vec3 color = vec3(0.0);
float bloom = 0.0;
@@ -312,11 +314,10 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false);
+ calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false);
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
float da = dot(normalize(norm.xyz), normalize(light_dir.xyz));
da = clamp(da, -1.0, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 0d180e5798..269b76a19f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -59,7 +59,7 @@ uniform vec2 screen_res;
vec3 getNorm(vec2 pos_screen);
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
float getAmbientClamp();
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
vec3 scaleSoftClipFrag(vec3 l);
@@ -101,7 +101,7 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, false);
+ calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, false);
float ambient = da;
ambient *= 0.5;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 786a65df0f..3fe3b7afd3 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -47,7 +47,7 @@ float getAmbientClamp()
return 1.0f;
}
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) {
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) {
vec3 P = inPositionEye;
@@ -103,13 +103,19 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
//compute haze glow
//(can use temp2.x as temp because we haven't used it yet)
temp2.x = dot(Pn, tmpLightnorm.xyz);
+
+ // dampen sun additive contrib when not facing it...
+ if (length(light_dir) > 0.01)
+ {
+ temp2.x *= max(0.0f, dot(light_dir, Pn));
+ }
temp2.x = 1. - temp2.x;
//temp2.x is 0 at the sun and increases away from sun
temp2.x = max(temp2.x, .001); //was glow.y
//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
temp2.x *= glow.x;
//higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.x = pow(temp2.x, glow.z);
+ temp2.x = pow(temp2.x, glow.z * 0.2);
//glow.z should be negative, so we're doing a sort of (1 / "angle") function
//add "minimum anti-solar illumination"
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index eeab6ed03d..0223cef531 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -59,7 +59,7 @@ uniform vec2 screen_res;
vec3 getNorm(vec2 pos_screen);
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
float getAmbientClamp();
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
vec3 scaleSoftClipFrag(vec3 l);
@@ -109,7 +109,7 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, true);
+ calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true);
float ambient = da;
ambient *= 0.5;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index baba79ca96..a4bd0d566b 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -32,7 +32,7 @@ void setPositionEye(vec3 v);
vec3 getAdditiveColor();
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
void calcAtmospherics(vec3 inPositionEye) {
@@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 tmpamblit = vec3(1);
vec3 tmpaddlit = vec3(1);
vec3 tmpattenlit = vec3(1);
- calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, false);
+ calcAtmosphericVars(inPositionEye, vec3(0), 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, false);
setSunlitColor(tmpsunlit);
setAmblitColor(tmpamblit);
setAdditiveColor(tmpaddlit);
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
index 7b4269ca6f..b76192d73f 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
@@ -32,7 +32,7 @@ void setPositionEye(vec3 v);
vec3 getAdditiveColor();
-void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
void calcAtmospherics(vec3 inPositionEye) {
@@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 tmpamblit = vec3(1);
vec3 tmpaddlit = vec3(1);
vec3 tmpattenlit = vec3(1);
- calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, true);
+ calcAtmosphericVars(inPositionEye, vec3(0), 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, true);
setSunlitColor(tmpsunlit);
setAmblitColor(tmpamblit);
setAdditiveColor(tmpaddlit);