Problems when using multiple Light2Ds in Mask mode

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PugMasterPug

I have noticed that there is a problem when using multiple Light2Ds all set to Mask mode, if there is only one it works properly, but if there are two or more only one will work (slightly, without giving the result it’s supposed to), which seems to be the last one added to the scene, and I have also noticed that if all lights are turned invisible (pressing the eye icon at the side of the node) except for one, the one that is still visible will work properly. Also, if the most recently added Light2D is turned invisible, then the second most recently added light will carry the effect it had, and so on if that one gets turned invisible.

How can I fix this? It is essential to the project I’m working on and I can’t figure out how to fix it.

Any help is appreciated.

:bust_in_silhouette: Reply From: eons

Is an old bug Multiple Light2D Masks on the Same Sprite Behave Badly · Issue #7485 · godotengine/godot · GitHub

Workaounds can be easy or hard depending on the game and effect you want to achieve.

You can try modifying the image used on the texture with data from the screen, or try with a ViewportTexture and a special viewport with the masks.

Or ditch the lights and use sprites with different blend modes.