mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
fit_textured_mesh tutorial fixes
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
This commit is contained in:
parent
96889deab9
commit
7ea0756b05
@ -118,7 +118,7 @@
|
|||||||
"from pytorch3d.structures import Meshes\n",
|
"from pytorch3d.structures import Meshes\n",
|
||||||
"from pytorch3d.renderer import (\n",
|
"from pytorch3d.renderer import (\n",
|
||||||
" look_at_view_transform,\n",
|
" look_at_view_transform,\n",
|
||||||
" OpenGLPerspectiveCameras, \n",
|
" FoVPerspectiveCameras, \n",
|
||||||
" PointLights, \n",
|
" PointLights, \n",
|
||||||
" DirectionalLights, \n",
|
" DirectionalLights, \n",
|
||||||
" Materials, \n",
|
" Materials, \n",
|
||||||
@ -304,11 +304,11 @@
|
|||||||
"# broadcasting. So we can view the camera from the a distance of dist=2.7, and \n",
|
"# 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",
|
"# 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",
|
"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",
|
"\n",
|
||||||
"# We arbitrarily choose one particular view that will be used to visualize \n",
|
"# We arbitrarily choose one particular view that will be used to visualize \n",
|
||||||
"# results\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",
|
" T=T[None, 1, ...]) \n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Define the settings for rasterization and shading. Here we set the output \n",
|
"# Define the settings for rasterization and shading. Here we set the output \n",
|
||||||
@ -351,7 +351,7 @@
|
|||||||
"# Our multi-view cow dataset will be represented by these 2 lists of tensors,\n",
|
"# Our multi-view cow dataset will be represented by these 2 lists of tensors,\n",
|
||||||
"# each of length num_views.\n",
|
"# each of length num_views.\n",
|
||||||
"target_rgb = [target_images[i, ..., :3] for i in range(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)]"
|
" T=T[None, i, ...]) for i in range(num_views)]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -708,6 +708,7 @@
|
|||||||
" image_size=128, \n",
|
" image_size=128, \n",
|
||||||
" blur_radius=np.log(1. / 1e-4 - 1.)*sigma, \n",
|
" blur_radius=np.log(1. / 1e-4 - 1.)*sigma, \n",
|
||||||
" faces_per_pixel=50, \n",
|
" faces_per_pixel=50, \n",
|
||||||
|
" perspective_correct=False, \n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Differentiable soft renderer using per vertex RGB colors for texture\n",
|
"# Differentiable soft renderer using per vertex RGB colors for texture\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user