You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a project in which i want to import a 3d scene file and perform some preprocessing on it and then use the preprocessed information in threejs. ThreeJs and Blender use same naming convention of objects i.e. there is a 3d object and then there is a mesh which is the data of that object. But when I'm loading the file with trimesh, I'm not able to get the same names in geometry or graph attributes. How can I get the same names using trimesh?
I'm using glb file but have to import fbx and obj as well.
The text was updated successfully, but these errors were encountered:
Hey, yeah it might take some tinkering to get it to line up exactly right. I think the core challenge is that GLTF "meshes" include multiple "primitives," a data structure trimesh just considers another mesh. Hence the suffixes being appended to GLTF mesh names by trimesh.util.unique_name. I think trimesh.load(..., merge_primitives=True) gets you pretty close:
In [1]: import trimesh
In [2]: a = trimesh.load('models/CesiumMilkTruck.glb')
In [3]: a.geometry
Out[3]:
OrderedDict([('Cesium_Milk_Truck',
<trimesh.Trimesh(vertices.shape=(1856, 3), faces.shape=(1744, 3))>),
('Cesium_Milk_Truck_1',
<trimesh.Trimesh(vertices.shape=(72, 3), faces.shape=(56, 3))>),
('Cesium_Milk_Truck_2',
<trimesh.Trimesh(vertices.shape=(464, 3), faces.shape=(288, 3))>),
('Wheels',
<trimesh.Trimesh(vertices.shape=(586, 3), faces.shape=(768, 3))>)])
In [4]: a.graph.nodes_geometry
Out[4]: ['0_4f9167', '0_5e6e5e', '0_b87655', '2', '4']
In [5]: b = trimesh.load('models/CesiumMilkTruck.glb', merge_primitives=True)
In [6]: b.geometry
Out[6]:
OrderedDict([('Cesium_Milk_Truck',
<trimesh.Trimesh(vertices.shape=(2392, 3), faces.shape=(2088, 3))>),
('Wheels',
<trimesh.Trimesh(vertices.shape=(586, 3), faces.shape=(768, 3))>)])
In [7]: b.graph.nodes_geometry
Out[7]: ['0', '2', '4']
Hey, I tried this and it did achieve somewhat but still some object names are coming which are not in the scene, how can I achieve it completely as that is important part for the processing that i'm doing
I'm working on a project in which i want to import a 3d scene file and perform some preprocessing on it and then use the preprocessed information in threejs. ThreeJs and Blender use same naming convention of objects i.e. there is a 3d object and then there is a mesh which is the data of that object. But when I'm loading the file with trimesh, I'm not able to get the same names in geometry or graph attributes. How can I get the same names using trimesh?
I'm using glb file but have to import fbx and obj as well.
The text was updated successfully, but these errors were encountered: