My editor uses auxiliary sections that are hidden if they are synchronized with the main model, but if you turn on the light, then a shadow map is also calculated for them, this can be seen by the sharp increase in triangles.
I don’t think there’s a way for you to mark mesh instances as visible/invisible each frame, specifically for the shadows. Your best option is to use MeshInstance.visible to mark mesh instances as visible, and this applies to both the main camera and also the shadow camera.