Jump to content
  • Advertisement
Sign in to follow this  

3D Matrix (4x4) or (3x3) ?

This topic is 4776 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

Reading through a tutorial i learned that in 3D space the matrix math helps to represent it as x,y,z,w. That is a matrix of 4 x 4. It says that the extra W (Values 0001 at the bottom of the matrix) helps make things like movement easier to deal with and that the value of W will always be 1. But i don't understand what this additional row 4 i.e. 0001 has to do in the calculation when its value is always 1 and how it results in easier movement. what will happen if we remove row 4 making the matrix 3 x 3 and do the matrix multiplication. Any help! Row 1 - > 1 0 0 0 Row 2 - > 0 1 0 0 Row 3 - > 0 0 1 0 Row 4 - > 0 0 0 1 Thanks & Regards, Pramod

Share this post

Link to post
Share on other sites
The reason is that you can merge rotation/scaling with translation if you use a 4x4 basicly you have

? ? ? tx
? ? ? ty
? ? ? tz
0 0 0 1

doing away with it and just using a 3x3 means handling translation separatly and that's not nearly as elgant.

Share this post

Link to post
Share on other sites
Thanks for the reply. Let me take an example for addition. Let be tx=5, ty=5 and tz=5. This would add 5 to x, y and z.

Row 1 - 0 1 0 0 tx -> ( x' = x + tx )
Row 2 - 0 0 1 0 ty -> ( y' = y + ty )
Row 3 - 0 0 0 1 tz -> ( z' = z + tz )
Row 4 - 0 0 0 1

and here i got new values for x,y,z in x',y',z' after the addtion. Now what row 4 has to do here as i have already got the new required values. i am sorry i am little weak in maths!. i know that i am trying to understand something, which is difficult for me do. But it seems it would be really interesting if i understand it completely.



Share this post

Link to post
Share on other sites
Row 4 makes you matrix homogeneous.

Like: ax'' + bx' + c = 0

So your right vector would look like:

rx + ry + rz = 0

That 1 on the 4,4th element is the Homogeneous coordinate wich is W:

(g(x) - (f(x))/ W

I made this little tute in my DOS days, but it should get you some ideas.

Warning: The matrix there is Row major order unlike OpenGL which is collumn order.

Cut n' paste. :*(



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!