summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/windlight
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-07-10 14:50:59 -0700
committerGraham Linden <graham@lindenlab.com>2019-07-10 14:50:59 -0700
commit664722168d7016d8bf80a65626bbff542913dc24 (patch)
tree688a2097614bb99d9e0c982a42db98ea6aed0560 /indra/newview/app_settings/shaders/class1/windlight
parentd23bf2c16e2d36b18c920bbd42f49c47f3c58bd9 (diff)
SL-1491
Make sun additive contribition depend on facing the sun (without breaking fog). Put back scaling factor keeping sun contrib from blowing out with new FS param range for glow.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/windlight')
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl10
1 files changed, 8 insertions, 2 deletions
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"