Deciphering OpenGL's ModelView Matrix

Grr…sorry everyone about the messed up formatting in the above post, It looked nice before i sent it All of my spaces were yanked out, I hope you can still follow it…

-Spline

So, as I suspected but wasn’t sure, you’re saying that the 0,0,0,1 part of the matrix is just there so it’ll multiply properly but doesn’t hold useful information for anything as far as determining things such as an object’s orientation in the universe etc.? So will this row of values always be 0,0,0,1? Will there EVER be a need to check these values or do we simply not care about them at all?

[This message has been edited by Punchey (edited 12-05-2000).]

If we got
1000
0100
0010
0001
That is the idenity matrix.
Now, the last coloum [0,0,0,1] is only used for operations that require shear, shrink, and stuff like that. So normally, that coloum is not used.
the first row is Xx,Xy,Xz, 2nd is Yx,Yy,Yz, and 3rd is Zx,Zy,Zz. the 4th row is the local coordinates that I said above.
So in effect, you have:
Xx Xy Xz 0
Yx Yy Yz 0
Zx Zy Zz 0
lx ly lz 1
and if you have scale/shrink/shear whatever, that is the last coloum.

I think that is correct anyway.

Okay, that sounds like what I’ve heard before about the 1 ([15]) being a scalar value. So for the purposes of selecting intuitive names for the members of a structure like Nutty created, does anyone know the actual functions of the elements in that last row? Or in other words, instead of just calling each element something like “pad1”, what would be an appropriate and intuitive name to give them that would correspond to their meaning?

The last row is the local coords of the object.
so you can call it localX localY localZ or whatever.

(of course, I didn’t really check all this out yet, I am going by memory. Someone do a qucik program that starts a object at 0,0,0, and translate it to 10,-4,3, then dump the matrix, and see what the values are. )

I would think that pad1, pad2, etc. would be pretty appropriate names considering the last column is mostly just padding to make a 4x4 matrix.

If you took an identity matrix and did translate 10, 5, 2 on it. The last row would be 10, 5, 2, 1.

The first 3 elements being the new position.

Nutty

Originally posted by Nutty:
[b]If you took an identity matrix and did translate 10, 5, 2 on it. The last row would be 10, 5, 2, 1.

The first 3 elements being the new position.

Nutty[/b]

So, you’re saying that [3],[7],[11] and [15] would be 10, 5, 2 and 1 respectively? If so, then I’m guessing that [15] never changes? I thought that [12],[13] and [14] gave the “position” of the “center” of the matrix. Like if you were using the matrix to keep track of the location of the object, [12],[13] and [14] would give you the location of that object. Is this right? And if so, then what is [3],[7] and [11]? The change perhaps?

No, I said the last ROW would be 10, 5, 2, 1.
Which is elements 12, 13, and 14.

Elements 3, 7, 11, and 15 are the last COLUMN. 3, 7 and 11 are the scale of the object I think, and element 15 is always 1, and doesn’t do anything I believe.

Elements 12, 13, and 14 do give you the position yes, they map into the X Y and Z of the position vector if you use the structure I mentioned.

hope that clears it up.

Nutty

Originally posted by Nutty:
[b]
Elements 3, 7, 11, and 15 are the last COLUMN. 3, 7 and 11 are the scale of the object I think, and element 15 is always 1, and doesn’t do anything I believe.

[/b]

Actually, the scale is done in the middle of the matrix, not the last row. The resulting matrix from scaling everything in an identity matrix by 2 would be this…

2 0 0 0
0 2 0 0
0 0 2 0
0 0 0 1

3, 7, 11 should be 0 in most cases. I don’t know offhand of anything that would cause the last column to be different, but I’m not really an expert either.

Ahh right…
so I guess if I wanted to scale the object in it’s local X axis by 2, I could scale it’s right vector (from the matrix) by 2.

Thats makes sense.

So the last column does nothing at all then?

Nutty

Ok, so the last coloum is not scale, but I know it has to do with shear, and the like… argh. Where did I put the .doc that had all this in it?