bevy/crates/bevy_pbr/src
re0312 36c6f29832
Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073)
# Objective
- After #13894, I noticed the performance of `many_lights `dropped from
120+ to 60+. I reviewed the PR but couldn't identify any mistakes. After
profiling, I discovered that `Hashmap::Clone `was very slow when its not
empty, causing `extract_light` to increase from 3ms to 8ms.
- Lighting only checks visibility for 3D Meshes. We don't need to
maintain a TypeIdMap for this, as it not only impacts performance
negatively but also reduces ergonomics.

## Solution

- use VisibleMeshEntities for lighint visibility checking.


## Performance
cargo run --release --example many_lights  --features bevy/trace_tracy 
name="bevy_pbr::light::check_point_light_mesh_visibility"}

![image](https://github.com/bevyengine/bevy/assets/45868716/8bad061a-f936-45a0-9bb9-4fbdaceec08b)

system{name="bevy_pbr::render::light::extract_lights"}

![image](https://github.com/bevyengine/bevy/assets/45868716/ca75b46c-b4ad-45d3-8c8d-66442447b753)


## Migration Guide

> now `SpotLightBundle` , `CascadesVisibleEntities `and
`CubemapVisibleEntities `use VisibleMeshEntities instead of
`VisibleEntities`

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-07-14 17:00:54 +00:00
..
cluster Rename "point light" to "clusterable object" in cluster contexts. (#13654) 2024-06-04 11:01:13 +00:00
deferred Revert "Make FOG_ENABLED a shader_def instead of material flag (#13783)" (#13803) 2024-06-10 23:25:16 +00:00
light Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073) 2024-07-14 17:00:54 +00:00
light_probe Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
lightmap Generate MeshUniforms on the GPU via compute shader where available. (#12773) 2024-04-10 05:33:32 +00:00
meshlet Optimize common usages of AssetReader (#14082) 2024-07-01 19:59:42 +00:00
prepass Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 16:13:03 +00:00
render Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073) 2024-07-14 17:00:54 +00:00
ssao Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
ssr Implement opt-in sharp screen-space reflections for the deferred renderer, with improved raymarching code. (#13418) 2024-05-27 13:43:40 +00:00
volumetric_fog Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bundle.rs Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073) 2024-07-14 17:00:54 +00:00
extended_material.rs impl Debug for ExtendedMaterial (#14140) 2024-07-04 23:59:48 +00:00
fog.rs Fix lints introduced in Rust beta 1.80 (#13899) 2024-06-17 17:22:01 +00:00
lib.rs Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
material.rs Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 16:13:03 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
wireframe.rs Use WireframeColor to override global color (#13034) 2024-04-20 13:59:12 +00:00