Using Capsule Shadows on Large Objects in UE4

Posted December 8th, 2017 in game-development

Capsule shadows are a great feature of Unreal Engine as they allow characters to cast soft shadows even with a game which relies on only static lighting.

The Last of Us 1 used this to great effect, as levels had a lot of areas which didn't receive dynamic lighting, and characters still felt grounded in the world using the capsule shadow technique (below).

Ine of the characters from the game The Last of Us, and their capsule shadow.

Source: Arnage on the Unreal Engine 4 forums

The use of this does not have to be limited to characters however - the technique can be applied to other set pieces. The only caveat is that they have to be skeletal meshes, not static meshes.

Moving Set Pieces

Estranged is a statically lit game, with dynamic lights in some limited places. This is a stylistic and performance-driven decision, and means that large moving objects either need to be lit by a dynamic light, or need to use capsule shadows in order to look realistic.

A train car with a fully dynamic shadow.

I recently introduced a train sequence into Estranged, which the above mesh moves towards the player. The train needed a shadow as it looked completely out of place, so I created a second physics asset containing three very large capsules hanging a little below the mesh:

The same train car, showing the physics objects used to represent its geometry for capsule shadows.

This grounded it in the world in a much more believable fashion (see the result in-game).

While the shadow is a little lumpy, it isn't that noticable and looks a lot better with than without the shadow.

Tagged shadow capsule character light dynamic train game unreal engine world

Comments

Please click here to load comments.