Unverified Commit 6ab97aeb authored by Ruilong Li(李瑞龙)'s avatar Ruilong Li(李瑞龙) Committed by GitHub
Browse files

Update volrend.py (#271)

Support expected depth option for rendering
parent 676ae91c
......@@ -23,6 +23,7 @@ def rendering(
rgb_alpha_fn: Optional[Callable] = None,
# rendering options
render_bkgd: Optional[Tensor] = None,
expected_depths: bool = True,
) -> Tuple[Tensor, Tensor, Tensor, Dict]:
"""Render the rays through the radience field defined by `rgb_sigma_fn`.
......@@ -49,6 +50,7 @@ def rendering(
ray indices} and returns the post-activation rgb (..., 3) and opacity
values (...,). The shape `...` is the same as the shape of `t_starts`.
render_bkgd: Background color. Tensor with shape (3,).
expected_depths: If True, return the expected depths. Else, the accumulated depth is returned.
Returns:
Ray colors (n_rays, 3), opacities (n_rays, 1), depths (n_rays, 1) and a dict
......@@ -150,6 +152,7 @@ def rendering(
ray_indices=ray_indices,
n_rays=n_rays,
)
if expected_depths:
depths = depths / opacities.clamp_min(torch.finfo(rgbs.dtype).eps)
# Background composition.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment