Is three-mesh-bvh better performing than the built-in Octree.js class in three.js?

I’m creating a multiplayer online environment that needs collision detection similar to this website: https://summer-afternoon.vlucendo.com/.

Is three-mesh-bvh better performing than the built-in Octree.js class in three.js?

2 Likes

Yes, definitely-most-likely-for-99%-of-cases - Octree is quite a basic implementation to be used as an example. Three-mesh-bvh is a giant magic ray-intersection machine.

(Maybe for super small hierarchies Octree can be a little faster, due just to it’s simplicity - BVH is way more complex.)

Similarly to Octree examples in three repo - BVH also has both environment movement (code) and physics (code) examples.

4 Likes

Apart from what @mjurczyk already said, keep in mind that a BVH is an object partitioning system, while an Octree is a spatial partitioning system. That means that for the former you would have to merge all your objects into a single large environment model, and for the latter you need to keep them separate. So remember that when doing your tests / comparissons.

3 Likes