Why not 3x3 Matrix?

In 3D space only three coordinates are needed to define a point. However in 3D graphics everybody is using 4x4 matrices instead of 3x3. Can somebody explain the math behind this in simple terms?

1 Like

You don’t need to use matrices much in Unity because the game engine handles it all for you.

A matrix defines Position, Scale, and Rotation. With the 3x3 matrix, the 3 rows represent the 3 axis’s of the object’s transform (forward, right, up). With these transform axis’s the direction of each row gives us the rotation of the object, and the magnitude of each axis defines the scale of that axis. To define the position, we need a 4th row.

In a 4x4 matrix, the last number in each row isn’t used as often so I’m not sure how it’s useful. When performing math with matrices, if the far bottom-right element is 0, the matrix is treated as a direction and it’s position doesn’t get applied. If that value is 1, the position does get applied.

4 Likes
1 Like

in my very early journey of discovery in the world of matrices im finding it useful to look at a 4x4 matrix like so:

/*

 | right | up    | fwd   | pos   |
x| 1     | 0     | 0     | 0     |
y| 0     | 1     | 0     | 0     |
z| 0     | 0     | 1     | 0     |
w| 0     | 0     | 0     | 1     |

*/

where the first three columns describe rotation/scale, the last column describes position, and the ‘w’ row lies in the realm of dark sorcery.

Projection matrix is used to transform object’s data from Camera space to Clip space.
In the process, w factor (bottom row of the 4*4 matrix) is needed for calculation of vertex position in the perspective camera view.

As @aleksandrk says, with w, it become a homogeneous coordinates, not cartesian coordinates.