Public Group

# Transformations

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

## Recommended Posts

Hi, I don't know if this question should be placed here or in the Graphics forum, but since the topic is very basic, I preferred putting it here. I'm having difficulties developing an intuition regarding transformations. I know my linear algebra well, and I have read all about transformations in several books, but I still don't have enough intuition to fully grasp the world in means of transformations. I guess what I'm looking for is some presentation/flash/applet demonstration that will let me play or at least watch transformations as they happen. I understand that there are coordinate spaces such as model space, world space, view space - however I find it difficult to understand what should I do with this information and how it really works in terms of matrices order, for example. Suppose I am about to display a world of some kind. Now I've made one model (say a plane) for a terrain, based on a height map. I also have a building on that terrain, complete with internal details up to the chair near the desk in the 2nd floor. I also have a person, in a third model. Now I know that the person is sitting at this chair I've mentioned, and what I need to know is how do I approach this thing. I thought I had an intuition for all the transformations, but then I made some very simple tests with some planes in space and I got all confused. I searched the net but couldn't find anything of a real use. Like I said I'm looking for something very visual that might show me the transformations as they occur along with showing the matrix operations. If anybody has something like that, please let me know. Thanks, Eldad.

##### Share on other sites
I don't know of any visual tutorials such as you describe. The OpenGL Red Book has an introduction to coordinate spaces, and the book '3D Math Primer' has good coverage as well. Disregarding other transformations such as scale, shear, projection, etc., a transformation matrix usually consists of a rotation and a translation. Such a matrix can take a point or vector from one space (say, object space) to another (say, world space). Inverting the matrix will reverse the transformation, that is, it will take geometry from the latter space to the former rather than the former to the latter. And, if you have a matrix that goes from space A to space B, and a matrix that goes from space B to space C, the product (through multiplication) of those two matrices will go from space A to space C. This is referred to as concatentation and is one of the things that makes matrix representation so useful.

Couple more things. The most common spaces we're concerned with are object space, world space, and view space (in that order). You can also have nested object spaces, so in essence you can have many 'object spaces' before world space in the list I just gave. To continue with your example, you might have:

1. A chair model defined in object space, where it is axis-aligned and centered at the origin
2. A matrix A that orients and positions it in 'house space', the object space associated with a house model
3. A matrix B that orients and positions the house in world space
4. A matrix C that transforms the house model into view (camera) space

The product of the matrices A, B, and C will transform the chair directly from its local object space into view space. A potential gotcha here is the choice of row or column vector convention, as with one the product will be A*B*C, while with the other it will be C*B*A.

'Hope that helps a little.

##### Share on other sites
First of all, thanks for the answer jyk.

I thought that since I had no luck in finding some visuals, there weren't any really good ones. Maybe I oughtta do something about it with some small application, I might learn through the process as well :-)

I'll try getting it from both books you've mentioned; I think that if I got it correctly, then the 4th row or the 4th column can be used for transformation, while the 3x3 matrix stays the same for rotation, no matter what. If I use the 4th ROW, then the order is inverted, meaning CBA, and if I use the 4th COL, then the order is straight, being ABC. Is that correct?

Anyway, I'll keep playing around and see if I can understand it.

Thanks,

##### Share on other sites
wow this is some good stuff

##### Share on other sites
you probably wont find something on that , cause what your looking for is very vague , you need to put some more effort (by your self) to understand 3d geometry , "Look at something from the eye of its creator" if you were to make a 3d engine how would you do it , try making a cube and rotating or any other 3d application , you might just get what you were looking for.

##### Share on other sites
Quote:
 Original post by DadleFishI think that if I got it correctly, then the 4th row or the 4th column can be used for transformation, while the 3x3 matrix stays the same for rotation, no matter what. If I use the 4th ROW, then the order is inverted, meaning CBA, and if I use the 4th COL, then the order is straight, being ABC. Is that correct?
A couple of minor adjustments. The 4th row or column can be used for translation; 'transformation' refers to the effect of the matrix as a whole. (I'm guessing this is what you meant, and that that was just a typo.) As for the 3x3 rotation matrix, it doesn't quite stay the same, but rather is transposed depending on the choice of row or column vector convention. Also, it's the 'row' version that corresponds with ABC, and the 'column' version that corresponds with CBA, rather than the other way around.

The general ideas are correct though. (Keep in mind however that we're only considering rigid body transformations here, i.e. rotation and translation. Although these are probably the most common, there are other types of transformations as well which don't necessarily follow the above rules.)

##### Share on other sites
Code fusion - Actually I am past the rotating box thing. I have already implemented an ASE file loader, and many of the basic DX9 capabilities (blending, lighting, textures, and so on). It's just that I suddenly realized that I'm not too sure about this whole transformation issue - I know the basics but I haven't developed the intuition - Maybe I AM a bit vague, I would like to actually think about that chair-in-a-house-in-a-world-in-a-perspective-cam, and just realize all the matrix stuff that goes behind the scenes. Maybe I know enough - I just don't FEEL like it... Kinda hard to explain I guess.

jyk - Yeah, of course a typo, sorry about that - translation it is. So basically what we're saying is that the whole matrix is simply transposed according to the method being used (row- or col-importance).

Now I should really focus on the calculations order - if I understand correctly, it makes a difference if I first rotate and then translate or vice versa. But for this I won't bother you guys and just go look up some math book.

Thanks again.

##### Share on other sites
Quote:
 jyk - Yeah, of course a typo, sorry about that - translation it is. So basically what we're saying is that the whole matrix is simply transposed according to the method being used (row- or col-importance).
Yup, pretty much. Just be careful about confusing the terms row and column vector (which is what we're talking about here) with row- and column-major (which is a memory layout issue and doesn't have anything to do with the math). It's easy to get confused about this, as these terms are sometimes used incorrectly in online references.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634048
• Total Posts
3015238
×