Redot-Engine / redot-proposals

Redot Improvement Proposals
MIT License
33 stars 8 forks source link

Add a free-form Light2D node #45

Open CEHAGA9 opened 1 month ago

CEHAGA9 commented 1 month ago

Describe the project you are working on

Currently, I am working on a Celeste-style 2D game set in caves and forests using Godot 4.3, and one of the key visual elements involves complex lighting setups to create immersive environments.

Describe the problem or limitation you are having in your project

In the current state of Godot's 2D lighting system, the available light nodes (such as Light2D) offer limited options for manipulating light shapes. Light is mostly constrained to simple forms like circles or textures, and while masks can be applied, they lack the intuitive flexibility needed for more complex lighting effects. Without a tool similar to Unity's Free Form Light, creating intricate or irregular lighting sources (such as simulating light coming through uneven surfaces, or creating lights that match specific object contours) becomes time-consuming and cumbersome.

This limitation makes it difficult to achieve certain dynamic visual effects, especially in environments where irregular lighting is key to the scene. For example:

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

I propose the addition of a Free Form Light 2D node, inspired by the implementation in Unity. This node would allow developers to:

This node would significantly streamline the process of creating unique light effects in 2D games, reducing the reliance on workarounds and manual manipulation of light textures or shaders.

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

The Free Form Light 2D node could function similarly to Unity's equivalent by providing control points that the user can place and move around, forming a custom light shape. Here’s a general workflow and feature set:

Example control interface:

Example Use Case

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

Currently, this feature cannot be easily worked around with scripts. Achieving similar results would require extensive use of shaders, manually shaped light textures, or custom systems that lack the flexibility or ease of use that a dedicated Free Form Light 2D node could offer.

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

Lighting is a fundamental aspect of visual design in 2D games, and having an intuitive, flexible lighting tool like Free Form Light 2D would benefit a wide range of users and projects. Since other light types are already integrated into the engine, this enhancement would fit naturally into Godot's core feature set, providing a more complete and robust 2D lighting system.

Spartan322 commented 1 month ago

Related godot proposal: godotengine/godot-proposals#11005

Spartan322 commented 1 month ago

Just to be clear this refers to https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/LightTypes.html correct?