InstancedMesh frustum culling with transformed instances — bounding sphere configuration
0 reputation · 06 Nov 2022, 18:44 UTC
0 reputation · 06 Nov 2022, 18:44 UTC
Three.js InstancedMesh uses a single boundingSphere computed from the base geometry at construction time. This sphere drives frustum culling for the entire batch, but it is not automatically updated when instance matrices change via setMatrixAt or direct instanceMatrix manipulation.
Achieve correct frustum culling for a large dataset (10,000+ instances) where instances are repositioned each frame — for example, a particle system or crowd simulation — without incurring the cost of recomputing a tight world-space sphere every frame.
The default computeBoundingSphere() only re-evaluates the base geometry, ignoring transformed instance positions. Assigning a custom boundingSphere is permitted but unvalidated; an overly conservative sphere wastes GPU work, while an undersized sphere causes visual popping. No built-in API exists to derive a tight sphere from all instance matrices, and userland iteration over the instanceMatrix buffer each frame is expensive at scale.
boundingSphere that balances culling accuracy against per-frame computation cost?InstancedMesh without replacing the entire frustum test?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.