# Thread: understanding projection matrix elements

1. ## understanding projection matrix elements

after you setransform for the projection matrix, i am outputting the matrix values m_11 to m_44 and dont really understand what each value is doing in terms of projeciton

is each m_11 to m_14 = x,y,z,w
m12 to m14 = x,y,z,w
etc?,

i need to understand this to learn to change mouse 2d cords to 3d ,
rayDir.x = v1.x*m._11 + v1.y*m._21 + v1.z*m._31;
rayDir.y = v1.x*m._12 + v1.y*m._22 + v1.z*m._32;
rayDir.z = v1.x*m._13 + v1.y*m._23 + v1.z*m._33;
this formula is taxing my brain atm

2. Originally Posted by Anddos
after you setransform for the projection matrix, i am outputting the matrix values m_11 to m_44 and dont really understand what each value is doing in terms of projeciton
Each column of the projection matrix corresponds to a basis vector in a 4 dimensional space. By multiplying a vector by this matrix, you project the vector such that it is re-described in terms of a linear combination of these basis vectors, in other words, it is a change of basis. The reason the projection is four-dimensional is to allow representation of 3-D affine transforms (rotation, scale, and translation) which cannot be directly represented using a three-dimensional matrix.

This is basic linear algebra stuff, do you have a more specific question?

3. so how is rotation scaling used on projection matrix?

4. so how is rotation scaling used on projection matrix?
It's not per se. Matrices are taken as a whole and then concatenated to produce the final matrix. To understand the final transform is to understand the individual transforms that make up the final transform.