isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.45k stars 2.31k forks source link

How to save multiple meshes in group and separate it? #4250

Open tommy-qichang opened 3 years ago

tommy-qichang commented 3 years ago

Is your feature request related to a problem? Please describe. Describe the solution you'd like A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] Hi there, Thank you for providing the method to merge the mesh. Just wondering if there is any way to split or identify each of the meshes? For instance, I want to save multiple meshes into one obj, and then read each of the meshes one by one. Or can we use mesh groups when writing .obj file? Thanks

hsellik commented 9 months ago

Any plans with this feature? Should be possible with glTF as Khronos specification states that the root object should have meshes property and meshes inside it can include extras field for metadata.

I could not do it with o3d and used trimesh for this. I loaded and read the metadata in Three.js, but I imagine one should be able to read it with Python as well.

import open3d as o3d
import trimesh

scene = trimesh.Scene()

mesh = o3d.geometry.TriangleMesh.create_box()
new_trimesh = trimesh.Trimesh(np.asarray(mesh.vertices), np.asarray(mesh.triangles))

scene.add_geometry(geometry=new_trimesh, node_name='optional name', metadata={'some_data': 1})
# scene.add_geometry(geometry=some_other_mesh, node_name='new name', metadata={'some_data': 2})

scene.export('combined_meshes.glb')

Quite new to 3d and not sure why other people are not showing interest in this feature. Are developers generally saving their models to different files, even for the web?