Sign in to follow this  
giugio

very beginer

Recommended Posts

I not understand the word/view/projection matrix.
I understand that is a change of geometric reference, the first problem is
1)if you multiply a point for two or three different transformation matrixes what I obtain?
what is the reference?
2)I must multiply the normals for the rotation of the world matrix? (only for the rotation , not for the translation because the normals must be normalized)
3)I see that the diffuse component is not relative to the camera position , instead the specular component is relative to the camera , what are other components that are relative to camera ?

thanks

Share this post


Link to post
Share on other sites
Since no one has replied to you for the past hour, I will try to help alittle and try my best to answer as simple as possible.

[quote]1)if you multiply a point for two or three different transformation matrixes what I obtain?
what is the reference?[/quote]

The new reference would be the [b]concatenated [/b]matrix of all the transformation matrices applied. For example, if there are 3 modelview transformation matrices M1,M2,M3 applied to a single point (0,0,0) in that order, then the new reference for [b]that[/b] point would be:

M_f = M3*M2*M1, assuming row-major, pre-multiplication type of transformation matrices.

[quote]2)I must multiply the normals for the rotation of the world matrix? (only for the rotation , not for the translation because the normals must be normalized)[/quote]

Read this: [url="http://www.gamedev.net/topic/466693-normal-transformation/"]http://www.gamedev.n...transformation/[/url]
Basically, you would need to compute the inverse transpose of the final 4x4 Modelview matrix with the translation component zeroed to find the transformed normal

[quote]3)I see that the diffuse component is not relative to the camera position , instead the specular component is relative to the camera , what are other components that are relative to camera ?[/quote]

If you are talking lighting components of the Phong lighting model, then I would say only the specular component is relative to the camera view.

If you are still very new to Computer Graphics, I sugge[font="Arial"][size="2"]st reading[/size][/font][font="Arial"][size="2"] Computer Graphics with OpenGL (3rd Edition) by Hearn Baker, which what I bought some years ago for my basic CG course. It teaches the basics of computer graphics such as modelview and project transformation. However, it uses OpenGL 1.1 which is the old fixed-pipeline functionality and therefore have no information on Shaders but it is still a very good book.[/size][/font]

Share this post


Link to post
Share on other sites
[color="#1C2837"][size="2"][b]concatenation[/b] is when things are put together, like concatenating strings x and y: xy. [/size][/color][color="#1C2837"][size="2"]Or if x = abc and y = def xy = abcdef.[/size][/color][color="#1C2837"] [/color]

Share this post


Link to post
Share on other sites
[quote name='fisyher' timestamp='1302517377' post='4797037']
M_f = M3*M2*M1, assuming row-major, pre-multiplication type of transformation matrices.[/quote]
As I often point out, matrix 'majorness' is actually not related to multiplication order (at least not directly); rather, it has to do with the layout of the matrix in memory. (The term is often misused though.)

Share this post


Link to post
Share on other sites
for that that i understand ,multiply a point for a matrix is equals to translate/rotate his orientation of axises.
And the axises orientation becomes the same for all points multiplied by the matrix , concatenate matrix multiplication is equal to increment the rotation/translation of axis, matrix by matrix.
may be?

thanks.

Share this post


Link to post
Share on other sites
[quote name='jyk' timestamp='1302544560' post='4797208']
[quote name='fisyher' timestamp='1302517377' post='4797037']
M_f = M3*M2*M1, assuming row-major, pre-multiplication type of transformation matrices.[/quote]
As I often point out, matrix 'majorness' is actually not related to multiplication order (at least not directly); rather, it has to do with the layout of the matrix in memory. (The term is often misused though.)
[/quote]

@jyk: When I stated [b]row[/b]-major, I was refering to the fact that each [b]row [/b]in a rotation matrix represents the direction vector of the rotated axes in terms of original reference coordinates, which is the case for pre-multiplication type of transformation matrices as opposed to the post-multiplication type where each [b]column [/b]represted the rotated axes vectors. I was not talking about the layout of matrix in memory, which I honestly do not have much understanding in that area. I think I may have used the wrong term to express my intended meaning. Is there a more technically correct term for that?

