I’ve been working on a litte tool to reduce shadowcaster count in a scene when using a realtime light or realtime shadows near the player in a baked scene - you can precompute this with the click of a button, or alter the settings to your liking.
I’ve done some real-world test with some of my scenes now, and most of the time the number of shadowcasters can be reduced significantly, depending on the scene layout of course. Here’s a comparison screenshot:
You can alter the accuracy values for each light type, so that you can further remove shadowcaster count by ignoring small meshes’ shadows that don’t contribute much to the overall visuals.
This works for directional, point and spot lights.
If this is of any interest to anyone, I’m going to release it in the asset store.
If you have any input or questions, I’d be glad to hear it.
It simply precomputes which renderers will be lit by the lights in your scene, without being in the shadow of other renderers (completely).
If you move your lights though, you’d need to recalculate again - but the precomputation works pretty fast as far as I can tell from my scenes ( I’ve used my own 3d art packs for testing purposes: Lowpoly Style Ultra Pack | 3D Landscapes | Unity Asset Store). But you wouldn’t do that every frame of course
But most of the time in my projects I have a static directional sun and use either realtime shadows or baked shadows with realtime shadows near my player, so I guess this will help a fair bit.
I’ve added a debug visualisation for each light type - in this example, the flower circled in red casts a shadow, but the flowers in the blue are in the shadow of the stone and thus their shadow is set to none.
I’ve added an important feature: you can choose to only precalculate static objects.
For example: If you have a spaceship that is controlled by your player in an asteroid field, this ship will not affect shadowcaster optimization calculations - the asteroids in the ships’ shadow will still cast shadows - the ship is invisible to the lighting precalculation.
Also you can now choose to only calculate the optimization for specific objects that you have selected.
You can either use all shadowcasting lights in the scene or only those lights you choose.
Hello @chassets ! Do you have made any progress on this one or would it be available? We’re looking to a solution to lower the amount of shadowcasters and this looks like it could work quite nice.
No, just my own stuff. I think you are right, I should submit again, maybe another reviewer will get what it’s for. Thanks for the interest, anyways.
Best,
CH