Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question for the occupancy grid code of Raymatching.cu #140

Open
SYSUykLin opened this issue Oct 19, 2023 · 1 comment
Open

Question for the occupancy grid code of Raymatching.cu #140

SYSUykLin opened this issue Oct 19, 2023 · 1 comment

Comments

@SYSUykLin
Copy link

I am a little confused about the implementation of occ, why we need to /8 when define the grid?
self.register_buffer('density_bitfield', torch.zeros(self.cascades*self.grid_size**3//8, dtype=torch.uint8))
And when we query the occ, also /8 and & (1 << (idx % 8)), Why?
const bool occ = density_bitfield[idx / 8] & (1 << (idx % 8));

@cwpeng-cn
Copy link

I suspect that the reason is because the authors defined the density_bitfield using uint8, but since the values within density_bitfield only need to represent 0 or 1, a single element can represent the values for 8 positions.
Therefore, when indexing, the expression const bool occ = density_bitfield[idx / 8] & (1 << (idx % 8)) is used to access the corresponding bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants