Jump to content
  • Advertisement

Archived

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

PRISMA

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!