DirectVoxGO icon indicating copy to clipboard operation
DirectVoxGO copied to clipboard

Question about the intervals in dmpigo

Open qihangGH opened this issue 1 year ago • 1 comments

Hi @sunset1995, thanks for the great work!

I have a question about the intervals in dmpigo. When sampling the points on rays, as shown by a code fragment of the function sample_ndc_pts_on_rays_cuda_kernel in render_utils_kernel.cu,

const float dist = ((float)i_step) / (N_samples-1);
const float px = rays_o[offset_r  ] + rays_d[offset_r  ] * dist;
const float py = rays_o[offset_r+1] + rays_d[offset_r+1] * dist;
const float pz = rays_o[offset_r+2] + rays_d[offset_r+2] * dist;

the sample interval is 1 / (N_samples-1) times the length of the vector rays_d. The length of rays_d varies for different rays, so the sample interval is different among rays.

When rendering a ray, the interval is interval = render_kwargs['stepsize'] * self.voxel_size_ratio as defined in the forward method of the dmpigo class. It is a constant and so the interval in the rendering is the same for all rays.

I wonder why it is inconsistent in sampling and rendering. Great appreciate it if you can give some explanations.

qihangGH avatar Jan 04 '23 15:01 qihangGH

Hi, @qihangGH.

I think the inconsistency came from the original NeRF paper & implementation; so called 'Stratified Sampling'. The original volume rendering equation explains the integral of continuous functions.

image

But we don't have a continuous function but only neural radiance fields. So, we sample some discrete points to optimize the whole continuous scene. In this manner, we try to mimic the continuous integral by adding randomness to sample points.

From original NeRF paper: image

Thank you.

sangminkim-99 avatar Jan 17 '23 09:01 sangminkim-99