gkjohnson / three-bvh-csg

A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh
MIT License
602 stars 46 forks source link

Add a more robust "inside" detection method #74

Open gkjohnson opened 2 years ago

gkjohnson commented 2 years ago

Default three.js raycasting can "leak" rays at edges where triangles meet. In order to determine whether triangles should be included or excluded in the final result we use raycasting which means we can incorrectly mark triangles as inside / outside. The solution currently is to raycast multiple times per triangle to minimize the chance. More raycasting is more performance intensive and still not immune to problems. We can implement a more robust custom triangle intersection function using bvh.shapecast to address this.

Notes