torch-ngp icon indicating copy to clipboard operation
torch-ngp copied to clipboard

Question about depth calculation in CUDA raymarching

Open RickyYXY opened this issue 2 years ago • 0 comments

In raymarching\src\raymarching.cu, the function kernel_composite_rays_train_forward use the sum of deltas[1] to get the depth. And the deltas[1] is calculated in kernel_march_rays_train, which is deltas[1] = t - last_t. So the range of depths from kernel_composite_rays_train_forward should be [0, far-near]. But in nerf\renderer.py, the code is weights_sum, depth, image = raymarching.composite_rays_train(sigmas, rgbs, deltas, rays, T_thresh) depth = torch.clamp(depth - nears, min=0) / (fars - nears), which seems to get the wrong range finally, because after minus nears, the range becomes [-near, far-2*near]. Is this an error or do I get it wrong somewhere? Thanks!

RickyYXY avatar Nov 03 '22 16:11 RickyYXY