Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

About the ray directions #12

Open
dwangxxx opened this issue Jul 8, 2020 · 3 comments
Open

About the ray directions #12

dwangxxx opened this issue Jul 8, 2020 · 3 comments

Comments

@dwangxxx
Copy link

dwangxxx commented Jul 8, 2020

May I know the ray directions derivation?
directions = torch.stack( [ (ii - width * 0.5) / focal_length, -(jj - height * 0.5) / focal_length, -torch.ones_like(ii), ], dim=-1, )
Why are the y-axis and z-axis negative? Could you give me some explanation? Thank you very much!!!

@krrish94
Copy link
Owner

Hi @dwangxxx,

Do these issues answer your question?
bmild/nerf#24
bmild/nerf#46

I'd be happy to provide more details if you have further questions

@dwangxxx
Copy link
Author

Hi @dwangxxx,

Do these issues answer your question?
bmild/nerf#24
bmild/nerf#46

I'd be happy to provide more details if you have further questions

Thanks for your reply.
I've read these answers, but I still don't understand the code. Why are the y-axis and z-axis negative? When we caculate the camera extrinsics, the world coordinate system is converted to pixel coordinate system, where the y-axis and z-axis is not negative. The ray directions is converting pixel coordinate system to world coordinate system, why are the y-axis and z-axis negative? Could you provide me more details? Thank you!

@IamMohitM
Copy link

From what I understand, this code follows OpenGL standard - where the camera is facing -z direction by standard. The y axis is positive upwards and x is positive to the right. Because in tf/torch/numpy y indexing is top to bottom, the y axis needs to be flipped as well

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants