summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2022-10-11 15:29:08 -0700
committerCosmic Linden <cosmic@lindenlab.com>2022-10-13 11:12:59 -0700
commit8a82305068f68ae4075be7ff86b5b4af8a71e5c3 (patch)
tree1faad92236a8c2a666045163f95c9cd054c8148b
parent3ac80d7ec2a1c04e3e4f191285aa5a19f071a40d (diff)
SL-18340: Fix PBR alpha materials treating spotlight as point light
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl7
1 files changed, 6 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 922da0c441..d7da50e25e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -126,7 +126,12 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
- vec3 intensity = dist_atten * lightColor * 3.0;
+ // spotlight coefficient.
+ float spot = max(dot(-ld, lv), is_pointlight);
+ // spot*spot => GL_SPOT_EXPONENT=2
+ float spot_atten = spot*spot;
+
+ vec3 intensity = spot_atten * dist_atten * lightColor * 3.0;
color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
}