   2d mouse coordinates into 3d coordinates
  Hi all,I have rendered a sphere using Direct3D. My problem is: I want to know 3D coordinates of a point on the sphere surface, which is pointed by mouse pointer.Any idea how to solve this, please let me know.Thanks a lot. 
  D3DXVECTOR3 vLine1,    vLine2;  D3DXVECTOR3 vectOrig1 = D3DXVECTOR3( float( iX ), float( iY ), 0.0f ),    vectOrig2 = D3DXVECTOR3( float( iX ), float( iY ), 1.0f ),    vectX1,    vectX2;  D3DXVec3Unproject( &v1,  &vectOrig1, &m_viewPort, &m_matProjection, &m_matView, &m_matWorld );  D3DXVec3Unproject( &v2,  &vectOrig2, &m_viewPort, &m_matProjection, &m_matView, &m_matWorld );  with iX,iY being Mouse pos in screen coordinates and v1,v2 being the resulting ray (two world space coordinates).   will give you a ray in world space. Calculate the intersection points with your sphere and you're there (Choose the closest intersection to the camera of course).   [edited by - Endurion on February 10, 2004 7:34:32 AM];  The DX SDK has a sample on doing this also. Look up "picking" in the SDK. 