FireSoul 114 Report post Posted September 7, 2005 Hi, i have been working with matrices for a while now, and i think i am beginning to understand them a lot better, but i have a problem with understanding the individual parts to a matrix. The specific parts i am refering to are, basically, what does each row/column of a matrix represent. From debugging i have found out that _41, _42, _43 are the position coordinates in world space (unless im wrong). The reason why i am asking this is so that i can transform a normal vector(just a line or a shape) from world to model space and back again. Specifically, the mathematics behind this (ie. what parts of my existing vector do you multiply/add with what parts of a matrix). A simple formula used for transforming a D3DXVECTOR3 using a 4x4 Matrix would be much appreciated. Thanks for any replies. 0 Share this post Link to post Share on other sites
frecco2k 164 Report post Posted September 7, 2005 try this one out: Matrix FAQ//Fredrik 0 Share this post Link to post Share on other sites
mdias 823 Report post Posted September 7, 2005 I don't know how to explain but here is the formula:x = vector.x*matrix[0][0] + vector.y*matrix[0][1] + vector.z*matrix[0][2] + matrix[0][3];y = vector.x*matrix[1][0] + vector.y*matrix[1][1] + vector.z*matrix[1][2] + matrix[1][3];z = vector.x*matrix[2][0] + vector.y*matrix[2][1] + vector.z*matrix[2][2] + matrix[2][3]; 0 Share this post Link to post Share on other sites
chadmv 645 Report post Posted September 7, 2005 There's a page on MSDN that talks about transforms. You might find a nice explanation there. 0 Share this post Link to post Share on other sites
Armadon 1091 Report post Posted September 7, 2005 Hi there FireSoul,How are you doing buddy?The ProblemUnderstanding matrices and transformations.The SolutionObject Space : This is where your vertices are defined for your objectWorld Space : This locates your object in world space... the world that you work with. We go here from object space using a world transformation matrixView Space : Locates your camera in space and relocates your objects around your camera, we go here from world space using a view transformation matrix.Clip Space : This space basically clips your view frustum into a cube. Which gives the impression of perspective/depth etc.. We go here from view space using a projection transformation matrix.Matrices are nice since we can jam alot of information in them.Translation matrix (Movement)1 0 0 00 1 0 00 0 1 0x y z 1and so forth...I would suggest reading this part of the DirectX SDKIt explains the transformations very well and how some of the math works.Also, With regard to your second question.You want to transform a normal vector from world to model space. This is done using an inverse world transformation matrix. You could use the D3DXMatrixInverse Function and transform the vector by the resulting matrix using D3DXVec3Transform. Also if you want to transform a vector from model space to world space you could just transform the vector by the world transformation matrix.I hope this helps a bit buddy. Take care. If you have any more questions. Please do not hestitate to ask. 0 Share this post Link to post Share on other sites
ryt 294 Report post Posted September 7, 2005 the Directx matrix:| Xx Yx Zx 0 | | Xy Yy Zy 0 | | Xz Yz Zz 0 | | pX pY pZ 1 | pX,pY,pZ is position in world space.Xx,Xy,Yx,Zy..... is how jour object will look in world space, if u put Xx=1, Yy=1,Zz=1 and others 0, u will get the same object as jour object in local space, try to manipulate these to get cool effects. 0 Share this post Link to post Share on other sites