Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using a 3d game engine, that uses a 4x4 matrix to modify the camera projection.

The matrix is in the regular 4x4 format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

The description for the matrix class says:

A transformation matrix. Matrices are pre-multiplication, as in: x' = M*x.

What does this mean?

share|improve this question
    
There is no regular 4x4 matrix format, only row- and column-major form. Your example is in column-major form, as used for instance in OpenGL. –  Maik Semder Jan 14 '12 at 16:41
    
Check this link. It's explained in detail: scratchapixel.com/lessons/3d-basic-lessons/lesson-4-geometry/… –  user14697 Mar 24 '12 at 23:05

2 Answers 2

up vote 5 down vote accepted

It's not saying the matrices are pre-multiplied but rather that they are (read use) pre-multiplication.

This basically specifies the correct order of multiplication when using them, such that when multiplying a matrix by a vector, the matrix needs comes first.

In other words, this:

result = matrix * vector

Instead of:

result = vector * matrix
share|improve this answer

Pre- or post-multiplication just defines the order of operations how the member of that matrix and vector are multiplied, its purely a notational convention.

The common operations in 3D graphics are post-multiplying a row-vector with column-major matrices (OpenGL) and pre-multiplying a column-vector with row-major matrices (DirectX).

Both are basically the same operations with the same results, just the notational convention is different.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.