There have been a lot of posts about the
maxSimultaneousLights on a material, and setting
light.includedOnlyMeshes helps get around most of the issues with this.
However the problem I’m running into is when I have meshes that need to move across more than
maxSimultaneousLights in a scene.
So far the way I’ve tried to workaround it is to add and remove meshes from the
includedOnlyMeshes list of the lights that they come into the influence of. This works, however there is a stutter when changing
includedOnlyMeshes on lights. My guess is that it’s shader recompilation?
Is there any way around that, or is there a better way to handle this type of scenario?
Things I haven’t tried yet, but may work:
- Assign 4 lights to the moving meshes, and update the lights position / color / intensity to match the world lights they come into influence of (I assume this will also create a shader recompilation though?).
- Somehow read the light level of the texture beneath the mesh and update the mesh to match (ala old 2.5d engines).
Any other ideas?