Changes between Version 13 and Version 14 of MousePicking

bhook (IP:
05/18/06 20:04:33 (13 years ago)



  • MousePicking

    v13 v14  
    240 == Viewspace to Modelspace == 
     240=== Viewspace to Modelspace === 
    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 
     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. 
     308== Picking == 
     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.   
     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. 
     314== Conclusion == 
     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. 
     319== Greets == 
     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.