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.
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.
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.
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 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!
|Curve_BlobShadowDensity_Float||Defines the density (softness) of the Blob Shadow based on distance from the ground|
|Curve_DropShadowBlur_Float||Defines the blurriness of the Drop Shadow based on distance from the ground|
Other Useful Settings
|bUseRenderTexture||Enables the Drop Shadow effect (otherwise it will default to Blob Shadows)|
|RenderTextureResolution||The resolution of the render texture (Drop Shadow only)|
|bDebugMode||Enables debug visualization of the traces|
|Opacity||The maximum opacity of the shadow|
|Scale||The horizontal scale of the decal component|
|OpacityMinimumDistance||The distance at which we start lerping opacity|
|OpacityMaximumDistance||The distance at which we stop lerping opacity|
|BlurAndDensityMinimumDistance||The distance at which we start lerping blur/density values|
|BlurAndDensityMaximumDistance||The distance at which we stop lerping blur/density values|
|FadeSpeed||How fast we interpolate the current distance value|
|NumberOfTraces||How many traces we use to calculate closest/furthest distance|
|TraceLength||The 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:
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:
Click any of the images to see a higher resolution version.
*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++. If you’re looking at expanding this functionality further, I recommend making a component that can can be added to both.