godotengine / godotengine/godot
light_only in canvas_item doesn't take LIGHT_COLOR in to consideration
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
4.3 stable
### System information
Godot v4.3.stable - macOS 15.0.1 - Vulkan (Mobile) - integrated Apple M2 Max - Apple M2 Max (12 Threads)
### Issue description
https://github.com/user-attachments/assets/51c0f1fd-3d50-4120-a3b4-305dfe6ec401
The light_only render mode only hides the sprite outside the PointLight2D area. It does not hide it inside the node where no light shines, which is what I would expect. See video attachement
If I misunderstand the render mode then please let me know and I'll close this ticket.
```
shader_type canvas_item;
render_mode light_only;
```
With the light function it's not possible to discard the sprites RGB colors based on LIGHT_COLOR, because we cannot write to the COLOR variable in the light function. And I would expect the render pipeline deal with that.
### Steps to reproduce
1. setup a PointLight2D with a light texture that does not completely cover the 2D node
2. move a sprite with a CanvasMaterial => light only or a shader with render mode light_only over the PointLight2D
### Minimal reproduction project (MRP)
It happens with a new project. You can use this texture as light source

Godot svg can be used as node which needs the light_only render mode or CanvasItemMaterial
Contributor guide
Research direction
Reproduce the issue with a PointLight2D, the supplied light texture, and a Sprite or CanvasItemMaterial using light_only; the shader entry points shown are canvas_item, render_mode light_only, and the light function using LIGHT_COLOR. Check how light_only behaves inside and outside the light area, then verify that the completed behavior matches the reported expectation for partially covered nodes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100