#### Archived

This topic is now archived and is closed to further replies.

# Transfering world matrix from 3d modeler to DX app

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

## Recommended Posts

I''m just starting to write a new DX8 engine, and I''m wondering what methods people use to find out the proper world transformation matrix for a model. I''ve found some of the basic models I''ve made have seemingly arbitrary matrices. For instance, the tiny.x model that comes with the SDK requires...
	D3DXMatrixRotationX( &g_WorldMat, -1.4f );
D3DXMATRIX mat;
D3DXMatrixRotationY( &mat, -D3DX_PI );
D3DXMatrixMultiply( &g_WorldMat, &g_WorldMat, &mat );
D3DXMatrixScaling( &mat, 0.005f, 0.005f, 0.005f );
D3DXMatrixMultiply( &g_WorldMat, &g_WorldMat, &mat );

in order to look right. How are you suposed to figure that out?! besides trial and error.

##### Share on other sites
I had the exact same problem. Here''s what I do (it''s basically guess and check for the first model, then easier for all subsequent models):
1) Model something using my modelling software. This something will be my reference object. Ensure that the reference object is on the origin. If it''s not on the origin, it will be hard to find in the D3D program.
2) Import the reference object into my application, ensuring that it appears on top of the origin. (Apply no transformations.)
3) Point the camera at the origin.
4) Scale the object using crude keyboard commands (''z'' for scale up by 10%, "x" for scale down 10%) until the object is the right size on the screen.
5) Count how many times I scaled the object.
6) Scale the reference object to the correct size in the modelling software.
7) Whenever I have to model something else in the modelling software, I also load the reference model to make sure everything is the right size and is pointing in the same direction.

An alternative is to simply move the camera using crude/hacked commands. Just make sure you have some way of recording the camera''s location and direction (use the debugger.) This method is much harder, as often you''ll move the camera all around, only to discover that you can''t find the object! Or that the object is outside of the camera''s viewing frustrum and thus is not being rendered.

Alexander "DmGoober" Jhin
alexjh@online.microsoft.com
[Warning! This email account is not attended. All comments are the opinions of an individual employee and are not representative of Microsoft Corporation.]

• ### Forum Statistics

• Total Topics
628645
• Total Posts
2984021

• 9
• 9
• 10
• 21
• 20