• Advertisement
Sign in to follow this  

bottom row of 4x4 matrix

This topic is 4666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could someone please tell me when the bottom row of a 4x4 matrix will not equal: 0 0 0 1 I know there must be instances when this is the case or you wouldn't have to normalize x, y, and z by dividing by w. However, I thought scaling and rotation only affect the first 3x3, and translation only affects the top 3 in the last column. Mike C. http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites
Advertisement
In all isometric tranformations it will be 0001. Same with scaling each coordinate. Generally: in all linear 3D transformations + offsets.

When you do need to perform some other operations apart from multiplying and adding, as matrix/vector operations only do that, you do need to accumulate some info in w vector coordinate, to explicilty do something with it later (divide xyz/w, for example).

This is used in non-orthographic projections, for example.
Check out how it looks, in gl reference documentaiton.
/def

Share this post


Link to post
Share on other sites
What do you mean by isometric transformations?

I'm using OpenGL for a skeletal animation system, and I'm just doing scaling, rotation, and translation. The w coord is not equal to 1.

I did have a call to gluPerspective. Could that change it?

Right now, I'm getting the absolute value of a point like so:

GLfloat matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
newpoint.x = matrix[12]/matrix[15];
newpoint.y = matrix[13]/matrix[15];
newpoint.z = matrix[14]/matrix[15];

If I take out the /matrix[15], it doesn't work right.

Mike C.
http://www.coolgroups.com/zoomer/

Quote:
Original post by deffer
In all isometric tranformations it will be 0001. Same with scaling each coordinate. Generally: in all linear 3D transformations + offsets.

When you do need to perform some other operations apart from multiplying and adding, as matrix/vector operations only do that, you do need to accumulate some info in w vector coordinate, to explicilty do something with it later (divide xyz/w, for example).

This is used in non-orthographic projections, for example.
Check out how it looks, in gl reference documentaiton.
/def


Share this post


Link to post
Share on other sites
Quote:
Original post by mike74
What do you mean by isometric transformations?

By definition - transformations saving distances between points.
dist(p,q) == dist(f(p),f(q))
So translations and rotations are ok.

Quote:
I'm using OpenGL for a skeletal animation system, and I'm just doing scaling, rotation, and translation.

And that should suffice, skeletal animation consists only of linear transformations.

Quote:
The w coord is not equal to 1.

'w' coord of... what? vector after transformations? Matrix column?

Quote:
I did have a call to gluPerspective. Could that change it?

You should not normally use perspective transformations for anything other than rendering. IOW don't touch the result on GL_PROJECTION matrix stack.
If you called gluPerspective while having GL_MODELVIEW active, it will most likely cause a disaster. In other cases, you should not be directly concerned about 'w' coordinate at all.

Quote:

Right now, I'm getting the absolute value of a point like so:

GLfloat matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
newpoint.x = matrix[12]/matrix[15];
newpoint.y = matrix[13]/matrix[15];
newpoint.z = matrix[14]/matrix[15];

If I take out the /matrix[15], it doesn't work right.


So what is this all for afterall?

Share this post


Link to post
Share on other sites
By w coordinate, I mean the fourth element of the point vector, which is usually 1. So, does scaling affect the bottom row of the 4x4 matrix? Scaling does not seem to be an isometric transform but you implied it didn't affect the bottom row.

Mike C.
http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites
Scaling is a linear transform. All linear transformations in 3D can be expressed using only 3x3 matrices. The rest part is obsolete then, thus is set to identity values.
Translation is not linear, but it's isometric, so doesn't affect the bottom row either.

Share this post


Link to post
Share on other sites
Well, does a concatenation of scaling, translation, and rotation affect the bottom row? I still don't see when it's affected.

Mike C.
http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites
Take two matrices with botom row 0001 and multiply them. See what happens.

Quote:
original post by mike74
I still don't see when it's affected.

Why don't you simply debug your program? Usually all becomes clear then...

Share this post


Link to post
Share on other sites
Here's my matrix before calling gluPerspective(90.0f,1 ,0.1f,100.0f):

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

Here is it afterwards:

1 0 0 0
0 1 0 0
0 0 -1.002002 -0.200200
0 0 -1 0

Should gluPerspective be doing this weirdness to my matrix?

Mike C.
http://www.coolgroups.com/zoomer

Share this post


Link to post
Share on other sites
By isometric transforms deffer means that your matrix should be normalized as well as having the 3 axes orthogonal to each other.

Calling gluPerspective would not make your homogeneous(w) coord negative. Why it does that to you, I have no idea.
gluPerspective does this (I think ;*))

1. Subtract view from pos to get the inverse forward vec
2. Cross Up and forward to get the right vector
3. Normalize all the vectors
4. Fill the transpose of the object matrix, thereby making a camera matrix
5. Translate with negative translation

So basically deffer is right in saying that the matrix should be isotropic and would not affect your bottom row.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement