Mouse pointer position to screen space

Posted by Ylisar on Game Development See other posts from Game Development or by Ylisar
Published on 2011-11-28T16:42:16Z Indexed on 2011/11/28 18:55 UTC
Read the original article Hit count: 195

Filed under:

If I have a mouse pointer position in pixels of canvas, I can easily convert it to the -1..1 range for both X & Y by lerping by dividing with canvas dimensions. However, the problem is what I should put in Z & W if I want my screen space position to be on the near plane? The step afterwards would be for me to multiply by the inverse of view-projection to take me to world space, where I easily can construct a ray from the cameras world space position.

© Game Development or respective owner

Related posts about linear-algebra