diff options
author | Runitai Linden <davep@lindenlab.com> | 2020-03-06 14:27:46 -0600 |
---|---|---|
committer | Runitai Linden <davep@lindenlab.com> | 2020-03-06 14:27:46 -0600 |
commit | f0a9b6c01bc1e348969e3c4ac1e929aefa538ea8 (patch) | |
tree | dfdf2c41578271b90b955dfba8133668823123fa /indra/newview/app_settings/shaders | |
parent | ce8bf1a3f303eb5af2c61f620845d124b022795a (diff) |
Fix for sunlight having improper gamma curve for angular attenuation. Fix for lack of angular attenuation on ambient lighting on triangles facing away from sun.
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 3 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 1acb8d08eb..b38f488a1f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -82,6 +82,7 @@ void main() vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); + da = pow(da, 1.0/1.3); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -99,7 +100,7 @@ void main() calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, false); - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 6f5b0981f9..da78691861 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -86,7 +86,7 @@ void main() vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - + da = pow(da, 1.0/1.3); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -107,7 +107,7 @@ void main() calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - float ambient = da; + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0 - ambient); |