godotengine / godotengine/godot

Shadow Caster Mask does not affect LightmapGI baking for lights with Static bake mode

Open
#98,684 0 comments 2 reactions 0 assignees View on GitHub
bug discussion topic:3d topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

- *Related to https://github.com/godotengine/godot/issues/56611.*

### Tested versions

- Reproducible in: 4.4.dev https://github.com/godotengine/godot/commit/7187c251da3fabbfe1dbc87d2c33692bb6d9823b

### System information

Godot v4.4.dev (7187c251d) - Fedora Linux 41 (KDE Plasma) on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (nvidia; 560.35.03) - 13th Gen Intel(R) Core(TM) i9-13900K (32 threads)

### Issue description

The [Light3D Shadow Caster Mask property](https://github.com/godotengine/godot/pull/85338) does not affect lights with Static bake mode when baking lightmaps.

Like https://github.com/godotengine/godot/issues/56611, this may be considered to be intended (as disabling shadow casting for certain objects may be done for performance reasons, which is a moot point for an offline baking process). However, this can be an issue if the shadow casting is disabled for aesthetic reasons or for accurate [shadowmask baking](https://github.com/godotengine/godot/pull/85653) (for DirectionalLight3D).

### Real-time light

![Real-time](https://github.com/user-attachments/assets/7e059272-2e4d-4b7b-b365-a873a0d4ee7c)

### Baked light with Static bake mode

*Notice how some objects that previously didn't cast shadows now cast shadows.*

![Baked](https://github.com/user-attachments/assets/39db3efd-b749-4ccd-b2c9-58ca64bf32ba)

### Steps to reproduce

- Create meshes, some on visual layer 1, some on visual layer 2.
- Create lights with shadows enabled. Set their shadow caster mask to affect only layer 1.
- Set lights to **Static** bake mode. Before baking, notice that certain objects don't cast shadows (which is expected).
- Bake lightmaps. Notice how all objects cast shadows now.

### Minimal reproduction project (MRP)

[test_shadow_caster_mask_lightmap.zip](https://github.com/user-attachments/files/17580783/test_shadow_caster_mask_lightmap.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.