summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-08-21 16:49:11 -0600
committerDave Houlton <euclid@lindenlab.com>2020-08-21 16:49:11 -0600
commit9de1f91daedaa7676909d09a7524afb8d9a23d92 (patch)
tree29e3440f4729e3c526ae81494fc6459b6b7fbc0d /indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
parent64a78b8c7f82641ce58761432d04458f0ebea721 (diff)
SL-13743 revert part of SL-12978 change that broke low-angle sunlight
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl9
1 files changed, 7 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 b7741ff48d..140d788fff 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -81,8 +81,13 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
haze_weight = vec4(haze_density) / temp1;
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
- // SL-12978: temp2.y = 1; optimized away
- sunlight *= exp(-light_atten);
+ temp2.y = max(0.0, tmpLightnorm.y);
+ if (abs(temp2.y) > 0.000001f)
+ {
+ temp2.y = 1. / abs(temp2.y);
+ }
+ temp2.y = max(0.0000001f, temp2.y);
+ sunlight *= exp(-light_atten * temp2.y);
// main atmospheric scattering line integral
temp2.z = Plen * dens_mul;