Omar Mobarak
Omar Mobarak

Reputation: 11

how to merge a collection of list objects using the trimesh library and subsequently save the combined result into a single .obj file?

i want merge a collection of list objects using the trimesh library and subsequently save the combined result into a single .obj file?

for file_path, size, translation, rotation_angle in zip(file_paths, size_data, translation_data, rotation_angles):
    obj_path = '/home/om/Project/3D-FUTURE-model/*/raw_model.obj'.replace('*', file_path)
    
    
    # Use glob to find the actual file path
    obj_files = glob.glob(obj_path)

    if len(obj_files) == 1:
        mesh = trimesh.load_mesh(obj_files[0])

        rotation_matrix = trimesh.transformations.rotation_matrix(rotation_angle, rotation_axis)
        mesh.apply_transform(rotation_matrix)

        mesh.apply_translation(translation)

        meshs.append(mesh)

merged_mesh = trimesh.util.concatenate(meshs)


merged_mesh.export(room_directory +'/merged.obj')

Problem : When I display the merged file, the texture gets corrupted

Upvotes: 1

Views: 298

Answers (0)

Related Questions