diff options
author | Graham Linden <graham@lindenlab.com> | 2019-06-25 11:39:33 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-06-25 11:39:33 -0700 |
commit | d86464182dd69aac5368f77dbb11a3e84ce4dadb (patch) | |
tree | b2ab652bb55e68c3c57ab7d868933da4e1a85d72 /indra/newview | |
parent | cc1ae963d57c4265286fbf660949f42f215a4c62 (diff) |
SL-1491
Nerf backfacing additive in ALM to prevent lens flares when facing away from sun.
Use hack in spec gbuffer alpha to nerf additive only on terrain (leaves additive glare for sunsets on water).
Diffstat (limited to 'indra/newview')
3 files changed, 6 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 0d180e5798..fd1191547b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -176,7 +176,8 @@ vec3 post_env = color.rgb; if (norm.w < 1) { #if !defined(SUNLIGHT_KILL) - color = atmosFragLighting(color, additive, atten); + float additive_angular_atten = max(0.0, dot(light_dir, normalize(pos.xyz))); + color = atmosFragLighting(color, additive * additive_angular_atten * (1.0 - spec.a), atten); color = scaleSoftClipFrag(color); #endif } diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index b49d86b2a2..5f345078b6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -69,7 +69,7 @@ void main() #endif frag_data[0] = outColor; - frag_data[1] = vec4(0.0,0.0,0.0,0.0); + frag_data[1] = vec4(0.0,0.0,0.0,1.0); vec3 nvn = normalize(vary_normal); frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, 0.0); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 23ed3fb3d9..ee39fa81f5 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -184,7 +184,9 @@ vec3 post_env = color.rgb; if (norm.w < 1) { #if !defined(SUNLIGHT_KILL) - color = atmosFragLighting(color, additive, atten); + vec3 p = normalize(pos.xyz); + float additive_angular_atten = max(0.0, dot(light_dir.xyz, p.xyz)); + color = atmosFragLighting(color, additive * additive_angular_atten * (1.0 - spec.a), atten); color = scaleSoftClipFrag(color); #endif } |