I'm currently using Open3D in Python to voxelize meshes, and I've come across a peculiar behavior during the process. When voxelizing a box mesh, it appears that the resulting voxels only align along the lines of the triangles instead of filling the entire surface area of the triangle faces, particularly noticeable on the box's walls.
Is this behavior expected in Open3D's voxelization process, or is there a misunderstanding in my approach?
I attempted voxelization on a box mesh, expecting the voxel grid to uniformly fill all the triangles of the mesh, that comprises the faces of the box. However, upon visualization, I noticed that while the top and bottom faces are adequately filled, the walls of the box exhibit voxelization primarily along the triangle edges.
import open3d as o3d
import numpy as np
new_room = o3d.geometry.TriangleMesh.create_box(10,10,10)
lines = []
for triangle in np.array(new_room.triangles):
lines.extend([(triangle[0], triangle[1]), (triangle[1], triangle[2]), (triangle[2], triangle[0])])
line_set = o3d.geometry.LineSet()
vertices = np.array(new_room.vertices)
line_set.points = o3d.utility.Vector3dVector(vertices)
line_set.lines = o3d.utility.Vector2iVector(lines)
voxel_grid = o3d.geometry.VoxelGrid.create_from_triangle_mesh(new_room, voxel_size=0.5)
o3d.visualization.draw_geometries([new_room, line_set, voxel_grid])
Upon visualization, only the top and bottom faces are adequately filled, while the walls show voxelization predominantly along the diagonals.
I'm using Open3D version v0.17.0.
After encountering an issue with Open3D's voxelization process, I discovered that the problem had been raised and addressed on GitHub in this thread. The issue was resolved in Open3D version v0.18.0.
However, when attempting to update the package using pip, I encountered difficulties as pip couldn't find the correct compatible tag on PyPI with the desired version. This issue arose due to using an Apple Mac M1, which has some compatibility issues with package tags.
Thankfully, I found a solution documented here:
SYSTEM_VERSION_COMPAT=0 pip install --upgrade open3d
Running this command resolved the compatibility issue and allowed me to successfully update Open3D to the required version. The voxelization is working perfectly now.