-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow saving vertex normal in save_obj (#1511)
Summary: Although we can load per-vertex normals in `load_obj`, saving per-vertex normals is not supported in `save_obj`. This patch fixes this by allowing passing per-vertex normal data in `save_obj`: ``` python def save_obj( f: PathOrStr, verts, faces, decimal_places: Optional[int] = None, path_manager: Optional[PathManager] = None, *, verts_normals: Optional[torch.Tensor] = None, faces_normals: Optional[torch.Tensor] = None, verts_uvs: Optional[torch.Tensor] = None, faces_uvs: Optional[torch.Tensor] = None, texture_map: Optional[torch.Tensor] = None, ) -> None: """ Save a mesh to an .obj file. Args: f: File (str or path) to which the mesh should be written. verts: FloatTensor of shape (V, 3) giving vertex coordinates. faces: LongTensor of shape (F, 3) giving faces. decimal_places: Number of decimal places for saving. path_manager: Optional PathManager for interpreting f if it is a str. verts_normals: FloatTensor of shape (V, 3) giving the normal per vertex. faces_normals: LongTensor of shape (F, 3) giving the index into verts_normals for each vertex in the face. verts_uvs: FloatTensor of shape (V, 2) giving the uv coordinate per vertex. faces_uvs: LongTensor of shape (F, 3) giving the index into verts_uvs for each vertex in the face. texture_map: FloatTensor of shape (H, W, 3) representing the texture map for the mesh which will be saved as an image. The values are expected to be in the range [0, 1], """ ``` Pull Request resolved: #1511 Reviewed By: shapovalov Differential Revision: D45086045 Pulled By: bottler fbshipit-source-id: 666efb0d2c302df6cf9f2f6601d83a07856bf32f
- Loading branch information
1 parent
ec87284
commit 092400f
Showing
2 changed files
with
262 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.