diff options
author | Michael Pohoreski <ptolemy@lindenlab.com> | 2020-07-02 21:45:18 +0000 |
---|---|---|
committer | Michael Pohoreski <ptolemy@lindenlab.com> | 2020-07-02 21:45:18 +0000 |
commit | aeff11fbde03afbe2422b6cd57a5403cbb7c8c67 (patch) | |
tree | 22a9e2ed41e737180b28f4717aea6b2a25471966 /indra/newview/app_settings/shaders/class1/windlight | |
parent | 6f388f2276c4138f34b49ab630b0288c79ca4cec (diff) | |
parent | 9f0225abaa3011de0845a330fb6d7ef60ab20039 (diff) |
Merged in SL-12978 (pull request #180)
SL-12978
Approved-by: Dave Houlton
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/windlight')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index dcb02bd1c1..4d12c5d19a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -47,13 +47,13 @@ float getAmbientClamp() } -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) { - +void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) +{ vec3 P = inPositionEye; //(TERRAIN) limit altitude - if (P.y > max_y) P *= (max_y / P.y); - if (P.y < -max_y) P *= (-max_y / P.y); + if (P.y > max_y) P *= ( max_y / P.y); + if (P.y < -max_y) P *= (-max_y / P.y); vec3 tmpLightnorm = lightnorm.xyz; @@ -81,13 +81,8 @@ 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) - 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); + // SL-12978: temp2.y = 1; optimized away + sunlight *= exp(-light_atten); // main atmospheric scattering line integral temp2.z = Plen * dens_mul; @@ -141,11 +136,13 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); } + // Similar/Shared Algorithms: + // indra\llinventory\llsettingssky.cpp -- LLSettingsSky::calculateLightSettings() + // indra\newview\app_settings\shaders\class1\windlight\atmosphericsFuncs.glsl -- calcAtmosphericVars() //haze color - additive = - vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) - + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x - + tmpAmbient)); + vec3 cs = sunlight.rgb * (1.-cloud_shadow); + additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + + (haze_horizon * haze_weight.rgb) * (cs * temp2.x + tmpAmbient.rgb); //brightness of surface both sunlight and ambient sunlit = sunlight.rgb * 0.5; |