Skip to content

Strange VoxelGrid result from a TriangleMesh #6324

@sharon-br

Description

@sharon-br

Checklist

Describe the issue

When creating a VoxelGrid from a simple TriangleMesh representing a cube, I get a strange result, which is very different from what I would expect and much different from the VoxelGrid created from the sampled PointCloud of that mesh.
The mesh itself is a simple cube constructed from 8 unique vertices.
It seems like the issue described in #6111.

Steps to reproduce the bug

import open3d
import numpy as np

mesh = open3d.geometry.TriangleMesh()
mesh.vertices = open3d.utility.Vector3dVector(np.array([[ 45.69434738, 268.5824585 ,  22.96587944],
        [ 45.69434738, 268.5824585 ,  25.59055138],
        [ 45.69434738, 270.55096436,  22.96587944],
        [ 45.69434738, 270.55096436,  25.59055138],
        [ 47.66285324, 268.5824585 ,  22.96587944],
        [ 47.66285324, 268.5824585 ,  25.59055138],
        [ 47.66285324, 270.55096436,  22.96587944],
        [ 47.66285324, 270.55096436,  25.59055138]]).reshape((-1, 3)))
mesh.triangles = open3d.utility.Vector3iVector(np.array([1, 5, 3, 3, 5, 7, 0, 2, 4, 4, 2, 6, 6, 2, 7, 7, 2, 3, 2, 0, 3, 3, 0, 1, 0, 4, 1, 1, 4, 5, 4, 6, 5, 5, 6, 7]).reshape((-1, 3)))

voxel_grid = open3d.geometry.VoxelGrid.create_from_triangle_mesh(mesh, voxel_size=0.05)
voxel_grid_from_point_cloud = open3d.geometry.VoxelGrid.create_from_point_cloud(mesh.sample_points_uniformly(100_000), 0.05)

Error message

Mesh itself:
image

Result of VoxelGrid:
image

Result of VoxelFridFromPointCloud:
image

Expected behavior

I would expect the VoxelGrid from the TriangleMesh to look very much like the mesh itself, the same as the one constructed from the PointCloud looks like.

Open3D, Python and System information

- Operating system: Windows 10 64-bit
- Python version: Python 3.9
- Open3D version: 0.17.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): -

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot a build issue, this is likely a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions