Light material limit

There is a limit on the number of uniform buffers used in a shader. It seems 12 is a common value, at least it’s the one of my GPU for the vertex shader.

Each light consumes a buffer. Babylon is also using a buffer for the scene, mesh and material objects. So, with 9 lights, you reach the limit of 12. Adding a new light will get you an error saying that you exceed the maximum number of uniform buffers you can use in a vertex shader. In 4.2 we did not create a uniform buffer for the mesh data, so you had room for an additional light compared to 5.0.

I can set mtl.maxSimultaneousLights = 300

maxSimultaneousLights is just the maximum number of simultaneous lights allowed, it does not create uniform buffers. Try to create 11 lights: it won’t work even in 4.2 (because 11 lights + scene + material buffers = 13):