Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | umutseven92 |
Hello everyone, I am having an issue when trying to get 2D lights & shadows working. Would love to get some help about this, as I’m out of ideas. I have done a good amount of Googling, and this was asked multiple times both here and in the Godot forums, but there are no answers that help.
##Context
I have a Player node with a Sprite
and LightOccluder2D
. There is a Light2D
on the window.
The Problem
As you can see, the shadow goes over the Sprite.
What I’ve Tried So Far
- I’ve put the occluder inside the Sprite (as a child), and set
Show Behind Parent
as true. Did not do anything. - Set the z-index of the occluder to something lower. This only has an effect on the occluder shape in the editor, but not the shadow.
- I’ve changed the occluder polygon so that it is not closed, and set the
Cull Mode
toClockwise
:
That sorta helped, but it leaks light:
- I set the occluders
Light Mask
to 1, SpritesLight Mask
(underVisibility
) to 2, and set the LightsItem Cull Mask
(underRange
) to both 1 and 2 (setting it underShadow
just goes back to the original problem). This worked beautifully, however now the Player sprite is not affected at all by other shadows, it just stays lit, as you can see in this gif.
Would love to hear any ideas on to fix this. Thank you all for your help.