Sign in to follow this  

inversing a matrix in d3d

Recommended Posts


The view matrix transforms points from world space to view (eye/camera) space. The inverse of the view matrix will undo that same transformation, that is, transform points from view space to world space.

Share this post

Link to post
Share on other sites
They might have meant that the inverse of the view matrix will, in general, be the world (model) matrix for the object with which the virtual camera is associated (provided there is such an object). But to simply say that 'the inverse of the view matrix is the world matrix' doesn't make much sense.

Share this post

Link to post
Share on other sites
so this is my picking function to get the cursor in to the world matrix,

void Pick(D3DXMATRIX View,D3DXMATRIX matProj)
POINT point;
RECT rect;

HWND D3DWin = FindWindow(NULL,"Our Direct3D Program");

float w = (float)rect.right;
float h = (float)rect.bottom;

float x = (2.0f*point.x/w - 1.0f) / matProj(0,0);
float y = (-2.0f*point.y/h + 1.0f) / matProj(1,1);

D3DXVECTOR3 origin(0.0f,0.0f,0.0f);
D3DXVECTOR3 dir(x,y,1.0f);


D3DXVECTOR3 originW;
D3DXVec3TransformCoord(&originW, &origin,&invView);


can anyone tell me if i am on the right path

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this