views:

412

answers:

2

I'm starting to learn about 3D rendering and I've been making good progress. I've picked up a lot regarding matrices and the general operations that can be performed on them.

One thing I'm still not quite following is OpenGL's use of matrices. I see this (and things like it) quite a lot:

x y z n
-------
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

So my best understanding, is that it is a normalized (no magnitude) 4 dimensional, column-major matrix. Also that this matrix in particular is called the "identity matrix".

Some questions:

  • What is the "nth" dimension?
  • How and when are these applied?

My biggest confusion arises from how OpenGL makes use of this kind of data.

+11  A: 
KennyTM
I wish I could understand your examples, but I'm not really getting it. I apologize.
Omega
@ Omega This section of the OpenGL Red Book might help http://www.glprogramming.com/red/appendixf.html#name1
Swiss
@Omega Maybe the basics are usefull too [http://en.wikipedia.org/wiki/Matrix_multiplication].
Luca
Bit by bit I'm getting it. Bear in mind, I'm also having to understand the OpenGL implementation.I think I get that OpenGL uses matrices as a base data type to define various transformations. It seems like a lot of the functions in the API are there to generate these matrices. Regardless, I've definitely been boning up on the various arithmetic operations you can perform on them.
Omega
A: 

The short answer that might help you get started is that the 'nth' dimension, as you call it, does not represent any visualizable quantity. It is added as a practical tool to enable matrix multiplications that cause translation and perspective projection. An intuitive 3x3 matrix cannot do those things.

A 3d value representing a point in space always gets 1 appended as the fourth value to make this trick work. A 3d value representing a direction (i.e. a normal, if you are familiar with that term) gets 0 appended in the fourth spot.

Alan