Skip to content

LightOccluder2D editor preview is misleading as it darkens the sprite that acts as an occluder #102160

@cashew-olddew

Description

@cashew-olddew

Tested versions

  • Reproductible in: 4.3.stable

System information

Windows 10 - Godot 4.3.stable - Vulkan (Forward+)

Issue description

I was trying to cast a light on a Sprite2D that had a LightOccluder2D attached, without actually occluding the sprite itself. In the documentation it is specified that

LightOccluder2Ds follows the usual 2D drawing order. This is important for 2D lighting, as this is how you control whether the occluder should occlude the sprite itself or not.

This led me to believe that this functionality would work both in the editor and in game.
When trying this out, in editor I got:

Image

While testing the game I got:

Image

I managed to reach a solution by applying a clockwise cull mode, but that rids me of the flexibility that the occluder ordering relative to the sprite would have given me.

I had initially thought that this is a documentation issue, as I specified in the godot-docs repo, but @AThousandShips considered that this is likely an engine issue.

Steps to reproduce

  1. Create a Sprite2D.
  2. Click on the Sprite2D, create a LightOccluder2D sibling.
  3. Create a PointLight2D which can have a texture or a simple radial black and white GradientTexture2D
  4. In the scene tree, change the placement of the occluder to be above, below the sprite or a child that either has or doesn't have 'show behind parent' enabled.
  5. No matter which combination was selected, the sprite will always be occluded by the occluder.

Minimal reproduction project (MRP)

project.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions