Public Group

# inversing a matrix in d3d

This topic is 3460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i am reading a tut online and it says , when you inverse the viewmatrix , the result becomes the world matrix?

##### Share on other sites
No.

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 on other sites
ok , i think i understand now

##### 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 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;	GetCursorPos(&point);	HWND D3DWin = FindWindow(NULL,"Our Direct3D Program");	ScreenToClient(D3DWin,&point);	GetWindowRect(D3DWin,&rect);	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);	D3DXMATRIX invView;	D3DXMatrixInverse(&invView,0,&View);	D3DXVECTOR3 originW;	D3DXVECTOR3 dirW;	D3DXVec3TransformCoord(&originW, &origin,&invView);	D3DXVec3TransformNormal(&dirW,&dir,&invView);	D3DXVec3Normalize(&dirW,&dirW);}

can anyone tell me if i am on the right path

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633410
• Total Posts
3011723
• ### Who's Online (See full list)

There are no registered users currently online

×