summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl11
1 files changed, 3 insertions, 8 deletions
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 140d788fff..bc6b006afa 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -80,14 +80,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
blue_weight = blue_density / temp1;
haze_weight = vec4(haze_density) / temp1;
- //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
- 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);
+ //(TERRAIN) compute sunlight from lightnorm z component, roughly cosine(sun elevation) (for short rays like terrain)
+ float above_horizon_angle = abs(tmpLightnorm.z);
+ sunlight *= exp(-light_atten * above_horizon_angle); // for atten and angle in [0..1], this maps to something like [0.3..1]
// main atmospheric scattering line integral
temp2.z = Plen * dens_mul;