Skip to content

CanvasItem shader light functions receiving vec4(0.0) as LIGHT input #6726

Open
@conradhappeliv

Description

@conradhappeliv

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, I would expect to get the value of the light that would be otherwise applied to the texture.

image

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, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions