Matrices In 3D Graphics?

How exactly are they important for 3D graphics? I read over a chaptre in “OpenGL Game Programming” about the 3D graphics theory, and matrices were talked about a lot…but I’m really not sure how you’d use a matrix to make/manipulate/whatever 3D graphics.

…And I really have no clue how you’d declare or initialize your own matrix variable. Can someone ellaborate a little bit on this?

Hi !

Many times you don’t need to use any matrices when you develop OpenGL software, you just use glTranslate/glScale/glRotate and OpenGL will handle the matrix setup for you.

But it is a good idea to have some knowledge of how matrices work, it makes it easier to understand how OpenGL works, there are lots of tutorials on matrices, just make a quick search on google and you should get lots of ideas (search for “opengl matrix tutorial” for example).

Mikael

matrices are kind of like a compact way to represent transformations, scales, rotations, translations, etc in a space.
The simplest kind of matrix is a 1xN which is a vector (1x3 or 3x1 is a 3d vector).

Inside them are vectors, and there are two ways to represent a matrix, either as rows or columns. It’s important to understand that if you go to some other 3D system but for OpenGL it uses columns. To go to rows from columns or vice versa you do a transpose of the matrix.

In computer graphics they use affine matrices which are 4x4. To explain the math is complicated. But by using 4 dimensions it is possible to also do translation and move it to another point (in your world).

They aren’t really magic at all just a very compact way to express these things. However understanding the theory behind them is voodoo; but they are not hard to understand how to use them.

If you want a practical introduction the book 3D Math Primer by Ian Parberry is really good and will help you understand them.

Originally posted by OpenGL dude:
If you want a practical introduction the book 3D Math Primer by Ian Parberry is really good and will help you understand them.

Real Time Rendering is the best book I’ve ever read about and I raccomand it.

About matrices, you can work without them 99% of the time. Sometimes you cannot (Vertex programs for example). I heard matrices rock for skeletral animation but from what I know about it, I don’t see those advantages.