Render shadow without casting light on the environment?

I’m working on a top-down ARPG and I have the floating point environment light and the 4 point lights for character illumination, but I need the character to cast a shadow without affecting the environment. Can’t seam to accomplish this. Environment is on channel 0 and character is on channel 1. Even if character lightning has cast shadows enabled it won’t cast the shadow to the environment without also rendering on channel 0, but then that illuminates the environment.

Any ideas on how to have dynamic character shadow that won’t light up the environment?

Hey there @Krileon! That’s a tough question, because shadows conceptually don’t exist without light, so when the lighting was programmed, shadows are actually a byproduct of them and aren’t really able to be separated in the traditional sense. In essence a surface needs to accept the light the shadow casts from to be able to receive the shadow. What’s the full use case? As it may be better to fake the shadow with a material or something similar.

Basically use case as like any top-down ARPG. Diablo, Path of Exile, etc… I can make the overhead light cast shadows and that does work, but then the shadow is basically nearly a blob shadow. To fix that I’d have to move the light then you get a Diablo 4 look where the light is out in front of the player and just looks goofy.

Do you have a recommendation on how to fake it with a material? I’d need it to match the player movement, weapons, etc…

Ahhh, so I decided to take a look at PoE for example to see what they are doing and it looks like they use a directional light for most overworld scenes and ignore other sources.
chrome_2023-05-08_04-05-22

I believe Diablo 3 does relatively the same in that sense albeit less clearly, though it seems most light is still handled by global illumination of some sort, though I’m no expert there.

This would be possible with a good skylight setup and a directional light for the most part with some tweaking. Following how bad did the lighting look trying to mimic this? I might be able to guide you on tweaking it if you’d like to try.

That said for custom materials that gets a bit harder. Faking shadows can be done but it’s not as cheap as just using them. I’ve seen 2 methods that are rather overkill. I could only really explain the full use of one of them.

One used a scene capture at an angle preset in the character, took the alpha layer of that and used it as a base color + alpha for a plan around the player’s feet, and then applied it there. (They only did this because they’d swap the shadow peter pan style for mechanics).

The other method involved a custom shadowmapper of sorts but it was complex and tech art is not my strong suit.

skylight and directional light only work for outdoor scenes. My entire game is “indoors” in a dungeon. So I can’t use those as it’d light up parts of the map outside of the dungeon and the top of my walls. Below is an example.

My light source for the dungeon is done and floats above the player fine, but I need to be able to cast shadows that aren’t basically blobs without moving that light source. Example of what that looks like below.

image

This is due to the light source being above the player. Now if I move it forward it obviously looks correct, but then the light looks obviously in front of the player and just feels strange. Below is what it looks like if the light is infront of the player, which makes good looking shadows but it’s obvious when moving/turning that the light is infront of the player (this is exactly how Diablo 4 does it though), but this causes the light to go through the wall (guess I’d need a spring arm with collision to fix that?).

I guess I might end up having to just settle for either the blob like shadows or moving the light forward. I can’t really see any other workaround here.

A spring arm with a probe isn’t such a bad idea, but alternatively you could just have the walls on a different lighting channel and just handle your forward camera as you said. Though you may have to play with reducing forward light power when close to other light sources if you want to then use the shadows from them as primary, or if you were to leave them on it’d need some serious tweaking.

I’m not too sure if there’s a better way in cases where you want full fidelity shadows without splitting/blobbing.

At the moment I’m just going to go with the overhead lighting which does create a more blob like shadow under the player, but doesn’t look as goofy as the light moving around in front of the player.

1 Like