Skip to content

Commit 7c0d307

Browse files
davnov134facebook-github-bot
authored andcommitted
Implicit function docfix
Summary: Fixes implicit function doc. Reviewed By: theschnitz, nikhilaravi Differential Revision: D26870946 fbshipit-source-id: 5d03ebbc284153c41b9d6695b28c8b4e11bc0a5c
1 parent cc08c6b commit 7c0d307

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

pytorch3d/renderer/implicit/renderer.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,29 @@ class ImplicitRenderer(torch.nn.Module):
3232
3333
VOLUMETRIC_FUNCTION
3434
35-
The `forward` function of the renderer accepts as input the rendering cameras as well
36-
as the `volumetric_function` `Callable`, which defines a field of opacity
35+
The `forward` function of the renderer accepts as input the rendering cameras
36+
as well as the `volumetric_function` `Callable`, which defines a field of opacity
3737
and feature vectors over the 3D domain of the scene.
3838
3939
A standard `volumetric_function` has the following signature:
4040
```
41-
def volumetric_function(ray_bundle: RayBundle) -> Tuple[torch.Tensor, torch.Tensor]
41+
def volumetric_function(
42+
ray_bundle: RayBundle,
43+
**kwargs,
44+
) -> Tuple[torch.Tensor, torch.Tensor]
4245
```
4346
With the following arguments:
4447
`ray_bundle`: A RayBundle object containing the following variables:
45-
`rays_origins`: A tensor of shape `(minibatch, ..., 3)` denoting
48+
`origins`: A tensor of shape `(minibatch, ..., 3)` denoting
4649
the origins of the rendering rays.
47-
`rays_directions`: A tensor of shape `(minibatch, ..., 3)`
50+
`directions`: A tensor of shape `(minibatch, ..., 3)`
4851
containing the direction vectors of rendering rays.
49-
`rays_lengths`: A tensor of shape
52+
`lengths`: A tensor of shape
5053
`(minibatch, ..., num_points_per_ray)`containing the
5154
lengths at which the ray points are sampled.
55+
`xys`: A tensor of shape
56+
`(minibatch, ..., 2)` containing the
57+
xy locations of each ray's pixel in the screen space.
5258
Calling `volumetric_function` then returns the following:
5359
`rays_densities`: A tensor of shape
5460
`(minibatch, ..., num_points_per_ray, opacity_dim)` containing
@@ -57,12 +63,20 @@ def volumetric_function(ray_bundle: RayBundle) -> Tuple[torch.Tensor, torch.Tens
5763
`(minibatch, ..., num_points_per_ray, feature_dim)` containing
5864
the an feature vector for each ray point.
5965
66+
Note that, in order to increase flexibility of the API, we allow multiple
67+
other arguments to enter the volumentric function via additional
68+
(optional) keyword arguments `**kwargs`.
69+
A typical use-case is passing a `CamerasBase` object as an additional
70+
keyword argument, which can allow the volumetric function to adjust its
71+
outputs based on the directions of the projection rays.
72+
6073
Example:
6174
A simple volumetric function of a 0-centered
6275
RGB sphere with a unit diameter is defined as follows:
6376
```
6477
def volumetric_function(
6578
ray_bundle: RayBundle,
79+
**kwargs,
6680
) -> Tuple[torch.Tensor, torch.Tensor]:
6781
6882
# first convert the ray origins, directions and lengths

0 commit comments

Comments
 (0)