Skip to content

traverse_grids has bug in some situation? #265

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

Open
SamuelSJTU opened this issue Nov 20, 2023 · 1 comment
Open

traverse_grids has bug in some situation? #265

SamuelSJTU opened this issue Nov 20, 2023 · 1 comment

Comments

@SamuelSJTU
Copy link

There is something wrong with the result of this function traverse_grids. Sometimes may filter ray cause black line.

from nerfacc.grid import _enlarge_aabb, traverse_grids

binaries = torch.zeros([1,32,32,32],dtype=torch.bool).cuda().fill_(True)
aabbs = torch.tensor([[-1,-1,-1,1,1,1]]).float().cuda()

tmp_rays_o = torch.tensor([[1,0,0],[1,0,0]]).float().cuda()
tmp_rays_d = torch.tensor([[-1,1e-16,0],[-1,-1e-16,0]]).float().cuda()  ## use -1e-16 is wrong
far_planes = torch.tensor([3,3]).float().cuda()
near_planes = torch.tensor([0,0]).float().cuda()
render_step_size = 0.001
cone_angle = 0

traverse_grids(tmp_rays_o,tmp_rays_d,binaries,aabbs,near_planes=near_planes,far_planes=far_planes,step_size=render_step_size,cone_angle=cone_angle)[0].ray_indices

## result tensor([0, 0, 0,  ..., 0, 0, 0], device='cuda:0')

## should has ray id 1
from nerfacc.grid import _enlarge_aabb, traverse_grids

binaries = torch.zeros([1,32,32,32],dtype=torch.bool).cuda().fill_(True)
aabbs = torch.tensor([[-1,-1,-1,1,1,1]]).float().cuda()

tmp_rays_o = torch.tensor([[1,0,0],[1,0,0]]).float().cuda()
tmp_rays_d = torch.tensor([[-1,1e-16,0],[-1,-1e-7,0]]).float().cuda()  ## use -1e-7 is right
far_planes = torch.tensor([3,3]).float().cuda()
near_planes = torch.tensor([0,0]).float().cuda()
render_step_size = 0.001
cone_angle = 0

traverse_grids(tmp_rays_o,tmp_rays_d,binaries,aabbs,near_planes=near_planes,far_planes=far_planes,step_size=render_step_size,cone_angle=cone_angle)[0].ray_indices

## result  tensor([0, 0, 0,  ..., 1, 1, 1], device='cuda:0')
@liruilong940607
Copy link
Collaborator

Yeah floating error is always a headache -- currently i dont have a better way to deal with it

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