Language:
Page Info
Tags:
Engine Version:

Capsule Shadows Overview

Choose your OS:

In Unreal Engine 4 (UE4), we now support soft shadowing for characters in lit areas with Capsule Shadows which is a capsule representation of your character with a Physics Asset. This shadowing method can make a character feel grounded in these indirectly lit areas and have soft shadows in directly lit areas, which is not possible when using traditional shadow mapping techniques.

Character Capsule Representation

A Physics Asset is used to create an appoximate representation of the character to support very soft shadowing. Since the capsules are attached to the bones of the character, this allows for the shadow to move and cast accurately within the scene.

Character with Capsule Representation

Capsule Representation Only

The shadows on the ground are not representative of Capsule Shadows.

Usage

ShadowPhysicsAsset.png

Open your Skeletal Mesh, and in the Asset Details panel, use the Shadow Physics Asset selection to assign your Physics Asset that will be used for Capsule Shadows.

Capsule Shadow Settings

CapsuleShadowSettings.png

Property

Description

Capsule Direct Shadow

This will enable soft shadowing from direct (movable) lights when the capsule representation is assigned to the Skeletal Mesh's Shadow Physics Asset slot.

Capsule Indirect Shadow

This will enable soft shadowing from precomputed lighting (lightmaps and skylight) when the capsule representation is assigned to the Skeletal Mesh's Shadow Physics Asset slot.

Capsule Indirect Shadow Min Visibility

This will allow artists to control how dark the capsule shadow, in indirectly lit areas, can be.

Capsule Indirect Shadows

CapsuleShadowsSetting2.png

When you enable Capsule Indirect Shadow, the capsule representation of the character will be used to cast a directional soft shadow based on the volume lighting samples placed and computed by Lightmass during a lighting build. Capsule Indirect Shadows enables your characters to feel grounded in these areas where traditional shadow mapping will not work very well.

Capsule Indirect Shadow Enabled

Capsule Indirect Shadow Disabled

When Capsule Indirect Shadow is enabled, your character will cast a soft shadow that can ground them in areas with only bounce lighting.

Indirect Capsule Shadows Enabled

Indirect Capsule Shadows Disabled

In an open area with only a Sky Light as the light source, there will be little directionality, since light is coming from all around. This produces a subtle soft "blob" shadow below the character when using precomputed lighting.

In an enclosed area where light is coming through an opening, the indirect lighting cache is used to give directionality and softness to the capsule shadow by interpolating between the placed volume lighting samples as the character moves through the space. At the doorway, the character's shadow will be less intense with little directionality, but as the character moves further away from the doorway, the shadow's intensity and directionality will increase.

Indirect Minimum Shadow Visibility

Artists are afforded additional control by adjusting the Capsule Indirect Shadow Min Visibility. This enables you to adjust how dark the capsule shadow will be in indirectly lit areas, using precomputed lighting. This can be be useful to reduce any self-shadowing from a capsule in these areas, or to soften the shadow's intensity, so that it blends nicely with surrounding shadows.

Capsule Shadow Indirect Min Visibility: 0.1 (Default)

Capsule Shadow Indirect Min Visibility: 0.45

Capsule Direct Shadows

CapsuleShadowsSetting1.png

When Direct Capsule Shadow is enabled, the Light Source Angle for Directional Lights and Source Radius for Spot or Point Lights is used to define how soft the shadows will be from its receiving surface. This enables you to directly control the softness of your Capsule Shadows when directly lit.

Light Source Angle

The Light Source Angle property of a Directional Light is used for dynamic shadowing methods to create soft area shadows. When adjusting this property, the shadow will soften the further it is from the surface it's casting onto.

CS_LSA1.png

CS_LSA2.png

Light Source Angle: 1.0 (Default)

Light Source Angle: 2.0

Source Radius

Similarly to how the Light Source Angle of a Directional Light works, the Source Radius of a Stationary Spot or Point Light can be used to give your character soft shadows. When you use a larger Source Radius, the light will soften the further the shadow caster is from the surface.

CS_SR1.png

CS_SR2.png

Source Radius: 5.0

Source Radius: 15.0

Once lighting has been built for your scene, you can adjust the Source Radius property without having to rebuild lighting. This property only affects movable actors with Capsule Shadows or Mesh Distance Fields enabled.

Performance

The GPU performance cost of Capsule Shadows is proportional to the number of capsules used, the number of characters, and the screen size that their shadow affects.

Using a Radeon 7870 at 1080p, for example:

GPU Cost with 10 Capsules

Time in milliseconds (ms)

A single character on screen

0.29 ms

Each additional character on screen

0.05 ms

This implementation is very efficient, since it computes shadowing at half resolution with a depth-aware upsample, while using screen tile culling to reduce the amount of shadowing work to only happen where it is needed.

Limitations

  • Requires DirectX 11, due to tiled deferred implementation using compute shaders.

  • Self-shadowing artifacts can exist for arbitrary mesh shapes.

  • Can only use Sphyls and Spheres for capsule representation.

  • When capsule shadows get so soft that they become ambient occlusion, there's an artifact in the shadowing that causes a hard line.

Tags