Advertisement

transformations question

Started by October 07, 2001 11:46 PM
13 comments, last by davidko 23 years, 4 months ago
This question is pretty basic, but I just wanted to make sure I''m not making a mistake. To transform a point from model space to camera space is simple this: X'' = world_to_camera * model_to_world * X; Now, if we want to transform a point in camera space to model space, we simple do this: X = world_to_camera(T) * model_to_world(T) * X'' where the (T) means a transpose of the matrix (we are assuming just rotations and translations here). Let''s call world_to_camera(T) * model_to_world(T) = H Now, since we are dealing with orthogonal matricies, then we should be able to use the rotational part of matrix H to transform a normal vector from camera space to model space, right?
quote:
Now, if we want to transform a point in camera space to model space, we simple do this:

X = world_to_camera(T) * model_to_world(T) * X''

Is that really true!?

I think the correct transformation is this:
X = model_to_world(T) * world_to_camera(T) * X''

regards

/Mankind gave birth to God.
/Mankind gave birth to God.
Advertisement
d''oh! a typo...yeah the way you said it is correct.
Correct me if I''m wrong, but can''t you compute the inverse only once, and multiply the two matricies.. when you do that the order of multiplication is switched again,

m1(T) * m2(T) = (m2 * m1)(T)



--bart
to bpj1138:
Ehh, isn''t that what I said (but in other words)!!?
yep, an axiom says:
(A*B)(t) = B(t)*A(t)

cheers

/Mankind gave birth to God.
/Mankind gave birth to God.
hrm, well, the way i remember the order of multiplication is that you multiply the parent transforms first, and local object transform comes last.. so,

world_transform = root_node * node1 * node2 * node3.. * local_object_transform

So, the parent transforms are on the left, just as you''d expect.

--bart
--bart
Advertisement
bpj1138:
I''m sorry but I don''t know what you mean. I just corrected davidko''s second transformation, which ought to be right now. So, what do you mean?
I haven''t looked up any formulas (no need to) but I''m pretty confident that I have reasoned correctly.

Could you explain a bit more?


/Mankind gave birth to God.
/Mankind gave birth to God.
I take it you mean rotations only and not rotations and translations since I don''t think the transpose and inverse are the same when translations are included. I''m not particularly strong with matrices but when I tried multiplying a matrix that included translation by its transpose I didn''t get the identity matrix.
Keys to success: Ability, ambition and opportunity.
quote:
Original post by LilBudyWizer
I take it you mean rotations only and not rotations and translations since I don't think the transpose and inverse are the same when translations are included. I'm not particularly strong with matrices but when I tried multiplying a matrix that included translation by its transpose I didn't get the identity matrix.

You're right. Ortogonal matrices' inverses are simply the transposes. Rotation matrices are ortogonal, and translation matrices are not ortogonal.



/Mankind gave birth to God.

Edited by - silvren on October 10, 2001 7:26:38 AM
/Mankind gave birth to God.
(Edit - Actually, ignore this post. As silvren pointed out, my statement is wrong - Graham)

quote:
Original post by silvren
You're right. Ortogonal matrices' inverses are simply the transposes.


That's not exactly correct. For example, a scaling transformation matrix is orthogonal:

       [sfx   0    0 ]S =| 0   sfy   0 |   [ 0    0   sfz]    


But its transpose and inverse are the same only if sfx = sfy = sfz = 1.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Edited by - grhodes_at_work on October 10, 2001 11:55:42 AM

Edited by - grhodes_at_work on October 10, 2001 7:14:12 PM
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement