Skip to content

OpenGL: SpotLight3D shadows occasionally use the wrong texture after moving the camera away from them #92091

@Calinou

Description

@Calinou

Tested versions

System information

Godot v4.3.dev (5708a3a) - Fedora Linux 39 (KDE Plasma) - Wayland - GLES3 (Compatibility) - NVIDIA GeForce RTX 4090 (nvidia; 545.29.06) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)

Issue description

When using the Compatibility rendering method, SpotLight3D shadows will occasionally start using the wrong texture after moving the camera away from them. This can be seen in the editor:

compatibility_shadow_error.mp4

Once the SpotLight3D starts using the wrong texture, this is permanent: reloading the saved scene or toggling shadows on the SpotLight3D won't fix the issue.

It seems the SpotLight3D uses the directional shadow map instead of the positional shadow atlas. This is made evident by the fact that once you enter this glitched state, hiding the DirectionalLight3D will also hide the SpotLight3D:

Working Broken
compatibility_shadow_error_working webp compatibility_shadow_error_broken webp

(The SpotLight3D node has visible = true on both screenshots here.)

No errors are visible in the output log. I haven't managed to reproduce this issue on Forward+ or Mobile, so I assume this is Compatibility-specific.

Steps to reproduce

  • Create a 3D scene with a DirectionalLight3D that has shadows enabled and a SpotLight3D that has shadows enabled.
    • An OmniLight3D with shadows enabled may be necessary to reproduce the issue as well, but it might not actually be required.

Minimal reproduction project (MRP)

truck_town_compatibility_shadow_error.zip

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