nerf icon indicating copy to clipboard operation
nerf copied to clipboard

dists = dists * tf.linalg.norm(rays_d[..., None, :], axis=-1)

Open shuochen365 opened this issue 3 years ago • 5 comments

Hi,

Why multiply each distance by the norm of the light in its corresponding direction to convert it into a real-world distance?

dists = dists * tf.linalg.norm(rays_d[..., None, :], axis=-1)

Can you explain the principle behind it?

Thanks.

shuochen365 avatar Jun 09 '21 09:06 shuochen365

There is an explanatory diagram I've plotted. I'm not 100% sure it's a correct explanation, but this is how I understand it: image

oOXpycTOo avatar Jul 20 '21 22:07 oOXpycTOo

There is an explanatory diagram I've plotted. I'm not 100% sure it's a correct explanation, but this is how I understand it: image

I think it is correct.

city19992 avatar May 30 '22 06:05 city19992

Hi,

I think the norm should multiply the ray_d before it adds with ray_o, which seems more reasonable.

kunkun0w0 avatar Jul 01 '22 06:07 kunkun0w0

dists are relative to the direction vector size. So for example, those 3 cases are exactly same for a given ray:

  • ray direction = (1, 2, 3), dist = 5
  • ray direction = (2, 4, 6), dist = 2.5
  • ray direction = (5, 10, 15), dist = 1

To normalize the dists to a unit-vector length, this normalization is performed

Hugstar avatar Oct 18 '22 19:10 Hugstar

I think we can refer to the sample point generation process to understand the principle . pts = rays_o[..., None, :] + rays_d[..., None, :] * z_vals[..., :, None] and the input of dists is sub by z_vals

adaxun avatar Apr 02 '23 10:04 adaxun