muskie82 / MonoGS

[CVPR'24 Highlight & Best Demo Award] Gaussian Splatting SLAM
https://rmurai.co.uk/projects/GaussianSplattingSLAM/
Other
1.31k stars 118 forks source link

Visible Gaussians from viewpoint - radii or n_touched #76

Open robofar opened 5 months ago

robofar commented 5 months ago

Function render returns following dictionary:

 return {
        "render": rendered_image,
        "viewspace_points": screenspace_points,
        "visibility_filter": radii > 0,
        "radii": radii,
        "depth": depth,
        "opacity": opacity,
        "n_touched": n_touched,
    }

If I understood correctly:

Can someone tell me what would be difference between these two expressions:

  1. radii > 0
  2. n_touched > 0

So what 0 represents for radii and n_touched? I thought they both represent number of visible Gaussians from viewpoint, but it seems they do not. For example torch.sum(radii>0) and torch.sum(n_touched>0) for a certain viewpoint, would not give same result.

So, to sum up, my doubts are:

  1. What excatly radii and n_touched represent (if my understanding written above is wrong)?
  2. What would mask mean in both cases: radii>0 and n_touched>0? Is one of this expressions representing number of visible Gaussians from certain viewpoint? If so, which one? I thought both do... (but it seems not)

Thank you very much!

rmurai0610 commented 5 months ago

Hi, n_touched checks if the Gaussian was rasterised before we reach the median depth https://github.com/rmurai0610/diff-gaussian-rasterization-w-pose/blob/main/cuda_rasterizer/forward.cu#L370 So even if the Gaussian is visible (in terms of radii) it may not be counted towards n_touched

robofar commented 5 months ago

So, for n_touched, Gaussians whose depth < median_depth, they will be labeled with 1 in n_touched tensor.

For radii mask, all Gaussians in that are visible in viewpoint frustum will have value 1 in radii mask tensor?

rmurai0610 commented 5 months ago

n_touched counts it number of pixels which renders the Gaussian before the depth reaches median depth, so it will be greater than 0. And yes, for the radii mask that's right. However, this only checks the radii of the projected Gaussian and does not take into account the occlusion like n_touched.