What's the difference between three-bvh-csg and .mergeGeometries

I tried uisng three-bvh-csg to combine two models but was running into edge cases for various models making it more complicated. What is the difference between adding in the three-bvh-csg library and merge geometry in threejs?

.mergeGeometry just takes both sets of vertices and naively puts them together into a single array buffer.

CSG add operation would usually attempt a bit smarter solution, where it looks at all triangles in the model and merges them in such a way that there’d be no triangle intersections in the resulting mesh. Plus the vertices that, after the merge, would be “inside” the geometry are usually also removed, resulting in a cleaner mesh overall.

2 Likes