I'm using python with open3D and I'm a complete newby working with 3D models. I've got an obj file that contains several objects and materials. I'm applying simple ray casting to get all visible surfaces (or triangles) on my objects. The goal is to know which object a hit triangle belongs to and the material of the triangle.
For better explainability, lets assume I have a car. The car in my example file consists of 5 objects where one is the car's body and the other 4 are the different tires. Lets also assume 3 materials (glass, rubber, metal). I exported my model from blender into a wavefront file. The obj file, it looks something like this:
# Blender v2.82 (sub 7) OBJ File: 'car.blend'
# www.blender.org
mtllib car.mtl
o rear_right_wheel
v -1.877871 0.422398 -1.061992
v -1.692930 0.516533 -1.061992
v -1.487661 0.516533 -1.061992
...
usemtl rubber
...
o rear_left_wheel
v ...
My two problems now are:
- The
read_triangle_meshfunction gives me triangles but not the object names. Is there a way to get the object groups using open3D? Like how do I get the information that a certain triangle belongs to therear_right_wheel? - The materials can be loaded as a list of indices. The indices represent the material's index in the mtl file. How do I access the material properties? Like how do I get the info that if my triangle has the material with index 1, this translates to the material name
rubberand the list of its properties?
If there is no way to do these things with open3D. Would you have a suggestions for a library that allows me to achieve the above described goal?
I've searched around the documentation of open3D and I've searched the internet with a variety of search strings in relation to open3d but for the life of mine, I can't figure out if I can get the object names somehow and how to access the material properties.
Thank you very much for your help!