Platformer Drop Shadow | Blueprint Documentation

Thanks for checking out my Platformer Drop Shadow asset. This page contains a breakdown of the Blueprint content and how you can configure the effect for best results in your own project.

There is a frequently asked questions section at the bottom of this page, but if you have any feedback, questions, or feature requests please don’t hesitate to reach out. I’d love to hear from you.

BP_DemoCharacter

The logic for the Drop Shadow effect is stored in BP_DemoCharacter, a modified version of the character from the default Third-Person Template. This character is purely for demonstration purposes, intended to provide some context for how the system works and get you up and running.

The entire effect is nestled within three functions and creates its own components at runtime as necessary, so when you’re ready it shouldn’t be difficult to port it accross to your own characters.

Functions

InitializeDropShadow

Creates the necessary components and materials for the effect, intended to be fired once when the Drop Shadow is first activated. It will add a Decal Component, and if bUserRenderTexture is true it’ll also add a Scene Capture Component for the Render Texture.

DrawDropShadowTraces

Draws a user-defined number of line traces in a circle around the character, all shooting directly down. We use the information gathered from these traces to find the closest and furthest distance to the ground. This is used to define the size of the decal (among other things).

The reason we draw a circile of traces is to make sure that if the character is above the edge of an object, we draw the shadow on all applicable surfaces and not just the closest one.

UpdateDropShadow

UpdateDropShadow is meant to be fired regularly to update the effect. It uses the DrawDropShadowTraces function to set the scale and position of the decal component, as well as set the Decal’s material parameters based on the character’s distance from the ground.

You might notice that this function sets the height of the decal component to be taller than you might expect. This is because Unreal Engine decals start fading out in X before the decal actually ends, so we need to scale them up a little bit more to compensate.

If I could disable this feature, I would!

Settings

Float Curves

NameDescription
Curve_BlobShadowDensity_FloatDefines the density (softness) of the Blob Shadow based on distance from the ground
Curve_DropShadowBlur_FloatDefines the blurriness of the Drop Shadow based on distance from the ground

Other Useful Settings

NameDescription
bUseRenderTextureEnables the Drop Shadow effect (otherwise it will default to Blob Shadows)
RenderTextureResolutionThe resolution of the render texture (Drop Shadow only)
bDebugModeEnables debug visualization of the traces
OpacityThe maximum opacity of the shadow
ScaleThe horizontal scale of the decal component
OpacityMinimumDistanceThe distance at which we start lerping opacity
OpacityMaximumDistanceThe distance at which we stop lerping opacity
BlurAndDensityMinimumDistanceThe distance at which we start lerping blur/density values
BlurAndDensityMaximumDistanceThe distance at which we stop lerping blur/density values
FadeSpeedHow fast we interpolate the current distance value
NumberOfTracesHow many traces we use to calculate closest/furthest distance
TraceLengthThe length of the drop shadow traces

Frequently Asked Questions

Does this asset use lights to achieve the effect?

Nope! The effect is entirely material-driven, using a Decal to project a fake shadow onto the ground underneath your character.

Will this work in Unreal Engine 5?

Absolutely! You may need to change both decal material’s Blend Mode from AlphaComposite to Transparent for the Decal’s roughness value to not look strange.

Apart from that the system works as intended in Unreal Engine 5.

Does this asset have mobile support?

Yes and no. To get the effect working for mobile you’ll need to make a few changes:

Enable Mobile HDR in your project settings.
Change the decal material’s Decal Blend Mode from AlphaComposite to DBufferTranslucentColor.
Remove the Mask perpendicular surfaces part of the material as the DBuffer doesn’t support it.
Unfortunately I’ve not found a way to reproduce this feature while using DBuffer blend modes.
The result of these changes will make the effect work on mobile, but perpendicular pixels will not be culled so the shadow will still draw on vertical surfaces.