Sprite2D turns dark from its own shadow

Godot Version

4.2.1 stable

Question

There is a Sprite2D in my game that has a LightOccluder2D child. There is also a Directional Light 2D on the stage, which has shadows enabled, however, I ran into a problem. The shadow that falls from LightOccluder2D obscures Sprite2D. How can I fix this?

You can set the Material of the sprite to a canvasitemmaterial and then set the lightmode, but this will affect all lightsources interaction with this sprite.
Or change the light-layer

Solution with light layer is more better for me. I have already tried to change them, but I did not succeed. How do I change them correctly?

CanvasItem β†’ LightMask, but im not sure this has the effect you want it to have

Set your lightsource to layer 1 + 2 and your sprite to 2 and your shadow to 1

I changed Sprite2D Light Mask to 2, Light occluder to 1,directional light to 1 and 2 but nothing changed.

Yeah i think this will only work with the canvasitemmaterial.
Maybe this tutorial can help:

1 Like

Everything works. Thanks a lot

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.