Shadowcaster Optimizer

Hi!

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:

Before it has 773 shadowcasters, afterwards 381 - so it saved roughly 50% in this scene:

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.

Thanks and have a nice day,
CH

2 Likes

How does it work? :slight_smile:

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 :smile:

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.

1 Like

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.

1 Like

Made another test with my biggest 3d asset (huge scene, lots and lots of 3d objects) - also turned shadow distance far up.

This time 2999 versus 1514 shadowcasters, so again 50% less.


If I drag the accuracy slider a bit down, I can get easily down to ~1k shadowcasters without being very noticable.


I’ll improve the UI a bit, but I think afterwards I’ll be ready to release this.

  • 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.

Hi!
Unity asset store sadly rejected it for whatever reason, but I could provide it directly.

Best, CH

have 3rd party models ?
try again, seems like a good asset

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

Hi, I guess this didn’t make it on the Asset store
Is there any way to get this tool? I’m interested to test it
Can’t PM you on this forum apparently

I too would love a tool like this. Please send it to m

Hey, I too would love this asset if possible.
I am unable to send you a private message as you limited who can see you on the forum. Cheers

Hi,
im also interested in trying out this asset…