Matrix Stacks

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

Recommended Posts

I've read in a couple of tutorials about how matrix stacks work, and one thing keeps annoying me: According to what I understood from the tutorials, I need one matrix stack per one "complex object", But I can't figure out a way not to use 2 matrix stacks: one for rotations (and scales), and one for translations. If I use one matrix stack containing world transformations for each part of the object, then the rotation will make the translations a total mess. So, should I use 2 or is there a way to make it work with only 1?

Share on other sites
The 4x4 matrix you use for the object IS the scale, translation, shear, etc...
If you want to rotate your object you would have to modify the current matrix.
You don't need to store multiple matrices to do this, you can have general methods which operate on a current matrix.

I would like more specific information like what tutorials you were looking at and a clearer explanation on what you are trying to do.

I really suggest taking a look at this:
http://www.gamedev.net/reference/programming/features/scenegraph/

Share on other sites
Im just confused on how to render a complex model (human for example) using these matrix stacks

Share on other sites
Matrices are a mathematical representation of an object's state.
A matrix is used to define the object in some coordinate system, that which is defined by the programmer.

Under OpenGL/Direct3D this is how it works.

Example:
An object located at a point called p(2, 3, 1, 1), the last value is needed because of homogenous coordinates.
Could be stored in a row order matrix like:

[0, 0, 0, 2]
[0, 0, 0, 3]
[0, 0, 0, 1]
[0, 0, 0, 1]

Now, say that there is an object that is relative to this point, like a human arm relative to the hand.

So relative to the above point is another point in the world: P2(3, 3, 1).
This point is translated 1 unit in the x direction relative to the above point.

The matrix to represent this point is:

[0, 0, 0, 3]
[0, 0, 0, 3]
[0, 0, 0, 1]
[0, 0, 0, 1]

Multiply these matrices in the order I've mentioned to get where P2 is in the world.
However these matrices don't contain rotations or scale.

Share on other sites
Most often homogeneous matrices are used to describe transformations. Those transformations are concatenated by multiplying the matrices. Hence a multiplicative identity is needed. The identity transformation is hence the identity matrix:
1 0 0 00 1 0 00 0 1 00 0 0 1

(K_I_L_E_R's matrices aren't correct in this sense.)

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• Forum Statistics

• Total Topics
633311
• Total Posts
3011312
• Who's Online (See full list)

There are no registered users currently online

×