FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Kind of Stupid 3D Graphics Question.

   
Author Topic: Kind of Stupid 3D Graphics Question.
ricree101
Member
Member # 7749

 - posted      Profile for ricree101   Email ricree101         Edit/Delete Post 
Does anyone know how to translate a given point on the screen into the place on a plane where it intersects?

I'm trying to take the mouse position and figure out where it intersects with the Y=0 plane.

My understanding of things is that given a particular field of view angle, the screen would range from -angle/2 to +angle/2, and each point in the viewing area would progress linearly from those two extremes.

I would then use the angles formed by this to make a new vector which would be added to the vector in the direction the camera is pointed. Between this vector and the point the camera is located, it should be easy to find the intersection I want.

Is my understanding of this correct?

Posts: 2437 | Registered: Apr 2005  |  IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
In OpenGL there is a simple way to do this with the gluUnProject method. In DirectX I know nothing.

Your manual method would probably work too (why don't you just code it and see?) but beware of the general case; your camera might be parallel to the Y plane.

Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
Depends if you want to do it mathematically or geometrically.

Mathematically, there exists a "view transform" that transforms world objects in to screen coordinates. You can use this transformation against to either (1) transform a 3D point to the 2D screen to see if it's in the viewing frustrum, or (2) transform a screen coordinate in to a ray heading straight out in to the world down that specific screen pixel.

Geometrically, your assumption of linear progression is technically incorrect because that linear progression would take place following a curve. It's really hard to envision using geometry because all geometric representations assume that the starting viewpoint is a single point in space, not a rectangular viewing area like the screen. There's a way to do it, but I can't recall it right now.

Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
ricree101
Member
Member # 7749

 - posted      Profile for ricree101   Email ricree101         Edit/Delete Post 
First off, thanks for replying so soon.

KOM:
I tried coding it before I asked the question and it doesn't work. I'm trying to figure out whether or not I have the general idea correct before I spend a ton more time trying to get it to work. By the way, I'm using managed DirectX.


Nighthawk:
I know that it is from a single point. What I am trying to do is use the screen coordinates as an offset angle from the vector along which the camera is pointing. So when I say a linear progression, I mean a linear progression of angles, not actual coordinates on the plane.

Posts: 2437 | Registered: Apr 2005  |  IP: Logged | Report this post to a Moderator
Kwea
Member
Member # 2199

 - posted      Profile for Kwea   Email Kwea         Edit/Delete Post 
Ogg like food. Food good.
Posts: 15082 | Registered: Jul 2001  |  IP: Logged | Report this post to a Moderator
ricree101
Member
Member # 7749

 - posted      Profile for ricree101   Email ricree101         Edit/Delete Post 
Indeed. Thanks for the bump, I suppose.
Posts: 2437 | Registered: Apr 2005  |  IP: Logged | Report this post to a Moderator
HollowEarth
Member
Member # 2586

 - posted      Profile for HollowEarth   Email HollowEarth         Edit/Delete Post 
da da da this sounds like a job for... the library.
Posts: 1621 | Registered: Oct 2001  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2