Open3D
Open3D copied to clipboard
Boolean result not accurate.
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
masterbranch).
Describe the issue
I ran a boolean difference on the dog model and a box, and in the result additional meshes are created. Expected output: clean cut (remaining just dog's head and feet) Actual output: big triangle at dog's head and a line at dog's feet

Steps to reproduce the bug
import open3d as o3d
import os, copy
# My local path
os.chdir('E:\\OneDrive\\Works_online\\STL')
target = o3d.io.read_triangle_mesh('3Dcube_dog5.stl')
target. Scale(0.5, center=target.get_center())
target2 = o3d.t.geometry.TriangleMesh.from_legacy(target)
box = o3d.geometry.TriangleMesh.create_box()
box. Scale(50, center=box.get_center())
box = copy.deepcopy(box).translate((0, 0, 0.01))
box2 = o3d.t.geometry.TriangleMesh.from_legacy(box)
ans = target2.boolean_difference(box2)
o3d.visualization.draw([{'name': 'difference', 'geometry': ans}])
Error message
No response
Expected behavior
Expected output: clean cut (remaining just dog's head and feet) Actual output: big triangle at dog's head and a line at dog's feet
Open3D, Python and System information
- Operating system: Windows 11 64-bit
- Python version: Python 3.10.10
- Open3D version: 0.16.0
- System architecture: x86 / intel i7
- Is this a remote workstation?: no
- How did you install Open3D?: pip
Additional information
I attach my 3d dog model. 3Dcube_dog5.zip
Hi, I would like to work on this bug. it would be great could you please assign this issue to me
@jhunjhunwala1234 please let me know how you want to approach this issue
I found my dog was not manifold. So I attach new one. However, when I apply the new file, the boolean result still results in lines that should not be there.
import open3d as o3d
import os, copy
#My local path
os.chdir('E:\\OneDrive\\Works_online\\STL')
target = o3d.io.read_triangle_mesh('3Dcube_dog11.stl')
target.scale(10, center=target.get_center())
target = o3d.t.geometry.TriangleMesh.from_legacy(target)
box = o3d.geometry.TriangleMesh.create_box()
box.scale(35, center=box.get_center())
box. Translate([0, 20, 0])
box = o3d.t.geometry.TriangleMesh.from_legacy(box)
ans = target.boolean_difference(box)
o3d.visualization.draw([{'name': 'difference', 'geometry': ans}])

Hi, I am seeing a similar issue on a Mac. In case it helps, here is the simple repro:
This code is from the o3d online docs for boolean_difference (I just added the line to compute normals): http://www.open3d.org/docs/release/python_api/open3d.t.geometry.TriangleMesh.html
box = o3d.geometry.TriangleMesh.create_box()
box = o3d.t.geometry.TriangleMesh.from_legacy(box)
sphere = o3d.geometry.TriangleMesh.create_sphere(0.8)
sphere = o3d.t.geometry.TriangleMesh.from_legacy(sphere)
ans = box.boolean_difference(sphere)
ans.compute_vertex_normals()
o3d.visualization.draw([{'name': 'difference', 'geometry': ans}])
The output looks ok, but is actually not watertight:
Changing the sphere's radius from 0.8 to 0.7 makes the problem more obvious:
box = o3d.geometry.TriangleMesh.create_box()
box = o3d.t.geometry.TriangleMesh.from_legacy(box)
sphere = o3d.geometry.TriangleMesh.create_sphere(0.7) # 0.8 -> 0.7
sphere = o3d.t.geometry.TriangleMesh.from_legacy(sphere)
ans = box.boolean_difference(sphere)
ans.compute_vertex_normals()
o3d.visualization.draw([{'name': 'difference', 'geometry': ans}])
I'm running this on
- Operating system: Mac OS Monterey 12.6
- Python version: Python 3.10.13
- Open3D version: 0.17.0
- System architecture: Apple M1 Max chip (ARM)
- Is this a remote workstation?: no
- How did you install Open3D?: pip3 install open3d
hi,
I have the same issues on WSL2 and observe that boolean_union gives incorrect results also. Here is a minimal example, taking the union of a box with a clone of itself:
box = o3d.geometry.TriangleMesh.create_box()
tbox = o3d.t.geometry.TriangleMesh.from_legacy(box)
union = tbox.boolean_union(tbox.clone())
The expected union result is another identical box, but instead it gives an empty mesh:
>>> print(union)
TriangleMesh on CPU:0 [0 vertices (Float32) and 0 triangles (Int64)].
Vertex Attributes: PointSource (dtype = Int32, shape = {0, 1}), Distance (dtype = Float64, shape = {0, 1}).
Triangle Attributes: FreeEdge (dtype = Int32, shape = {0, 1}), CellSource (dtype = Int32, shape = {0, 1}), Distance (dtype = Float64, shape = {0, 1}), BadTriangle (dtype = Int32, shape = {0, 1}).
System info:
- Operating system: Ubuntu on WSL2
- Python version: Python 3.10.12
- Open3D version: 0.18.0
- System architecture: x86/i9
- Is this a remote workstation?: no
- How did you install Open3D?: pip