Skip to content

Commit

Permalink
fit_textured_mesh tutorial fixes
Browse files Browse the repository at this point in the history
Summary: Updated to FoV cameras and added perspective_correct=False, otherwise it'll nan out.

Reviewed By: bottler

Differential Revision: D35970900

fbshipit-source-id: 569b8de0b124d415f4b841924ddc85585cee2dda
  • Loading branch information
Krzysztof Chalupka authored and facebook-github-bot committed Apr 27, 2022
1 parent 96889de commit 7ea0756
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/tutorials/fit_textured_mesh.ipynb
Expand Up @@ -118,7 +118,7 @@
"from pytorch3d.structures import Meshes\n",
"from pytorch3d.renderer import (\n",
" look_at_view_transform,\n",
" OpenGLPerspectiveCameras, \n",
" FoVPerspectiveCameras, \n",
" PointLights, \n",
" DirectionalLights, \n",
" Materials, \n",
Expand Down Expand Up @@ -304,11 +304,11 @@
"# broadcasting. So we can view the camera from the a distance of dist=2.7, and \n",
"# then specify elevation and azimuth angles for each viewpoint as tensors. \n",
"R, T = look_at_view_transform(dist=2.7, elev=elev, azim=azim)\n",
"cameras = OpenGLPerspectiveCameras(device=device, R=R, T=T)\n",
"cameras = FoVPerspectiveCameras(device=device, R=R, T=T)\n",
"\n",
"# We arbitrarily choose one particular view that will be used to visualize \n",
"# results\n",
"camera = OpenGLPerspectiveCameras(device=device, R=R[None, 1, ...], \n",
"camera = FoVPerspectiveCameras(device=device, R=R[None, 1, ...], \n",
" T=T[None, 1, ...]) \n",
"\n",
"# Define the settings for rasterization and shading. Here we set the output \n",
Expand Down Expand Up @@ -351,7 +351,7 @@
"# Our multi-view cow dataset will be represented by these 2 lists of tensors,\n",
"# each of length num_views.\n",
"target_rgb = [target_images[i, ..., :3] for i in range(num_views)]\n",
"target_cameras = [OpenGLPerspectiveCameras(device=device, R=R[None, i, ...], \n",
"target_cameras = [FoVPerspectiveCameras(device=device, R=R[None, i, ...], \n",
" T=T[None, i, ...]) for i in range(num_views)]"
]
},
Expand Down Expand Up @@ -708,6 +708,7 @@
" image_size=128, \n",
" blur_radius=np.log(1. / 1e-4 - 1.)*sigma, \n",
" faces_per_pixel=50, \n",
" perspective_correct=False, \n",
")\n",
"\n",
"# Differentiable soft renderer using per vertex RGB colors for texture\n",
Expand Down

0 comments on commit 7ea0756

Please sign in to comment.