diff options
author | Graham Linden <graham@lindenlab.com> | 2019-03-25 14:52:23 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-03-25 14:52:23 -0700 |
commit | d99e2e119f08370b2003bad23617b7fdd435d19e (patch) | |
tree | 9bd5304cd306e07d4d05ff2d26c390b1da6d56a2 /indra/newview/app_settings/shaders/class2 | |
parent | 9c8cc0037a11861fa0561e8cda01d9ec7c996442 (diff) |
Add clamp to keep speccolor non-negative.
Make spot shadowing more consistent.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 11 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 11 |
2 files changed, 10 insertions, 12 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 4e3ecbcbf5..c4f406aa76 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -154,10 +154,8 @@ void main() if (proj_shadow_idx >= 0) { vec4 shd = texture2DRect(lightMap, frag.xy); - float sh[2]; - sh[0] = shd.b; - sh[1] = shd.a; - shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + shadow = max(shd.b, shd.a) + shadow_fade; + shadow = clamp(shadow, 0.0, 1.0); } vec3 norm = texture2DRect(normalMap, frag.xy).xyz; @@ -255,8 +253,9 @@ void main() if (nh > 0.0) { float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb*shadow; - //col += spec.rgb; + vec3 speccol = dlit*scol*spec.rgb*shadow; + speccol = max(speccol, vec3(0)); + col += speccol; } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index abea8aecca..67eb503e72 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -154,10 +154,8 @@ void main() if (proj_shadow_idx >= 0) { vec4 shd = texture2DRect(lightMap, frag.xy); - float sh[2]; - sh[0] = shd.b; - sh[1] = shd.a; - shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); + shadow = max(shd.b, shd.a) + shadow_fade; + shadow = min(shadow, 1.0); } vec3 norm = texture2DRect(normalMap, frag.xy).xyz; @@ -254,8 +252,9 @@ void main() if (nh > 0.0) { float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb*shadow; - //col += spec.rgb; + vec3 speccol = dlit*scol*spec.rgb*shadow; + speccol = max(speccol, vec3(0)); + col += speccol; } } |