mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-04-30 02:28:56 +08:00
include TexturesUV in IO.save_mesh(x.obj)
Summary: Added export of UV textures to IO.save_mesh in Pytorch3d MeshObjFormat now passes verts_uv, faces_uv, and texture_map as input to save_obj TODO: check if TexturesUV.verts_uv_list or TexturesUV.verts_uv_padded() should be passed to save_obj IO.save_mesh(obj_file, meshes, decimal_places=2) should be IO().save_mesh(obj_file, meshes, decimal_places=2) Reviewed By: bottler Differential Revision: D39617441 fbshipit-source-id: 4628b7f26f70e38c65f235852b990c8edb0ded23
This commit is contained in:
committed by
Facebook GitHub Bot
parent
305cf32f6b
commit
6ae6ff9cf7
@@ -334,12 +334,25 @@ class MeshObjFormat(MeshFormatInterpreter):
|
||||
|
||||
verts = data.verts_list()[0]
|
||||
faces = data.faces_list()[0]
|
||||
|
||||
verts_uvs: Optional[torch.Tensor] = None
|
||||
faces_uvs: Optional[torch.Tensor] = None
|
||||
texture_map: Optional[torch.Tensor] = None
|
||||
|
||||
if isinstance(data.textures, TexturesUV):
|
||||
verts_uvs = data.textures.verts_uvs_padded()[0]
|
||||
faces_uvs = data.textures.faces_uvs_padded()[0]
|
||||
texture_map = data.textures.maps_padded()[0]
|
||||
|
||||
save_obj(
|
||||
f=path,
|
||||
verts=verts,
|
||||
faces=faces,
|
||||
decimal_places=decimal_places,
|
||||
path_manager=path_manager,
|
||||
verts_uvs=verts_uvs,
|
||||
faces_uvs=faces_uvs,
|
||||
texture_map=texture_map,
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user