nerfacc.ray_aabb_intersect¶
- nerfacc.ray_aabb_intersect(rays_o, rays_d, aabb)¶
Ray AABB Test.
Note
this function is not differentiable to any inputs.
- Parameters:
rays_o (Tensor) – Ray origins of shape (n_rays, 3).
rays_d (Tensor) – Normalized ray directions of shape (n_rays, 3).
aabb (Tensor) – Scene bounding box {xmin, ymin, zmin, xmax, ymax, zmax}. Tensor with shape (6)
- Returns:
Ray AABB intersection {t_min, t_max} with shape (n_rays) respectively. Note the t_min is clipped to minimum zero. 1e10 means no intersection.
- Return type:
Tuple[Tensor, Tensor]
Examples:
aabb = torch.tensor([0.0, 0.0, 0.0, 1.0, 1.0, 1.0], device="cuda:0") rays_o = torch.rand((128, 3), device="cuda:0") rays_d = torch.randn((128, 3), device="cuda:0") rays_d = rays_d / rays_d.norm(dim=-1, keepdim=True) t_min, t_max = ray_aabb_intersect(rays_o, rays_d, aabb)