Sorting 2D shadows

Godot Version

4.6

Question

I'm trying to implement drop shadows in 2d such that:

  • Overlapping shadows don’t increase in darkness
  • The shadows are y-sorted with objects so they cast on any objects under the shadow

I’m using CanvasGroup with self-modulate for the first goal. I tried enabling y-sort on CanvasGroup for the second goal, but this results in self-modulate not working (Self modulate doesnt works on canvas group with enabled y sort · Issue #97682 · godotengine/godot · GitHub).

Do it in 3D.