Skip to content

Commit

Permalink
Faster assign lights to clusters (bevyengine#4345)
Browse files Browse the repository at this point in the history
# Objective

- Fixes bevyengine#4234
- Fixes bevyengine#4473 
- Built on top of bevyengine#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>
  • Loading branch information
3 people authored and ItsDoot committed Feb 1, 2023
1 parent 4eff1da commit 8dd1c5a
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 151 deletions.
Loading

0 comments on commit 8dd1c5a

Please sign in to comment.