isl-org / isl-org/Open3D

Segmentation fault when reading TriangleMesh from GLB

Open
#2,682 0 comments 0 reactions 1 assignee Claimed by @ShubhamAgarwal12 View on GitHub
bug io
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

**Describe the bug**
When reading a TriangleMesh from .glb there is a segmentation fault.

I am using the following code to see if UV-coordinates can be stored in GLTF/GLB:
```
import numpy as np
import open3d as o3d

box = o3d.geometry.TriangleMesh.create_box()
print('box.has_triangle_uvs() =', box.has_triangle_uvs())

triangle_uvs = np.zeros((3*len(box.triangles), 2))
box.triangle_uvs = o3d.utility.Vector2dVector(triangle_uvs)

print('box.has_triangle_uvs() =', box.has_triangle_uvs())

for fmt in ['obj', 'gltf', 'glb']:
print()
print(f'Write mesh to .{fmt}')
o3d.io.write_triangle_mesh(f'test.{fmt}', box)

print(f'Read mesh from .{fmt}')
tmp = o3d.io.read_triangle_mesh(f'test.{fmt}')
print('tmp.has_triangle_uvs() =', tmp.has_triangle_uvs())
```
**To Reproduce**
The segmentation fault can be triggered by running the code above or this snippet:
```
import open3d as o3d

box = o3d.geometry.TriangleMesh.create_box()
o3d.io.write_triangle_mesh('test.glb', box)
box2 = o3d.io.read_triangle_mesh('test.glb')
```

**Expected behavior**
I expected to be able to read the file and look for the UV-coordinates in the TriangleMesh.

**Environment (please complete the following information):**

- Operating system: Debian 10
- Python version: Python 3.7.3
- Open3D version: 0.11.2
- Is this remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): N/A

**Additional context**
The closing comment in issue #1775 claims that Open3D now has full support for GLTF in the rendering module so I wanted to see if GLTF could replace OBJ now.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.