nerfstudio-project / nerfacc

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

Issue with pack_info #161

Open kzhang2 opened 1 year ago

kzhang2 commented 1 year ago

Hi,

I needed to hack the nerfacc framework into my custom rendering pipeline, which required me to manually modify the ray_indices variable that gets passed around the various rendering functions from within the framework. However, I discovered that pack_info requires that ray_indices is contiguous with respect to indices, which is somewhat problematic for me. More specifically, suppose we have ray_indices=[0, 0, 1, 1, 0, 1]. Then pack_info(ray_indices, n_rays=2) will return the torch.Tensor

[[0, 3],
 [3, 3]]

implying that the first three samples are on ray 0 and the second three samples are on ray 1, but my actual desired behavior is for the system to recognize that the first, second, and fifth samples are on ray 0 and the third, fourth, and sixth samples are on ray 1. At this point, I know that I can do some torch indexing magic to get around this, but I think it might be a good idea for the documentation about ray_indices to be updated so other people like me who are trying to incorporate components of nerfacc into custom rendering pipelines don't fall into the same trap.

liruilong940607 commented 1 year ago

Thanks for pointing this out. Yeah having that marked on the doc would be nice. I will try to find some time to do it.