summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-07-27 10:21:34 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-07-27 10:21:34 -0700
commitae2d4a1e1b9e19a6ac5a7354f56bd7b650e988a0 (patch)
tree0711b3f2d6bb4814f56c2e1d54ad692f50d36bf6 /indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
parentc2ce98e930175b584a41946821222cc849621336 (diff)
SL-17762: Cleanup dist_atten
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl20
1 files changed, 10 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index 300e3b8e76..72ae733622 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -132,17 +132,9 @@ void main()
vec3 n;
vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG()
- float fa = falloff+1.0;
- float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
- dist_atten *= dist_atten;
- dist_atten *= 2.0;
+ float dist_atten = 1.0 - (dist + falloff)/(1.0 + falloff);
- if (dist_atten <= 0.0)
- {
- discard;
- }
-
- lv = proj_origin-pos.xyz;
+ lv = proj_origin-pos.xyz; // NOTE: Re-using lv
vec3 h, l, v = -normalize(pos);
float nh, nl, nv, vh, lightDist;
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
@@ -166,6 +158,14 @@ void main()
}
else
{
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
+
+ if (dist_atten <= 0.0)
+ {
+ discard;
+ }
+
float noise = texture2D(noiseMap, tc/128.0).b;
if (proj_tc.z > 0.0 &&
proj_tc.x < 1.0 &&