bevy/crates/bevy_pbr/src/render
Robert Swain c2a9d5843d Faster assign lights to clusters (#4345)
# Objective

- Fixes #4234
- Fixes #4473 
- Built on top of #3989
- Improve performance of `assign_lights_to_clusters`

## Solution

- Remove the OBB-based cluster light assignment algorithm and calculation of view space AABBs
- Implement the 'iterative sphere refinement' algorithm used in Just Cause 3 by Emil Persson as documented in the Siggraph 2015 Practical Clustered Shading talk by Persson, on pages 42-44 http://newq.net/dl/pub/s2015_practical.pdf
- Adapt to also support orthographic projections
- Add `many_lights -- orthographic` for testing many lights using an orthographic projection

## Results

- `assign_lights_to_clusters` in `many_lights` before this PR on an M1 Max over 1500 frames had a median execution time of 1.71ms. With this PR it is 1.51ms, a reduction of 0.2ms or 11.7% for this system.

---

## Changelog

- Changed: Improved cluster light assignment performance

Co-authored-by: robtfm <50659922+robtfm@users.noreply.github.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-04-15 02:53:20 +00:00
..
depth.wgsl Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
light.rs increase the maximum number of point lights with shadows to the max supported by the device (#4435) 2022-04-07 21:55:31 +00:00
mesh.rs Skinned extraction speedup (#4428) 2022-04-07 16:16:36 +00:00
mesh.wgsl Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
mesh_struct.wgsl Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
mesh_view_bind_group.wgsl Use storage buffers for clustered forward point lights (#3989) 2022-04-07 16:16:35 +00:00
mod.rs Materials and MaterialPlugin (#3428) 2021-12-25 21:45:43 +00:00
pbr.wgsl Faster assign lights to clusters (#4345) 2022-04-15 02:53:20 +00:00
skinning.wgsl Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
wireframe.wgsl Fix animation: shadow and wireframe support (#4367) 2022-03-30 19:56:16 +00:00