Download

Side Scroller - Fading sharp shadows

Hello guys,

I already spent a couple of hours but I couldn’t find a solution for my problem.

The project I’m working at is a simple side scrolling game like Super Mario and here I’m struggling with the shadows.

I really like the sharp shadows the directional light is casting in the following scene:

I want exactly these sharp shadows but they should simply fade out with the increasing distances from the platform meshes to the floor meshes.

With photoshop I tried to recreate the scenery roughly to what I want the result look like:

This is what I mean about fading shadows with increasing mesh distances. If there would be a next higher platform there should be no shadow anymore.

It’s a simple problem but with all the lighting options in Unreal Engine I couldn’t find a proper solution.

Do you have some ideas? Thanks alot!

A: I have no idea why you would want this, instead use skylight shadows to soften as it goes further up, looks a lot better
B: This is literally impossible without hacking around it or using engine mods to an insane level.

My guess, if you want exactly this behaviour, then you probably would have to place those shadows as decals, whose opacity/transpacency is linked to the distance of it´s solid platform. So the platforms would not cast real shadows, instead you create a decal, that looks like your shadow and smack those on the ground. Might be the cheapest way.

Of course, i have no idea, how you would handle it in a case of overlapping platforms, where one half of the shadow hits another platform, right below the main platform, and the other half hits the ground waaaay further down. Could be bypassed, if your level design don´t allow such an overlapping, or if the general height distance between stacked platforms is so big, that the shadow would be completely invisible for lower platforms/ground.

@Bits360: Maybe my technical approach is wrong but if I understand you correctly, I could achieve a similar result by using the skylight to soften the shadows from the platforms that are further up. Unfortunately I didn’t find an option in the details panel of the skylight. Could you help me with that? Thanks!

@Suthriel: This solution could actually work but it is an implementation of a new custom shadow system. I would prefer a proper solution with the already existing shadow and light system. But maybe this could be the last resort. Thanks anyway for your idea!

No, im saying skylights that are baked to static/stationary or use DFAO naturally cast soft, ambient shadows, which you may prefer.
Also not a single engine that i know of has, currently does, or ever will support shadows getting lighter based on height, as its a very project specific stylisation choice and would be likely quite expensive (Rendering shadows with and without platform, and getting the distance between them) unless you hack it in.

Thanks for your explanation. In a more realistic setting I prefer naturally cast soft shadows and in a more cartoon setting I prefer clear shadows with sharp edges. Now that I know my options, I still have to decide what’s best for my project.