@@ -41,13 +41,13 @@ class ImplicitRenderer(torch.nn.Module):
4141 as well as the `volumetric_function` `Callable`, which defines a field of opacity
4242 and feature vectors over the 3D domain of the scene.
4343
44- A standard `volumetric_function` has the following signature:
45- ```
46- def volumetric_function(
47- ray_bundle: Union[RayBundle, HeterogeneousRayBundle],
48- **kwargs,
49- ) -> Tuple[torch.Tensor, torch.Tensor]
50- ```
44+ A standard `volumetric_function` has the following signature::
45+
46+ def volumetric_function(
47+ ray_bundle: Union[RayBundle, HeterogeneousRayBundle],
48+ **kwargs,
49+ ) -> Tuple[torch.Tensor, torch.Tensor]
50+
5151 With the following arguments:
5252 `ray_bundle`: A RayBundle or HeterogeneousRayBundle object
5353 containing the following variables:
@@ -79,32 +79,32 @@ def volumetric_function(
7979
8080 Example:
8181 A simple volumetric function of a 0-centered
82- RGB sphere with a unit diameter is defined as follows:
83- ```
84- def volumetric_function(
85- ray_bundle: Union[RayBundle, HeterogeneousRayBundle],
86- **kwargs,
87- ) -> Tuple[torch.Tensor, torch.Tensor]:
82+ RGB sphere with a unit diameter is defined as follows::
8883
89- # first convert the ray origins, directions and lengths
90- # to 3D ray point locations in world coords
91- rays_points_world = ray_bundle_to_ray_points(ray_bundle)
84+ def volumetric_function(
85+ ray_bundle: Union[RayBundle, HeterogeneousRayBundle],
86+ **kwargs,
87+ ) -> Tuple[torch.Tensor, torch.Tensor]:
9288
93- # set the densities as an inverse sigmoid of the
94- # ray point distance from the sphere centroid
95- rays_densities = torch.sigmoid(
96- -100.0 * rays_points_world.norm(dim=-1, keepdim=True)
97- )
89+ # first convert the ray origins, directions and lengths
90+ # to 3D ray point locations in world coords
91+ rays_points_world = ray_bundle_to_ray_points(ray_bundle)
92+
93+ # set the densities as an inverse sigmoid of the
94+ # ray point distance from the sphere centroid
95+ rays_densities = torch.sigmoid(
96+ -100.0 * rays_points_world.norm(dim=-1, keepdim=True)
97+ )
98+
99+ # set the ray features to RGB colors proportional
100+ # to the 3D location of the projection of ray points
101+ # on the sphere surface
102+ rays_features = torch.nn.functional.normalize(
103+ rays_points_world, dim=-1
104+ ) * 0.5 + 0.5
98105
99- # set the ray features to RGB colors proportional
100- # to the 3D location of the projection of ray points
101- # on the sphere surface
102- rays_features = torch.nn.functional.normalize(
103- rays_points_world, dim=-1
104- ) * 0.5 + 0.5
106+ return rays_densities, rays_features
105107
106- return rays_densities, rays_features
107- ```
108108 """
109109
110110 def __init__ (self , raysampler : Callable , raymarcher : Callable ) -> None :
0 commit comments