Closed xiahongchi closed 1 week ago
Hi @xiahongchi ,
Great question! Yes, you can technically extract all the ground-truth meshes from all the objects. The code should be something like this:
# Assumes extracted digital cousin scene has already been loaded using `SimulatedSceneGenerator.load_cousin_scene`
import omnigibson as og
from omnigibson.utils.usd_utils import mesh_prim_to_trimesh_mesh
# We traverse over all objects in the scene, and iterate over all their meshes (can be collision or visual) and extract their trimesh mesh representations
meshes = []
for obj in scene.objects:
for link_name, link in obj.links.items():
# Choose either of the following, using visual meshes for now
# for mesh_name, mesh in link.collision_meshes.items():
for mesh_name, mesh in link.visual_meshes.items():
print(f"Extracting mesh for {obj.name} : {link_name} : {mesh_name}")
tm_mesh = mesh_prim_to_trimesh_mesh(mesh.prim, world_frame=True)
meshes.append(tm_mesh)
# Then your output is in `meshes`
Closing this issue for now as there's been no response for a few weeks. Feel free to re-open if you continue to run into issues!
Hi, thanks for your great work!
I just run this code and it works smoothly. I might want to extract the scene into Mesh representation. Is it possible?
Thanks!