summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-05-30 15:58:51 -0700
committerGraham Linden <graham@lindenlab.com>2019-05-30 15:58:51 -0700
commitf7bff299f1a243e8c5bfdc2b98ea3c7b549778f1 (patch)
tree93717445d9d560b76d4f3d5544605387af66aa85 /indra/newview
parent9118cafb229bafef171f23b887fdd531834576ae (diff)
SL-11330
Put back atten for non-ALM lighting that accounts for inverted lin atten setup of yore.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl21
1 files changed, 7 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
index 2762a35403..45701002b8 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -38,27 +38,20 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
vec3 lv = lp.xyz-v;
//get distance
- float dist = length(lv);
-
- if (dist > la)
- {
- return 0;
- }
+ float d = length(lv);
//normalize light vector
- lv = normalize(lv);
-
- fa += 1.0;
- float dist_atten = min(1.0 - (dist-1.0*(1.0 - fa))/fa, 1.0);
-
- float da = max(dot(n, lv), 0.0);
-
+ lv *= 1.0/d;
+
+ //distance attenuation
+ float da = clamp(1.0/(la * d), 0.0, 1.0);
+
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
//angular attenuation
- da *= dist_atten;
+ da *= calcDirectionalLight(n, lv);
return da;
}