PyWavefront
PyWavefront copied to clipboard
How do I extract the colors of each vertex after loading the .obj file ?
How do I extract the colors of each vertex after loading the .obj file? I am only able to extract the coordinates of each vertex using the code below. How about the colors of each vertex?
object = Wavefront(object_name+".obj", create_materials=True, collect_faces=True)
# collect faces
faces = []
for mesh in object.mesh_list:
faces = faces + mesh.faces
# collect vertices
vertices = object.vertices
Colors should be in object.vertices
and also interlaved in each material. You will have to look at the vertex format in the last case.
See: https://github.com/pywavefront/PyWavefront/issues/87#issuecomment-464348971