`ClusteredLightContainer.maxRange` does not work for some lights

For more details, please see the repro.

repro: https://playground.babylonjs.com/#CSCJO2#93

In this pg, the maxRange of clustered is set to 0.1.
Additionally, the range of each pointLight is set to 5.
Now, if you look at the rendered scene, you’ll notice that while most pointLights have their range correctly clamped to 0.1, a few lights ignore this range and illuminate a wider area.

Thank you for maintaining this great framework!

cc @Evgeni_Popov

Confirmed bug — thanks for the great repro! The clustered container’s addLight() was leaving the child light in each mesh’s per-mesh light list (mesh.lightSources) when it had been constructed with dontAddToScene = true (which happens when addLight() is the only thing that ever puts the light into the scene). The PBR shader then picked it up as a regular point light, bypassing the cluster entirely and ignoring maxRange. Because PBR materials default to maxSimultaneousLights = 4, only the first few lights showed the issue — which matches what you saw (“most lights are clamped, a few aren’t”).

Fix is up: Fix ClusteredLightContainer.maxRange ignored for some lights by Popov72 · Pull Request #18395 · BabylonJS/Babylon.js · GitHub

Thank you so much!
I’m looking forward to the release!