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.

Important!
This documentation has recently been updated for Drop Shadow 2.0 which is currently under review by the Epic Marketplace. It should be live within a few days, but until then this information may differ a little from the current version. Thank you for your patience!

BP_DropShadowComponent

All of the logic for the Drop Shadow effect is stored within BP_DropShadowComponent. This Actor Component will automatically create the rest of the required Components at runtime as part of its initialization process.

Functions

Initialize

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 bUseRenderTexture is true it’ll also add a Scene Capture Component.

DrawTraces

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 circle of traces is to make sure that if the character standing on the edge of an object, we draw the shadow on all applicable surfaces and not just the closest one.

Update

Update is meant to be fired regularly to (unsuprisingly!) update the effect. It uses the DrawTraces function to set the scale and position of the decal component as well as set the Decal’s material parameters based on the Owning Actor’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

General

NameDescription
bDebugModeEnables debug visualization of the traces
bAlwaysUpdateForce the effect to update every frame
OpacityThe maximum opacity of the shadow
DecalSizeThe 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
TraceCountHow many traces we use to calculate closest/furthest distance
TraceLengthThe length of the drop shadow traces

Render Texture

NameDescription
bUseRenderTextureEnables the Drop Shadow effect (otherwise it will default to Blob Shadows)
RenderTextureResolutionThe resolution of the render texture (Drop Shadow only)
SceneCaptureHeightThe height of the Scene Capture Component (make sure this is above your Actor!)
SceneCaptureOrthoWidthThe orthographic width of the Scene Capture Component
BlurCurveDefines the blurriness of the Drop Shadow based on distance from the ground

Blob

NameDescription
DensityCurveDefines the density (softness) of the Blob Shadow based on distance from the ground

Frequently Asked Questions

Does this asset use lights to achieve the effect?

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

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.

Is this project compatible with Lyra?

Yes, although I can’t guarantee it will work in every scenario. Lyra is a huge project with a lot going on, and I’ve not spent as much time as I’d like playing around with it.

Here are the steps I went through to get it to work:

Migrate the Drop Shadow files into your Lyra project
Drag a DropShadowComponent into the B_Manny and/or B_Quinn Lyra blueprints*

*In Lyra a B_Manny or B_Quinn child actor is created whenever a player spawn into a game. This was the best place I could find for the Drop Shadow logic to live. Unfortunately you won’t have access to their base class unless you’re willing to dive into some C++.