Shadow only for the player in Godot 3

Godot Version

v3.5.3.stable.official [6c814135b]

Question

Hello! I’m developing this game, a top-down 3D platformer, and the light/shadows on the levels are positioned in a 45º angle. It’s ok in a graphics perspective, but in a gameplay perspective sometimes is hard to land a precise jump due to no indication where to land.

My goal was to make a shadow casted downwards only for the player, like this:

(I know that probably PSX did not rendered real time shadows, but that’s a good example).

Is it possible to do that in Godot 3 using real time shadows (using render layers or some shader technique)? Or the only solution would be a physical Sprite3D simulating the shadow with a RayCast?

Thanks! :hugs:

Unfortunately, it seems you can’t enable shadows in more than one light in Godot 3, it breaks all shadows, probably that was noticed by others as well.

I managed to get the result I wanted by using an SpotLight with negative enabled, then I can have player ‘shadows’ even if he disables the shadows on the options menu, the best of both worlds.

image

1 Like

By using the negative light solution I stumbled into another problem… The light passes through the meshes, looking pretty bad, specially when on a moving platform. I can set the culling layers for the light to not affect the character, but in the ground it’s inevitable. This happens even in Godot 4 (Forward+ renderer), in which I though would work as expected. Any ideas if I’m doing something wrong?

In Godot 3:

In Godot 4: