Changes between Version 6 and Version 7 of MousePicking

Show
Ignore:
Author:
bhook (IP: 64.207.62.170)
Timestamp:
05/18/06 13:40:04 (13 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MousePicking

    v6 v7  
    11= Mouse Picking Demystified = 
     2April 5, 2005 
     3 
     4There comes a time in every 3D game where the user needs to click on something in the scene.  Maybe he needs to select a unit in an RTS, or open a door in an RPG, or delete some geometry in a level editing tool.  This conceptually simple task is easy to screw up since there are so many little steps that can go wrong. 
     5 
     6The problem is this: ''given the mouse's position in window coordinates, how can I determine what object in the scene the user has selected with a mouse click?'' 
     7 
     8One method is to generate a ray using the mouse's location and then intersect it with the world geometry, finding the object nearest to the viewer.  Alternatively we can determine the actual 3-D location that the user has clicked on by sampling the depth buffer (giving us (''x,y,z'') in viewport space) and performing an inverse transformation. Technically there is a third approach, using a selection or object ID buffer, but this has numerous limitations that makes it impractical for widespread use. 
     9 
     10This article describes using the ''inverse transformation'' to derive world space coordinates from the mouse's position on screen.  
     11 
     12Before we worry about the inverse transformation, we need to establish how the standard forward transformation works in a typical graphics pipeline. 
    213 
    314This article is under construction!   
    617#!latex-math-hook 
    718\begin{eqnarray*} 
    8 &Model\\ &\downarrow \\ 
    9 &World\\ &\downarrow \\ 
    10 &View\\& \downarrow  \\ 
    11 &Clip\\& \downarrow  \\ 
     19&Model \\ &\downarrow \\ 
     20&World \\ &\downarrow \\ 
     21&View \\ & \downarrow  \\ 
     22&Clip \\ & \downarrow  \\ 
    1223&Normalized Device\\ &\downarrow \\ 
    1324&Viewport