#### Archived

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

# D3D Transformation Maths

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

## Recommended Posts

Hey, I have been trying for a while now to manually transform a vertex using the matrices returnd by D3D> To make it a bit more clear, here''s what I am currently doing (PSEUDO CODE): vertex v = vertex to transform matWorld = GetWorldMatrix matView = GetViewMatrix matProj = GetProjMatrix //Concatenate the 3 matrices matWorldView = matWorld * matView matTrans = matWorldView * matProj //Build a 4x1 matrix that represents the vertex mat4x1 = (v.x, v.y, v.z, 1) //Apply transformation to the 4x1 matrix matRes = mat4x1 * matTrans Well, you wont be surprised to know that the above doesn''t work! (otherwise why would I be here ) So what I am wondering, is if anyone could help me, because I finally give up trying to solve it, after a few days of stepping though the code and watching variables! Where am i going wrong? Thank in advance for any help you might be able to give me.

##### Share on other sites
Could it be that you forget to convert from homogenous coordinates back to normal 3D coordinates?

D3DVECTOR V;

V.x = matRes[0]/matRes[3];
V.y = matRes[1]/matRes[3];
V.z = matRes[2]/matRes[3];

Other than that I can''t see anything wrong with your code.

WitchLord

• 10
• 34
• 29
• 9
• 15