From 912afc940bc2e9680630ce2e9b282ecfc9b84050 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 1 Sep 2020 13:45:11 -0600 Subject: SL-12978 refactor sunlight intensity calculation --- .../shaders/class1/windlight/atmosphericsFuncs.glsl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'indra/newview') 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; -- cgit v1.2.3