Download

Best way to handle creating dynamic shadow for player character?

I’ve got a large outdoor scene that is being lit by a dynamic light (there’s a lot that will change during the course of gameplay so pre-baking isn’t an option.)

I’d like to provide a shadow for my player mesh, the mesh is so small that it won’t generate a shadow using any settings that would be sane from a performance standpoint. How does this typically get handled? There must be some little tricks that are commonly used in situations like this.

Usually we use bCastInsetShadow on the component of the character, which causes him to get a dynamic shadow fitted tightly to his bounds, which tends to have better resolution than the Cascaded shadow maps being applied to the rest of the world.

There are some gotchas with this - you need to have the physics asset setup so the bounds are correct at runtime (use ‘show bounds’ to confirm). If you have multiple components on your character, they will all cast separate per-object shadows which will hurt performance. You can solve this by attaching all the other components to one of them (eg attach all the weapons on his back to his skeletal mesh body), enable bLightAttachmentsAsGroup on the root of the attachments.

DanielW, thank you this is just what I was looking for!