- Significantly improve shadowmap light performance for faces with a large number of lights but where only a few applies to each individual fragment

This commit is contained in:
Magnus Norddahl 2017-08-08 23:28:42 +02:00
parent 33beca6e6f
commit 5c7b1ee8e1

View file

@ -220,6 +220,7 @@ float diffuseContribution(vec3 lightDirection, vec3 normal)
float pointLightAttenuation(vec4 lightpos, float lightcolorA)
{
float attenuation = max(lightpos.w - distance(pixelpos.xyz, lightpos.xyz),0.0) / lightpos.w;
if (attenuation == 0.0) return 0.0;
#ifdef SUPPORTS_SHADOWMAPS
float shadowIndex = abs(lightcolorA) - 1.0;
attenuation *= shadowmapAttenuation(lightpos, shadowIndex);