I want to know how to transfer a point in the world coordinate system to screen coordinates. I wrote an API myself and found that the x-axis coordinates are always several tens of pixels apart. I don't know why, the y-screen coordinates can be aligned, and the depth cache is also acceptable #6906
Replies: 1 comment
-
Each pixel in 2D corresponds with a line in 3D that connects a point in the near plane to a point in the far plane, so to get a 3D point from a 2D pixel, you'll need a depth value as well.
You give it the inverse view projection matrix and the 2D point in clip space (-1..1 coordinates for both X, Y and Z (depth)). It will calculate the 3D coords in the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to know how to transfer a point in the world coordinate system to screen coordinates. I wrote an API myself and found that the x-axis coordinates are always several tens of pixels apart. I don't know why, the y-screen coordinates can be aligned, and the depth cache is also acceptable


this is test result:
Actually, my fundamental requirement is how to convert screen coordinates into world coordinate system coordinates. That is to implement a API named: mouse_ To_ 3D
Forgive me for not being able to copy the code because it cannot be copied, you understand。
Thanks
Beta Was this translation helpful? Give feedback.
All reactions