@giugio: I'm not too sure what you described is correct or not because it's not really clear, at least to me. I personally prefer not to process in my head, matrix multiplication on a vertex as "rotations/translations of its axes or change of reference". Rather I would just fixed a reference frame and describe it as "a transformation that move the original point to a new point".

Maybe you should post this question the math section since this "change of reference" concept is really a linear algebra question. You might get a much better and well-explained answer by experts there.

Share this post


Link to post
Share on other sites
[quote name='giugio' timestamp='1302598007' post='4797429']
for that that i understand ,multiply a point for a matrix is equals to translate/rotate his orientation of axises.
And the axises orientation becomes the same for all points multiplied by the matrix , concatenate matrix multiplication is equal to increment the rotation/translation of axis, matrix by matrix.
may be?

thanks.
[/quote]


What do you mean by "equal to increment the rotation/translation of axis"?

If you perform Mc = M1*M2*M3, then multiply your points by Mc, it is the same as if you multiplied the points by M1, then M2, then M3.

As for it affecting the orientation of the points and their resulting geometry, that depends on the contents of each matrix. The affine transformations used in graphics manipulation are only a tiny subset of the things you can represent in linear algebra.

This math is generally covered in college/university studies, but many of the For Beginners posts are much younger than that. I strongly recommend that beginners such as the OP either get some good books on linear algebra and graphics and work through them as though they were a college student, or rely on existing engines to do the heavy lifting for them.

Share this post


Link to post
Share on other sites
[quote]
@jyk: When I stated row-major, I was refering to the fact that each row in a rotation matrix represents the direction vector of the rotated axes in terms of original reference coordinates, which is the case for pre-multiplication type of transformation matrices as opposed to the post-multiplication type where each column represted the rotated axes vectors. I was not talking about the layout of matrix in memory, which I honestly do not have much understanding in that area. I think I may have used the wrong term to express my intended meaning. Is there a more technically correct term for that?
[/quote]

I believe the correct term is 'row vectors' vs 'column vectors'.

Share this post


Link to post
Share on other sites
[quote name='fisyher' timestamp='1302613753' post='4797488']
I think I may have used the wrong term to express my intended meaning. Is there a more technically correct term for that?[/quote]
Yeah, the term you're looking for is 'row vector'. I also sometimes refer to such a matrix as a 'row-basis' matrix, although I'm not sure if that terminology is common or standard.

You probably already know all this, but just to summarize, in linear algebra, an [i]N[/i]-dimensional vector can be expressed either as a 1xN row vector, or as an Nx1 column vector. The rules of matrix multiplication and the layout of the types of transforms we typically use dictate the following:

- With row vectors, matrix-vector multiplication takes the form v*M, and with column vectors it takes the form M*v

- With row vectors, the matrix product A*B applies the represented transforms in the order A->B, while with column vectors the transforms are applied in the order B->A

- When using row vectors, the basis vectors of a transform are generally stored in the rows of a transform matrix (e.g. translation vector in the bottom row), whereas with column vectors they're generally stored in the columns (e.g. translation vector in the right-most column)

Using the terms row- and column-major to refer to basis orientation, though incorrect, is very common, and many people are very surprised to learn that this isn't the correct terminology. (In fact, I've managed to elicit surprisingly hostile responses on these very forums by even [i]daring[/i] to suggest that 'row major' is not the correct term for a matrix with the basis vectors stored in the rows :) This isn't helped by the fact that the usage is fairly common on discussion forums and in references and tutorials, and so is more or less constantly reinforced.

I learned the difference initially because I misused the term in a forum post (when I was first learning about 3-d math), and someone pointed out the error to me. So, in turn I generally try to point out the misuse of terminology when it occurs, in the hopes of encouraging correct usage of the terms in question (sometimes it seems like a losing battle though :).

[Edit: Like karwosts said.]

Share this post


Link to post
Share on other sites
[quote name='jyk' timestamp='1302631784' post='4797606']
Yeah, the term you're looking for is 'row vector'. I also sometimes refer to such a matrix as a 'row-basis' matrix, although I'm not sure if that terminology is common or standard.
[/quote]


Being 'row basis' or 'column basis' is the better math term.

