Skip to content

Mobile/Compatibility: SpotLight and OmniLight cull masks don't cull moving meshes #82263

@LazyAlarm

Description

@LazyAlarm

Godot version

v4.1.1.stable.official[bd6af8e]

System information

Windows 10 - Godot 4.1.1 Stable - Mobile

Issue description

Both Omni lights and spotlights will light up a mesh that has been transformed, despite there being no overlapping layers. This does not appear to be a problem with the Forward+ Renderer nor with directional lights on the mobile renderer.

In this example I have two lights, one is set to affect all layers, the light is periodically toggled on and off,
another light is on all of the time, but it's cull mask is only set to affect layer 2, which neither of the Mesh Instances are on.
The expected behaviour is that when the first light is toggled, the cubes will no longer be visible,

Expected Behaviour

as works on the Forward+ renderer. However when using the mobile renderer, Meshes will reappear again if they are moved (via script) and will not disappear even if their movement is stopped.

Mobile Behaviour

I first noticed this behaviour when I was attempting to do an effect where all but one object would fade to black because it was the only mesh on a specific layer (which the spotlight cull was also set to) however other objects still appeared despite not being on that layer because they had been or were being moved.

Steps to reproduce

Start a project with the mobile renderer

Create a 3D scene with a mesh that can be moved.
image
image
image

Create a spot light or omni light near the mesh so that it is noticeably lit.
image

Set the Cull Mask of the light to only affect layers that do not overlap with the cube's VisualInstance3D layers
image

The cube will correctly not be lit by the spotlight upon first playing, but once the cube has been moved, it will suddenly be lit up.
GIF 2023-09-24 1-28-41 PM

Minimal reproduction project

Light Cull Mask Mini Project.zip

Production edit (keywords for easier searching): OpenGL

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions