Skip to main content
gamedev.net
🔒 Locked

Reverse screen-coordinates

Started by esaint Feb 18, 2005 at 8:28 PM 1 replies 900+ views
Original Post
esaint
esaint
Hello! To make this simple, I need a method of reverting screen coords into world coords. That is, given a point on the screen, I need to have the origin and direction for a ray cast from that point in the camera. This ray should counter the perspective correction so that it would only look like a dot on-screen, like this, you could effectively trace the ray's first collision with a mesh. Using this method you could, given a point on the screen, retrieve the exact point in the 3D-world that is visible at this screen coordinate (if depth testing is enabled). I know enough about picking and all, and I know how to use the matrices to determine where a point in the world will end up on the screen. I am *thinking* this might be done by using the inverted perspective matrix in some kind of magic way, but if anyone has some pointers before I start the old "trial-and-error-and-google" routine, it'd be great!
There are two secrets to great programming:1. Don''t tell everything you know
esaint
esaint
Ah, thanks. I can't use it since it kinda needs to work with several APIs, but the MAN-page had some info on how to do it.
There are two secrets to great programming:1. Don''t tell everything you know

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.