bevy/crates/bevy_pbr/src
Eero Lehtinen 2811a034b8 Fix point light shadow glitches (#19265)
# Objective

Fixes #18945

## Solution

Entities that are not visible in any view (camera or light), get their
render meshes removed. When they become visible somewhere again, the
meshes get recreated and assigned possibly different ids.

Point/spot light visible entities weren't cleared when the lights
themseves went out of view, which caused them to try to queue these fake
visible entities for rendering every frame. The shadow phase cache
usually flushes non visible entites, but because of this bug it never
flushed them and continued to queue meshes with outdated ids.

The simple solution is to every frame clear all visible entities for all
point/spot lights that may or may not be visible. The visible entities
get repopulated directly afterwards. I also renamed the
`global_point_lights` to `global_visible_clusterable` to make it clear
that it includes only visible things.

## Testing

- Tested with the code from the issue.
2025-05-30 22:59:10 +02:00
..
atmosphere Web support for atmosphere (#18582) 2025-04-09 00:21:41 +02:00
cluster Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
decal Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
deferred Add required shader defs for environment map binding arrays in deferred (#18634) 2025-03-31 22:33:27 +02:00
light Fix newline in PointLightShadowMap comment (#18791) 2025-04-10 22:29:10 +02:00
light_probe Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
lightmap Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
meshlet Fix the ordering of the systems introduced in #18734. (#18825) 2025-04-14 23:43:09 +02:00
prepass Make sure the mesh actually exists before we try to specialize. (#18836) 2025-04-14 22:45:49 +02:00
render Fix point light shadow glitches (#19265) 2025-05-30 22:59:10 +02:00
ssao bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
ssr bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
volumetric_fog bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
components.rs reexport entity set collections in entity module (#18413) 2025-03-30 10:24:00 +02:00
extended_material.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
fog.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
lib.rs Fix the ordering of the systems introduced in #18734. (#18825) 2025-04-14 23:43:09 +02:00
material_bind_groups.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-14 22:45:27 +02:00
material.rs Swap order of eviction/extraction when extracting for specialization (#18846) 2025-04-15 09:10:28 +02:00
mesh_material.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
parallax.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
pbr_material.rs Make the StandardMaterial bindless index table have a fixed size regardless of the features that are enabled. (#18771) 2025-04-10 01:19:34 +02:00
wireframe.rs Make sure the mesh actually exists before we try to specialize. (#18836) 2025-04-14 22:45:49 +02:00