-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: Fix docs for get_projection_transform #1797
base: main
Are you sure you want to change the base?
fix: Fix docs for get_projection_transform #1797
Conversation
The scale_z should be positive in the K matrix. Minimal example: https://colab.research.google.com/drive/1od4ql8Y2P0d2_-JBxkLp4Yu9z_M_QRy6?usp=sharing
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
As written, I think it's still wrong. Because a few lines up on 910 it defines |
I do not agree. The provided correction is valid if the intention is to normalize Z in [-1, +1] for orthographic camera. Here are the maths. Also I wouldn't allow the user to use any other variable when K is provided as it would reduce understandability. However, I admit that I am a little bit sceptical about the original intention of this. It appears that the screen space of pytorch3d is defined as x \in [-1,+1], y \in [-1, +1] and z \in [znear, zfar]. It that case, there is no need to normalize the Z component. Hence , these variables should be set: |
Depth is being scaled to the interval [0,1] not [-1,1] . The actual screen space depth in pytorch3d is inconsistent between camera types. The object is explicitly [0,1]. |
Thanks for the info. However I can experience that there is no z-clipping in the orthographic camera rasterizer. Here is a minimal example using a very large Z translation and unnormalized z coords. https://colab.research.google.com/drive/1KjqjOC15SSG8_ZwRBbPN4yJ4H-IcvzRM?usp=sharing |
I haven't looked closely at that code. I see zbuf_min and zbuf_max are both between 1000 and 1001. When I add |
Thanks for your time and interest. Since there is no far z-clipping at all, I suggest to affect 'scale_z=1' and 'mid_z=0' in K to keep the z coordinates right handed and unnormalized. Do you agree? Note: I find it odd that z_clip_value clips for z<z_clip_value. Should it be the inverse? i.e. clip the triangles to keep [0, z_clip_value] instead of [z_clip_value, inf]? Of not, I will open a different PR to improve the z_clip_value docs. |
I don't understand your point about K. Are you suggesting a doc change or a code change? I think all there is to do is to change the doc from As described in clip.py, z_clip_value is for getting rid of things which are too close to the camera. Points with z<z_clip_value get ignored. I don't think anything is odd there. |
I don't think there's a bug in the code here. The class is not consistent with other classes on where the z is, but it doesn't matter for the rest of PyTorch3D. I think it would be best to just fix the documentation to reflect what the code does and be helpful. |
Hello, I too agree with @jeanchristopheruel that zfar clipping is not done by the rastarizer in pytorch3d. |
I also find it odd to have the option for znear clipping but not zfar clipping. Zfar clipping is a pretty common strategy to limit the rasterization work. However, I do not think this is not the right place to talk about it. I suggest you open a new issue/discussion (make sure it does not already exist). |
The scale_z should be positive in the K matrix.
Minimal example: https://colab.research.google.com/drive/1od4ql8Y2P0d2_-JBxkLp4Yu9z_M_QRy6?usp=sharing