Increase the number of lights

Hi,

I’d want to increase the number of lights used in my scene. I use the function maxSimultaneousLights but when the number increase 10, there is a mistake. The problem is that i have 60 spot lights.

Do you know a tip to simulate a large number of lights simultaneously ?

Thanks for your answers.

Boris

Hi @bvaisman - each light you add in your scene has a cost so I think you may want to do it differently and use an HDR environment. I’ll let @Evgeni_Popov, though.

Yes, using dozens of lights is not manageable currently, you should stick with less as there are some hardware limits, as you could see (the number of uniform buffers we can pass to a shader is limited and each light consumes one).

What you can try to do is determining the lights that are affecting the most a mesh and use the light.includedOnlyMeshes array to only have 4/5 lights affecting a mesh at any time.

There are technics to handle a lot of lights, but it’s a whole new world (Managing many lights in real time with clustered shading - YouTube).

Ok, i will try to reduce the number of lights. May be i could create a spot light for a certain number of spots because they are nearly contiguous.

Thanks for your answers.