SL-12978 refactor sunlight intensity calculation

meow-7.2.2
Dave Houlton 2020-09-01 13:45:11 -06:00
parent 282498061f
commit 912afc940b
1 changed files with 3 additions and 8 deletions

View File

@ -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;