diff --git a/libraries/model/src/model/Light.slh b/libraries/model/src/model/Light.slh index de15e50908..7cb745ff53 100644 --- a/libraries/model/src/model/Light.slh +++ b/libraries/model/src/model/Light.slh @@ -98,10 +98,8 @@ float getLightShowContour(Light l) { return l._control.w; } -// Light is the light source its self, d is the light's distance, and ulightvec is the unnormalized light vector. -// Note that ulightvec should be calculated as light position - fragment position. -// Additionally, length(light position) != dot(light position, light position). -float evalLightAttenuation(Light l, float d, vec3 ulightvec) { +// Light is the light source its self, d is the light's distance calculated as length(unnormalized light vector). +float evalLightAttenuation(Light l, float d) { float radius = getLightRadius(l); float denom = d / radius + 1.0; float attenuation = 1.0 / (denom * denom); diff --git a/libraries/render-utils/src/point_light.slf b/libraries/render-utils/src/point_light.slf index 581aa8c250..8c9ff2c8ad 100644 --- a/libraries/render-utils/src/point_light.slf +++ b/libraries/render-utils/src/point_light.slf @@ -67,7 +67,7 @@ void main(void) { vec4 shading = evalFragShading(fragNormal, fragLightDir, fragEyeDir, frag.metallic, frag.specular, frag.roughness); // Eval attenuation - float radialAttenuation = evalLightAttenuation(light, fragLightDistance, fragLightVec); + float radialAttenuation = evalLightAttenuation(light, fragLightDistance); // Final Lighting color vec3 fragColor = (shading.w * frag.diffuse + shading.xyz); diff --git a/libraries/render-utils/src/spot_light.slf b/libraries/render-utils/src/spot_light.slf index 1cb6ebb878..63e87e95c0 100644 --- a/libraries/render-utils/src/spot_light.slf +++ b/libraries/render-utils/src/spot_light.slf @@ -74,7 +74,7 @@ void main(void) { vec4 shading = evalFragShading(fragNormal, fragLightDir, fragEyeDir, frag.metallic, frag.specular, frag.roughness); // Eval attenuation - float radialAttenuation = evalLightAttenuation(light, fragLightDistance, fragLightVec); + float radialAttenuation = evalLightAttenuation(light, fragLightDistance4); float angularAttenuation = evalLightSpotAttenuation(light, cosSpotAngle); // Final Lighting color