I want to get Screen Position from World Position in DirectX.
I can get my ball’s world position. But I can’t know how can I convert it to screen position.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have a view/eye transform V (the one that “places” your “camera”) and a projection transform P.
Clip space coordinates are reached by
From clip space you reach NDC space by dividing the clip space coordinates by the 4th clip space coordinate w, i.e.
The viewport XY coordinates are then reached by mapping the range [-1,1] to the viewport dimensions. The difference between OpenGL and DirectX is, that in OpenGL the depth range [-1,1] is mapped to [0, DEPTH_BUFFER_RESOLUTION], while in DirectX it’s the depth range [0, 1] that maps to the depth buffer value range.