Stack/04 culling#371
Conversation
1189242 to
175c6f5
Compare
Switches NPC culling to distance bands with hysteresis, tracks visible NPCs in a HashSet, and progresses routine waypoints even while meshes are unloaded.
Replaces the three near-identical wrapper handlers with a single closure loop capturing each bucket.
feeec7c to
bf57d2f
Compare
| /// Band 1 - [cullingDistance...*1.15) - Hysteresis zone: VOB keeps its current state to avoid border flickering. | ||
| /// Band 2 - [cullingDistance*1.15...inf) - VOB is disabled. | ||
| /// | ||
| /// We deliberately ignore evt.isVisible: Frustum culling of Renderers is done by Unity/URP itself. |
There was a problem hiding this comment.
I don't know if that is correct. We need to check in Scene View when game is running. Turning around and see, if a Vob is getting invisible or stays. Because Frustum should be handled for static objects. But how about Items?
There was a problem hiding this comment.
I tested it. Works as expected. Thanks a lot. Less checks per frame are always appreciated. :-)
There was a problem hiding this comment.
No more custom frustum, everything that is in range is left active but culled by unity itself. in scene view we can still see the vobs, but that's because the scene view is another camera.
But perhaps there is a case for truly static vobs (not interactable/movable/items) to be culled by custom frustum.
JaXt0r
left a comment
There was a problem hiding this comment.
Works like a charm. Performance improvements like this are always appreciated. 🙇
Summary
Reworks distance culling to be band-based with hysteresis and lets NPC routines progress while meshes are unloaded.
Changes
AbstractCullingDomain/AbstractCullingService.HashSet; routine waypoints advance even while the mesh is culled, so NPCs are in the right place when they re-appear.List+ToArray()replaced by a reusable doubling array (no per-update allocation).How to test