godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Readd Mask mode to Light2D #11082

Open aledraken opened 1 week ago

aledraken commented 1 week ago

Describe the project you are working on

Just a proof of concept of a 2D Line of sight/Field of view like Darkwood/Zero Sievert/Among Us

Describe the problem or limitation you are having in your project

It's impossible to get a field of view that works like a light with shadows, the closest I've got is with clip children + 3 subviewports but it's really heavy and complicated

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Either bring back the mask mode for lights or maybe make it like layer based expanding the canvasmaterial light only mode, to make it interact with other light but only be shown if lit by certain lights

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

For example set the player light to layer 2 and to always be visible and show everything it's lighting meanwhile set enemies/items and other light source to only be visible if they are lit by a light with layer 2, this way the sprites can interact with lights and also be hidden in the shadows.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This is my workaround but it can get really heavy and complicated line-of-sight-poc.zip

Is there a reason why this should be core and not an add-on in the asset library?

It was a feature in Godot 3 and is still really helpful for 2d games to represent the field of view

Calinou commented 1 week ago