Assuming you have a transformation matrix, the basis is the 3x3 portion that defines the new coordinate set.

This is a simplification, but basically the three 3x1 vectors define the x axis direction, y axis direction, and z axis direction, respectively. In the identity matrix, looking at the basis of the matrix, X is defined as [1,0,0], Y is [0,1,0], and Z is [0,0,1].

In an ideal world those vectors should always be completely orthogonal to each other as part of the affine transformation matrix. When they are not orthogonal you don't get a perfect transformation in 3D, and points will start to drift or explode or otherwise degrade.

Having a row basis or column basis defines the direction your three basis vectors are oriented in the data.

Share this post


Link to post
Share on other sites
[quote name='frob' timestamp='1302645948' post='4797678']
Being 'row basis' or 'column basis' is the better math term.

Assuming you have a transformation matrix, the basis is the 3x3 portion that defines the new coordinate set.

This is a simplification, but basically the three 3x1 vectors define the x axis direction, y axis direction, and z axis direction, respectively. In the identity matrix, looking at the basis of the matrix, X is defined as [1,0,0], Y is [0,1,0], and Z is [0,0,1].

In an ideal world those vectors should always be completely orthogonal to each other as part of the affine transformation matrix. When they are not orthogonal you don't get a perfect transformation in 3D, and points will start to drift or explode or otherwise degrade.

Having a row basis or column basis defines the direction your three basis vectors are oriented in the data.
[/quote]
I assume that was directed at fisyher or the OP and not at me, but as I mentioned earlier, I generally refer to a transform matrix that's been constructed for use with row vectors and therefore has the basis vectors in the rows as a 'row-basis' matrix (and similarly for column-basis matrices), just as you said.

Share this post


Link to post
Share on other sites
@jyk: You have mentioned:

[quote]- With row vectors, matrix-vector multiplication takes the form v*M, and with column vectors it takes the form M*v

- With row vectors, the matrix product A*B applies the represented transforms in the order A->B, while with column vectors the transforms are applied in the order B->A[/quote]

I was actually referring to the latter form M*v and A*B is a transform applied in the order B, then A because I'm most familiar with that. Then the term I should be using is "column-basis" and not "row-basis" matrix, right?

I have forgotten most of these linear math terms which I have learnt in high school and college, so I'm a little confused over what you have said. I mostly just stick with the M*v type of transformations when doing computer graphics.

Share this post


Link to post
Share on other sites
[quote name='fisyher' timestamp='1302666181' post='4797768']
I was actually referring to the latter form M*v and A*B is a transform applied in the order B, then A because I'm most familiar with that. Then the term I should be using is "column-basis" and not "row-basis" matrix, right?[/quote]
Yes, that sounds right :) What you described would correspond to the use of column vectors and column-basis matrices rather than row vectors and row-basis matrices.

Share this post


Link to post
Share on other sites
After a google search, the information in this thread seems to be what I am looking for, but I have some questions:

Terminology
- So "row-major" and "colunm-major" refer to how a 4x4 (in this case) matrix is laid out in memory, and
- "row-vector" and "column-vector" refer to whether <x,y,z,w> is a 1x4 or 4x1 matrix, respectively?
- Pre-multiply is v' = v*M (implying "row-vector"), and post-multiply v' = M*v (implying "column-vector")

The thing that confuses me is that it does not seem that being row or column major should change the actual "pencil/paper" math. Let's say that [i]A[/i] and [i]B[/i] are 4x4 matrices. Regardless on whether they are arranged in memory in row or column major order, [i]A [/i]* [i]B = C[/i] should always result in the same [i]C.[/i] However, many posts seem to associate an order of transformations with a "row-major" or "column-major" layout. For transformation multiplication order, I'd think that whether you are pre or post multiplying would be the determining factor.

If I am just trying to create a single transformation matrix, it will be a different matrix depending on whether I am pre or post multiplying, one will be the transpose of the other, correct?

Now, how does this all translate to pre OpenGL 3.2 transform stacks? Take the following pseudo code for example.

loadIdentity()
pushMatrix( lookAt(eye, center, up) );
pushMatrix( translate(x, y, z) );
pushMatrix( rotate(axis, theta) );


Thank you for any assistance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this