Changes between Version 13 and Version 14 of MousePicking

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

--

Legend:

Unmodified
Added
Removed
Modified
  • MousePicking

    v13 v14  
    238238}}} 
    239239 
    240 == Viewspace to Modelspace == 
     240=== Viewspace to Modelspace === 
    241241 
    242242Finally we just need to go from view coordinates to world coordinates by multiplying the view coordinates against the inverse of the modelview matrix.  Again we can avoid doing a true inverse if we just 
    303303\end{eqnarray*} 
    304304}}} 
     305 
     306However, there's a trick we can use to skip the above altogether.  Setting '''v'''_''w'' to 0 in the view to world transformation right before the inverse modelview transformation ensures any translation components are removed.  This means we'll be taking a ray in view coordinates and getting a ray back in world coordinates.  Of course this is only relevant if we're trying to compute a pick ray instead of back projecting an actual point in space. 
     307 
     308== Picking == 
     309 
     310We should now have one of two things: either an actual point in world space corresponding to the location of the mouse click, or a world space ray representing the direction of the mouse click.   
     311 
     312If we have an actual point we can search against all geometry in the world and see which piece it's closest to.  If we have the ray, then we'll need to perform an intersection test between the ray and the world geometry and find the geometry closest to the near Z clip plane. Either method should be reasonably simple to implement. 
     313 
     314== Conclusion == 
     315 
     316Picking objects in a 3D scene using a mouse is a common task, but there are very few papers that describe pragmatic approaches to accomplishing this.  Hopefully this paper helps someone trying to 
     317muddle through this on their own, God knows I could have used it a few weeks ago. 
     318 
     319== Greets == 
     320 
     321A shout out and greets to my boys Casey Muratori and Nicholas Vining for helping me sort through this shit and hopefully not sounding like a dumbass.  Yo.