Skip to content
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

Multiply the distance by the norm of direction #17

Closed
dichen-cd opened this issue Aug 6, 2021 · 2 comments
Closed

Multiply the distance by the norm of direction #17

dichen-cd opened this issue Aug 6, 2021 · 2 comments

Comments

@dichen-cd
Copy link

Hi there, thanks for sharing the code!

When computing the distances of samples during rendering, some open sourced codes such as nerf_pl and mip-nerf multiplies the distances with the norms of direction. Seems like there's no such operation in this repo. (volume_op.py#L191) Could you give any hint on the difference?

@ziruiw-dev
Copy link
Collaborator

ziruiw-dev commented Aug 19, 2021

Hi @DeanChan,

Sorry for the late reply.

Good catch, we do not have this multiplication in our code.

If you print the output of torch.norm(ray_dir_world, dim=-1), you can see that the magnitudes of direction vectors are all very close to 2.0. So we omit this multiplication, which in this case is just multiplying a constant with the dists and has very little effect on training.

These magnitudes ~ 2.0 is the result of using NDC, so this omission is fine in forward-facing scenes.

If you switch off NDC by setting --use_ndc=False, you can see that the variation of the magnitudes of all direction vectors is slightly larger, i.e. from 1.0 to 1.3 or so, depending on the camera FOV. That being said, if you want to apply it to non-forward-facing scenes, you probably want to add this multiplication (dist = dist * norm) back. However, we do not observe a big difference with or without this multiplication even in non-forward-facing scenes.

Best,
Zirui

@dichen-cd
Copy link
Author

Hi @ziruiw-dev , thank you for your reply. It is really helpful!

I've got similar findings through my own scenes that multiply the dist norm or not does not show any significant difference.

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