mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 15:20:34 +08:00
avoid deprecated raysamplers
Summary: Migrate away from NDCGridRaysampler and GridRaysampler to their more flexible replacements. Reviewed By: patricklabatut Differential Revision: D33281584 fbshipit-source-id: 65f8702e700a32d38f7cd6bda3924bb1707a0633
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3eb4233844
commit
67778caee8
@@ -89,7 +89,7 @@
|
||||
"from pytorch3d.renderer import (\n",
|
||||
" FoVPerspectiveCameras, \n",
|
||||
" VolumeRenderer,\n",
|
||||
" NDCGridRaysampler,\n",
|
||||
" NDCMultinomialRaysampler,\n",
|
||||
" EmissionAbsorptionRaymarcher\n",
|
||||
")\n",
|
||||
"from pytorch3d.transforms import so3_exp_map\n",
|
||||
@@ -164,7 +164,7 @@
|
||||
"The following initializes a volumetric renderer that emits a ray from each pixel of a target image and samples a set of uniformly-spaced points along the ray. At each ray-point, the corresponding density and color value is obtained by querying the corresponding location in the volumetric model of the scene (the model is described & instantiated in a later cell).\n",
|
||||
"\n",
|
||||
"The renderer is composed of a *raymarcher* and a *raysampler*.\n",
|
||||
"- The *raysampler* is responsible for emitting rays from image pixels and sampling the points along them. Here, we use the `NDCGridRaysampler` which follows the standard PyTorch3D coordinate grid convention (+X from right to left; +Y from bottom to top; +Z away from the user).\n",
|
||||
"- The *raysampler* is responsible for emitting rays from image pixels and sampling the points along them. Here, we use the `NDCMultinomialRaysampler` which follows the standard PyTorch3D coordinate grid convention (+X from right to left; +Y from bottom to top; +Z away from the user).\n",
|
||||
"- The *raymarcher* takes the densities and colors sampled along each ray and renders each ray into a color and an opacity value of the ray's source pixel. Here we use the `EmissionAbsorptionRaymarcher` which implements the standard Emission-Absorption raymarching algorithm."
|
||||
]
|
||||
},
|
||||
@@ -186,14 +186,14 @@
|
||||
"volume_extent_world = 3.0\n",
|
||||
"\n",
|
||||
"# 1) Instantiate the raysampler.\n",
|
||||
"# Here, NDCGridRaysampler generates a rectangular image\n",
|
||||
"# Here, NDCMultinomialRaysampler generates a rectangular image\n",
|
||||
"# grid of rays whose coordinates follow the PyTorch3D\n",
|
||||
"# coordinate conventions.\n",
|
||||
"# Since we use a volume of size 128^3, we sample n_pts_per_ray=150,\n",
|
||||
"# which roughly corresponds to a one ray-point per voxel.\n",
|
||||
"# We further set the min_depth=0.1 since there is no surface within\n",
|
||||
"# 0.1 units of any camera plane.\n",
|
||||
"raysampler = NDCGridRaysampler(\n",
|
||||
"raysampler = NDCMultinomialRaysampler(\n",
|
||||
" image_width=render_size,\n",
|
||||
" image_height=render_size,\n",
|
||||
" n_pts_per_ray=150,\n",
|
||||
@@ -462,7 +462,7 @@
|
||||
"source": [
|
||||
"## 6. Conclusion\n",
|
||||
"\n",
|
||||
"In this tutorial, we have shown how to optimize a 3D volumetric representation of a scene such that the renders of the volume from known viewpoints match the observed images for each viewpoint. The rendering was carried out using the PyTorch3D's volumetric renderer composed of an `NDCGridRaysampler` and an `EmissionAbsorptionRaymarcher`."
|
||||
"In this tutorial, we have shown how to optimize a 3D volumetric representation of a scene such that the renders of the volume from known viewpoints match the observed images for each viewpoint. The rendering was carried out using the PyTorch3D's volumetric renderer composed of an `NDCMultinomialRaysampler` and an `EmissionAbsorptionRaymarcher`."
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user