Use Cascaded Shadows

Setting up Cascaded Shadows for mobile games.

Choose your operating system:

Windows

macOS

Linux

Stationary Directional lights can be used to cast Dynamic Cascade Shadow Maps (CSM) for the dynamic objects in your scene. When you use CSM shadows, the shadows on dynamic objects will blend correctly with the precomputed shadows cast by static objects in the scene.

In this How To, we set the CSM for specific objects in a level.

CascadedShadows_HeroImage.png

Steps

Required Setup: CSM will only work if you have a Directional Light in your scene. If you do not have one, add one now and make sure it is selected. See the Lighting Quick Start Guide for steps on building a simple room and adding lighting to it.

  1. Select the Directional Light in your scene. Then under the Transform section, ensure that the Mobility setting has been set to Stationary .

    Click for full image .

  2. With the Directional Light still selected, go to the Details panel and locate the Cascaded Shadows Maps section. Adjust the following properties on your Directional Light.

    Click for full image .

    Property Name

    Value

    Dynamic Shadow Distance Stationary Light

    2,000

    Num Dynamic Shadows Cascades

    1

    Dynamic Inset Shadow

    False

    The above settings are only suggestions. Feel free to experiment with the values, to find a result that will best fit your project.

  3. In the current release, the default setting is for all static meshes to have CSM enabled. However, you may want to turn off CSM for meshes that don't need them. To turn off CSM, select the mesh that doesn't need CSM enabled. In the Details panel under the Mobile section, click to uncheck the box for Receive CSM Shadows .

    CascadedShadows_Steps_MobileSectionReceiveCSMShadows.png

  4. From the Main Toolbar , change the Play Mode to Mobile Preview and press the Play button to launch the level.

    If you do not see the Mobile Preview window being displayed, make sure that it did not launch behind the Unreal Editor window.

    Click for full image .

The following video demonstrates what the Receive CSM Shadows setting does. In this video, the Receive CSM Shadows setting is turned on for the Static Mesh that makes up the floor, but turned off for the Static Mesh that makes up the stairs. Notice that when the player character is on the floor, they have a shadow, but when they are on the stairs they do not have a shadow. This is because the floor has the Receive CSM Shadows setting enabled, while the setting is disabled on the stairs.
If you want shadows from Static Meshes placed in the environment to cast shadows on the character, you will need to change the Mobility settings on the Static Mesh from Static to Movable .

End Results

Once your level successfully launches, position your character in a location that has static shadows and when you go in and out of the shadow, your character's Dynamic Shadows should now blend seamlessly with any baked shadows in the level, like in the image below.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss