Skip to content

o3d.geometry.VoxelGrid.create_from_triangle_mesh_within_bounds Segmentation fault (core dumped) #7338

@worfsmile

Description

@worfsmile

Checklist

My Question

Describe the bug
When calling o3d.geometry.VoxelGrid.create_from_triangle_mesh_within_bounds on Ubuntu 22.04 with Python 3.10 and Open3D 0.17, even a simple example mesh (e.g., KnotMesh.ply, 1440 vertices / 2880 triangles) causes a Segmentation fault (core dumped).

The same code works fine on Windows with the same Open3D version.


To Reproduce
Run the following code:

import sys
import platform
import os
import open3d as o3d
import numpy as np

# Environment info
print("Python version:", sys.version)
print("Platform:", platform.platform())
print("OS name:", os.name)
print("Open3D version:", o3d.__version__)
print("Numpy version:", np.__version__)

# Load example mesh
mesh = o3d.io.read_triangle_mesh(o3d.data.KnotMesh().path)

# Preprocess mesh
mesh.remove_duplicated_vertices()
mesh.remove_degenerate_triangles()
mesh.remove_non_manifold_edges()
mesh.remove_duplicated_triangles()

print(f"Mesh has {len(mesh.vertices)} vertices and {len(mesh.triangles)} triangles.")

# Voxelization
voxel_size = 1 / 2
min_bound = (-0.5, -0.5, -0.5)
max_bound = (0.5, 0.5, 0.5)

voxel_grid = o3d.geometry.VoxelGrid.create_from_triangle_mesh_within_bounds(
    mesh, voxel_size=voxel_size, min_bound=min_bound, max_bound=max_bound
)

print(f"Voxel grid created with {len(voxel_grid.get_voxels())} voxels.")

Expected behavior
Voxel grid should be created successfully without a crash.

Actual behavior
Python version: 3.10.18 (main, Jun 5 2025, 13:14:17) [GCC 11.2.0]
Platform: Linux-6.8.0-79-generic-x86_64-with-glibc2.35
OS name: posix
Open3D version: 0.17.0
Numpy version: 2.1.2
Mesh has 1440 vertices and 2880 triangles.
Segmentation fault (core dumped)


Environment (please complete the following information):

Python version: 3.10.18 (main, Jun 5 2025, 13:14:17) [GCC 11.2.0]
Platform: Linux-6.8.0-79-generic-x86_64-with-glibc2.35
OS name: posix
Open3D version: 0.17.0
Numpy version: 2.1.2


Additional context

  • The crash happens regardless of voxel_size (tested with 1/64, 1/32, 1/16, 1/2).
  • The crash persists even after mesh cleanup (remove_duplicated_vertices, remove_degenerate_triangles, etc.).
  • The issue only happens on Linux; on Windows with the same version, the function works as expected.
  • This might be related to internal voxelization code in C++ handling bounds incorrectly on Linux.

Would appreciate any insights or suggestions for workarounds. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions