@threlte/extras

<BakeShadows>

<BakeShadows> instantly freezes all shadow maps upon mounting and unfreezes them upon unmounting. This improves performance by making all shadows static. Use <BakeShadows if you have a complex but static scene as the shadows will only be calculated once.

When <BakeShadows> is used within a <Suspense>, shadows will be frozen after the boundary is no longer in a suspended state. It will unfreeze if the boundary is re-suspended.

The example above is an ideal scene for <BakeShadows> because all objects are stationary and the shadows will never change.