Managing large number of lights and moving meshes

What is a good way to manage a large number of shadow casters, with an also-large number of directional lights? Say you have a hundred moving meshes, and dozens of directional lights throughout the scene. They are all spread out, so that each light only sees a “reasonable” amount of shadow casters, but the meshes move, so we need to add and remove them from shadow generators dynamically.

We could naively add every mesh to every light’s shadow generator, but is that sane? It sounds like a performance nightmare, but maybe the engine can quickly eliminate meshes beyond the light’s range, I dunno.

There’s also the question of what to do when a mesh is removed from the scene - does it need to be explicitly removed from all its shadow generators, or does the engine do that automatically?

Maybe @sebavan has some ideas?

You would definitely greatly benefit from only including what you need when you need perf wise.

Light as a way to include only some meshes or exclude some others. and yes Shadow generator wise adding/removing would be great as well as disabling the one you do not see.