summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-09-02 11:33:40 -0600
committerDave Houlton <euclid@lindenlab.com>2020-09-02 15:46:33 -0600
commit267e8fd9a383e333be8d7a0a289523f47bba4fac (patch)
treed383ab69ff9871c0f2b06da433cedc942b146eb9 /indra/newview/app_settings/shaders/class1
parenta027e8d4813c839babe2163943e46bf7f93fa005 (diff)
SL-12978 & SL-13743. Remove abrupt changes in sun intensity calc, preserve original fall-off.
Had to find a balance in the sunlight intensity calculation that behaves correctly for both these issues.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl6
1 files changed, 3 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 9c50453898..05e6e6a9f9 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -65,9 +65,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec4 blue_weight = blue_density / combined_haze;
vec4 haze_weight = vec4(haze_density) / combined_haze;
- //(TERRAIN) compute sunlight from lightnorm z component, roughly cosine(sun elevation) (for short rays like terrain)
- float above_horizon_angle = abs(lightnorm.z);
- sunlight *= exp(-light_atten * above_horizon_angle); // for atten and angle in [0..1], this maps to something like [0.3..1]
+ //(TERRAIN) compute sunlight from lightnorm y component. Factor is roughly cosecant(sun elevation) (for short rays like terrain)
+ float above_horizon_factor = 1.0 / max(1e-6, lightnorm.y);
+ sunlight *= exp(-light_atten * above_horizon_factor); // for sun [horizon..overhead] this maps to an exp curve [0..1]
// main atmospheric scattering line integral
float density_dist = rel_pos_len * density_multiplier;