I''m not sure whether or not this is OGL specific, but what do each of the numbers in the modelview matrix stand for?

# MODELVIEW matrix

Started by masonium, Oct 21 2001 05:10 AM

2 replies to this topic

Sponsor:

###
#2
Members - Reputation: **122**

Posted 21 October 2001 - 07:36 AM

Well they could represent anything! Most of the time the modelview matrix will contain a matrix concatenation of the object''s local-to-world matrix and the world-to-camera matrix. The latter is simply the inverse of the camera-to-world matrix.

Now if your matrix math isn''t that good, here''s a tiny crashcourse. In OpenGL, a matrix is defined by an array of 16 numbers representing a 4x4 matrix like this:

Now assume that this matrix contains an object''s local-to-world matrix. I''m assuming that the matrix contains only rotation and position, nothing fancy like scaling, shearing, etc.

The upperleft 3x3 matrix then contains what is called the object''s rotation matrix:

The numbers at 0,1,2 represent the x,y,z components of the object''s rotated X-axis.

The numbers at 4,5,6 represent the x,y,z components of the object''s rotated Y-axis.

The numbers at 8,9,10 represent the x,y,z components of the object''s rotated Z-axis.

The numbers at 12,13,14 represent the x,y,z components of the object''s location in world-space.

Did that make some sense?

Now if your matrix math isn''t that good, here''s a tiny crashcourse. In OpenGL, a matrix is defined by an array of 16 numbers representing a 4x4 matrix like this:

0 4 8 12

1 5 9 13

2 6 10 14

3 7 11 15

Now assume that this matrix contains an object''s local-to-world matrix. I''m assuming that the matrix contains only rotation and position, nothing fancy like scaling, shearing, etc.

The upperleft 3x3 matrix then contains what is called the object''s rotation matrix:

The numbers at 0,1,2 represent the x,y,z components of the object''s rotated X-axis.

The numbers at 4,5,6 represent the x,y,z components of the object''s rotated Y-axis.

The numbers at 8,9,10 represent the x,y,z components of the object''s rotated Z-axis.

The numbers at 12,13,14 represent the x,y,z components of the object''s location in world-space.

Did that make some sense?

###
#3
Members - Reputation: **171**

Posted 21 October 2001 - 11:55 AM

More specifically, the modelview matrix defines a linear transformation between object space and eye space.

Each Row in the matrix(since opengl uses column major) defines a basis vector for eye space. The basis vectors for object space are (1,0,0,0), (0,1,0,0), (0,0,1,0) and (0,0,0,1).

Thus your coordinates get transformed from object space to eye space.

Each Row in the matrix(since opengl uses column major) defines a basis vector for eye space. The basis vectors for object space are (1,0,0,0), (0,1,0,0), (0,0,1,0) and (0,0,0,1).

Thus your coordinates get transformed from object space to eye space.