-
Notifications
You must be signed in to change notification settings - Fork 14
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
correct 4x4 projection matrix? #5
Comments
Thank you for your support, this issue is valuable. The parameters of the perspective projection camera we use are: I completely agree with what you said about the 4x4 projection matrix being fundamental to some rendering calculations. I believe you can find the process you mentioned in /util/nv_diffrast.py, which is the calculation method for transforming homogenous 3D points However, in model/recon.py, the purpose of |
I tried various 4x4 matrices from these values (focal=1015, znear=5, zfar=15), but none of them match the same result as your code.
for the processor it's nanoseconds, for the programmer and those who will use the repo it's a headache. |
I believe you can directly refer to /util/nv_diffrast.py to get the result you want. The camera parameters have also been verified by using PyTorch3D. Let me explain further: Starting from line 442 of model/recon.py, we assume the homogenous 3D point Invert the z direction of Homogenize the coordinates: Finally, the coordinate in ndc space is converted to the image plane: You will find that this result is consistent with the result obtained using I believe the above process is detailed enough and hope it helps you. The cause of your incorrect results could be due to some axis inversions (such as the common y-flip in images). This is likely because of different coordinate system definitions used in different rendering methods. Usually, you just need to visualize the results and check the steps where inversion is needed. |
@wang-zidu Hi, thanks for your excellent work. I wonder if this work supports CPU inference. I'm trying to use cpu device but get an error with nvdiffrast (RasterizeCudaContext could not use cpu device) |
Thank you for your feedback. nvdiffrast can be replaced with a simpler renderer such as face3d. You can try replacing it, or if you only need the mesh results, you can simply remove the corresponding nvdiffrast content. If I have time, I will address this request as soon as possible and let you know. |
Thank you for your support and patience. We have updated a new fast CPU renderer (based on face3d). Now the entire work supports CPU inference (using RetinaFace for face box). |
Did you figure out how to ‘export’ the camera in a way that can be imported to a 3D DCC? |
currently projection matrix is 3x3
and when the point is transformed, Z is discarded
which is not sutiable for standard graphics transformations like in opengl
can you provide correct 4x4 projection matrix in order to transform homogenous 3D points (x,y,z,1.0) ?
The text was updated successfully, but these errors were encountered: