In pytorch3d.io module there is a function to save .obj file. After deforming one mesh to another I would like to export new .obj but with textures and uv from source mesh. Could you please explain how can I do this?
@hadhoryth we currently don't provide support for saving '.obj' meshes with textures as you describe and don't have plans to support this in the short term as this isn't a primary use case.
If you would like to write your own function, you would need to use the three components returned from load_obj: verts, faces, aux. The names of the materials in the source mesh are given by aux.material_colors.keys() and the index of the material for each face is given by faces.faces_materials_idx which indexes into list(material_colors.keys()). You can then use this to construct the .obj based on the standard .obj format - i.e. write usemtl material_1 before the set of faces which use that material.
that would be convenient.
Most helpful comment
@hadhoryth we currently don't provide support for saving '.obj' meshes with textures as you describe and don't have plans to support this in the short term as this isn't a primary use case.
If you would like to write your own function, you would need to use the three components returned from
load_obj:verts, faces, aux. The names of the materials in the source mesh are given byaux.material_colors.keys()and the index of the material for each face is given byfaces.faces_materials_idxwhich indexes intolist(material_colors.keys()). You can then use this to construct the.objbased on the standard.objformat - i.e. writeusemtl material_1before the set of faces which use that material.