2D Shadows and YSort

Godot Version

4.4.1

Question

Hi all,

Very new with Godot. I’m working on a 2.5D game, have Y sort working for various item in the map and the player. I’m now playing around with the lighting. I have added a CanvasModulate to the main scene to darken everything. Then I have added a PointLight2D to my player scene and set that up to work. I then tried messing around with the shadows and have hit a wall. I have a LightOccluder2D on the object scene.

What I’m trying to achieve:

  • shadow cast by Y sorted objects
  • objects lit based on Y sort
    • object shadow over object when player behind
    • object shadow below object when player in front

Further bugs I have is that the shadow always casts over things. Even with the closed setting on/off, Cull Mode in various settings. Best I can get is with the occluder cull mode set to CCW. But of course the object face stay lit the whole time. Furthermore, the shadows that do come off it overlap the player if they stand near the object casting the shadow