godotengine / godotengine/godot-docs
CanvasItem shader light functions receiving vec4(0.0) as LIGHT input
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
### Godot version
4.0.beta9 (e780dc332) using any renderer
### System information
Windows 11
### Issue description
It seems like CanvasItem shaders are always receiving `vec4(0.0)` as their `LIGHT` input. Based on the [docs](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/canvas_item_shader.html#light-built-ins), I would expect to get the value of the light that would be otherwise applied to the texture.

### Steps to reproduce
- Create a Sprite2D that is affected by a Light2D (point or directional)
- Attach a ShaderMaterial with a canvas_item shader to the Sprite2D.
- Try writing a `light()` function:
- If you don't set `LIGHT`, no lights are applied to the sprite at all (according to the [docs](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/canvas_item_shader.html#light-built-ins), not setting `LIGHT` should cause the function to be a no-op)
- If you set `LIGHT = LIGHT;`, no lights are applied (I would expect this to be a no-op)
Some extra info:
* the light's blend mode has no effect (same result with add/mix/sub)
* Setting a `LIGHT` value (e.g. `LIGHT = COLOR;`) seems to work fine
* I didn't expect this have any effect, but adding a `BackBufferCopy` node before the sprite didn't change anything
### Minimal reproduction project
[lightshaders.zip](https://github.com/godotengine/godot/files/10329517/lightshaders.zip)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.