Solari: Prevent world cache cells from keeping each other alive infinitely#21904
Solari: Prevent world cache cells from keeping each other alive infinitely#21904alice-i-cecile merged 18 commits intobevyengine:mainfrom
Conversation
|
Side note, we need to figure out why the bounce lighting isn't super visible in this test scene. Maybe @DGriffin91 knows? |
|
Unfortunately this is a bit more expensive, likely because of the extra atomics. I'll have to test if copying the lifetime before the cell update to avoid the atomicLoad() improves things. |
With default exposure. |
|
Unless we can find actual visual issues with using a store instead of a max, the store is probably acceptable. It just means we will be a bit more aggressive at clearing than is really necessary. |
|
atomicMax vs atomicStore doesn't seem to matter. I'm guessing the new atomicLoad is the problem, which is easy enough to fix. |
Which version of the scene is this? By default all the materials are 100% metallic. Side note: I'm not able to open the scene in bevy 0.17: #21490 |
|
Figured out the performance changes, it's just from adjusting the maximum allowed cell lifetime. Not a big deal. |
@SparkyPotato's on github. Your's wasn't updated at the time I set this up. |
…itely (bevyengine#21904) # Objective - Prevent world cache cells from querying each other and keeping each other alive infinitely - Now when you leave an area of your game, you're no longer paying performance cost for the out-of-view cells. - Also fix a long-standing off-by-1 bug in the world cache compaction code ## Solution - Instead of always resetting cell lifetimes to the max lifetime during a cell query, for world cache update, we now set it to the max of the current cell lifetime and it's existing lifetime (max prevents a lower-lifetime cell overwriting a higher-lifetime cell). - Credit to IsaacSM and @NthTensor for the idea! ## Testing Video showing the current number of live world cache cells, before and after this PR. https://github.com/user-attachments/assets/7639c62c-9bdb-41d7-aebb-b2494c03c042 --------- Co-authored-by: Alice Cecile <[email protected]>
Objective
Solution
Testing
Video showing the current number of live world cache cells, before and after this PR.
Screen.Recording.2025-11-21.111911.mp4