I am essentially trying to solve the classic problem of converting from screen space back to view space. I have done significant research on this, and have looked over all the similar topics on here, but I am still unable to make progress on this. Say I have a point (0,0,0) in world space. When I click on this point in screen space with my cursor, it should read (0,0,0), and this is the problem, I am getting some other values like (1, 7, 100).
My strategy is the following:
- Convert Mouse Positions to NDC
- Obtain inverse of (Projection * View) matrix
- Multiply 1 and 2 to obtain a resultant vector which gives me a result in homogeneous coordinates
- Take the resultant vector and divide by the weight component
I feel that my issue is in step 1, I am unsure how to get the z value for NDC, I have just set it as 1.0 for now.
I would appreciate any help with this.