godotengine / godotengine/godot

Light2Ds do not affect CanvasItems that are inside their same CanvasLayer

Open
#96,271 1 comment 0 reactions 0 assignees View on GitHub
bug topic:2d topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in 4.3
- Reproducible in 4.2.2

### System information

Windows 10

### Issue description

There's a possibility this is a misunderstanding, an intentional limitation, but I'm doubtful. There's no mention of this in the documentation.

This is reproducible on **all** rendering methods.

In short, 2D lights do not work **at all** on **CanvasItem**s that are children of a **CanvasLayer** node, even though the lights are inside the same **CanvasLayer**:

-------

It also means that CanvasItemMaterial's `light_mode` is entirely useless outside in these cases:

-------

Very importantly, note that **Light2D**s inside a **CanvasLayer** **DO** work:

### Steps to reproduce

Multiple ways, but the simplest is to create a **CanvasLayer** and insert a **Sprite2D** and a **PointLight2D** as children. Make sure to include textures for both.

### Minimal reproduction project (MRP)

[mrp-canvaslayer-light2d-do-not-work.zip](https://github.com/user-attachments/files/16796973/mrp-canvaslayer-light2d-do-not-work.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the attached minimal reproduction project and verify the behavior with a CanvasLayer containing a Sprite2D and PointLight2D, across the rendering methods mentioned. Trace the CanvasLayer, CanvasItem, and Light2D rendering path to determine whether this is an implementation bug or an intentional limitation. Done means the reported lighting behavior is corrected, or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.