nerfstudio-project / nerfacc

A General NeRF Acceleration Toolbox in PyTorch.
https://www.nerfacc.com/
Other
1.37k stars 113 forks source link

Occupancy grid for unbounded scenes #181

Closed hturki closed 1 year ago

hturki commented 1 year ago

Thanks for the great library! I'm trying to understand how to use the new multi-level occupancy grid for unbounded scenes:

liruilong940607 commented 1 year ago

Hi!

The Occ Grid is defined with the base level aabb, which we call the region of interest (roi_aabb). And each level in the Occ Grid is with a 2x aabb larger than the previous one.

https://github.com/KAIR-BAIR/nerfacc/blob/e547490c41751365235f70dc22219375a276e0ea/nerfacc/grid.py#L113-L118

The radiance field, however is defined with the true bounding box of the scene, which in this case should be the highest level aabb that the Occ Grid can cover, thus is 2 ** 4 = 16 times larger than the base aabb.

https://github.com/KAIR-BAIR/nerfacc/blob/e547490c41751365235f70dc22219375a276e0ea/examples/train_ngp_nerf.py#L125-L130

We simply did not support contraction for multi-res occ grid because they serve very similar purpose of supporting unbounded scene (though multi-res is not true unbounded). Implementation wise, occ grid with contraction will distort the space thus the ray traversal within it will not be straight line. This makes grid traversal inefficient. So we are gradually switching to the decision of not support contraction for the occ grid in the future. Empirically multi-res grid works much better than single-res grid + contraction.

hturki commented 1 year ago

Thanks for the context, this is very helpful. FWIW MERF (https://arxiv.org/pdf/2302.12249.pdf) proposes a modified contraction that does preserve straight lines:

image image

It could be interesting to add to this repo. I might do so if I decide to go down this route.