<p>I'm assuming you mean $A$ is object$\rightarrow$world matrix and $B$ is your camera$\rightarrow$world matrix? If that's the case, to calculate object object$\rightarrow$camera matrix you calculate:</p>

<p>$$C=B^{-1}*A$$</p>

<p>In general your math is correct, i.e. the order of matrix multiplication is reversed for the inverse calculation. It's just that normally these transformations are combined to a single 4x4 transformation matrix which does rotation, scaling and translation, and then you just work with that single matrix instead of it being decomposed to separate rotation &amp; translation matrices. Anyway, if you want to decompose the matrix multiplication, based on the above you would do:</p>

<p>$$A=T_A*Ry_A*Rx_A$$
$$B=T_B*Ry_B*Rx_B$$
$$C=Rx_B^{-1}*Ry_B^{-1}*T_B^{-1}*T_A*Ry_A*Rx_A$$</p>

CC BY-SA 3.0
2016-10-11T21:45:02.143Z
No,no!   A is  the world reference system (the coordinate system, Oxyz) and B is the reference system of the camera (Ouvn).   Maybe I had not specified.   In light of these explanations it is correct what I said in my original post?
Nick
CC BY-SA 3.0
2016-10-12T03:39:58.227Z
@Umbert why would world be anything other than identity? I mean lack of identity world would mean there is something more fundamental than world in the scene. So the identity basis is present no matter what even if its below your world meaning world is a object space of somekind. There is always a explicit assumption that something identity is at the lowest level of a transformation chain.
joojaa
CC BY-SA 3.0
2016-10-12T12:25:14.963Z
@Umbert It's important to say coordinate system relatively to what. "World" is usually considered global "root" frame joojaa explained in his answer. If $A$ is transformation to your "world" then where is it transformation from? Global frame? The answer I gave still holds if both $A$ and $B$ are defined relatively to the same frame, just use different names (world=global frame, object=world).
JarkkoL
CC BY-SA 3.0
2016-10-11T13:30:40.063Z
2016-10-11T13:35:54.813Z
2016-10-11T13:35:54.813Z
JarkkoL
<p>I would like to address an issue in your naming. This issue makes the question a bit odd, but not impossible, as I will try to show.</p>

<p>There is an, often unspoken, implied relationship between the matrices. For a matrix to be meaningful there has to be a common ancestor of the matrix that all matrices relate to. See a transformation chain works like a disk system or the root node of a XML document. There is always a base node, in computer graphics texts we choose to call this node <strong>World</strong>*. Calling something else world is just defining your own definition of things.</p>

<p><a href="https://i.sstatic.net/lF8WK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lF8WK.png" alt="enter image description here"></a></p>

<p><strong>Image 1</strong>: The implied hierarchy of matrices, we have agreed to name the root <strong>World</strong>.</p>

<p>Now there is assumed to be nothing outside the world. Although just like zeroes before numbers there is a possibility of infinite worlds within worlds, but those extra worlds do not participate in our model so they hardly matter.</p>

<p>The hierarchy determines how the matrices interact with each other. All matrices are identity matrices ($I$) when viewed from inside the object. Therefore we have the following property for world:</p>

<p>$$T_{world} = I.$$</p>

<p>Anything else would imply that World is not World but rather an object as <a href="https://computergraphics.stackexchange.com/a/4119/38">@JarkkoL's answer</a> implies, so there is yet another World outside what you call World. Also because world is the identity it can be omitted from your calculations, which is why it's sometimes left unnamed.</p>

<p>Now it is obviously possible to name objects. This is smart as it makes talking about things easier. So you could call a bicycle object object "bicycle", makes sense. In fact we do this by calling the camera, "Camera". These names are arbitrary, so it is possible to call an object space World. But then the discussion just drops into confusion.</p>

<p>Now we can address the confusion as your description is ambiguous. This is also is why you have problems reasoning about this. So either what you describe is like:</p>

<p><a href="https://i.sstatic.net/ysBhE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ysBhE.png" alt="enter image description here"></a></p>

<p><strong>Image 2</strong>: Since you have renamed World we do not know what your relationship is. </p>

<p>So by reinventing naming convention you have made the question confused. If you had not then there would be a really easy rule you would append the multiplication as normal as long as you move towards the world and inverted if you move away from the world.</p>

<p>* There are traditions where this is called the <em>Inertial frame</em>, <em>Reference Frame</em> and even sometimes rarely <em>Base</em>.</p>

CC BY-SA 3.0
2016-10-13T10:38:06.540Z
My question is simple. I must aplly the view transfrormation. I supposed that the matrix for pass from Object space to world  has already been applied.Thus I'm in world coordinates (Oxyz).I must pass in camera coordinates (Ouvn).(change of coordinates)Then I overlap the 3 axes (x,y,z) on 3 axes (u,v,n) with a transformation namely Rx*Ry*T. Later for map a point P of the coordinate system of the world (Oxyz) to the Ouvn I do (T^-1)*(Ry^-1)*(Rx^-1)*P . My doubt is: is right the transformation Rx*Ry*T for ovelaps the 2 axes?Or the right transformation is  T*Rx*Ry and then (Ry^-1)*(Rx^-1)*(T^-1)P?
Nick
CC BY-SA 3.0
2016-10-12T12:13:24.057Z
2016-10-12T16:15:54.320Z
2017-04-13T13:00:43.660Z
joojaa
<p>In general, I understand the creation of viewing transformation matrix, but I have my doubts.</p>

<p>For example, let's say that a world coordinate (called $A$) has a center at $(1,1,1)$, and the view reference point (VRP) (called $B$) has a center at $(3,3,2)$.</p>

<p>Each vertex of the world must be "mapped" to $B$. The axes of $A$ and $B$ aren't aligned so a translation isn't enough, but there are two necessary rotations (around $x$ and $y$ of two certain angles).</p>

<p>I want to know if I am proceeding in a correct way. For overlapping the axes from $A$ to $B$ these are the following steps:</p>

<ol>
<li>translate (transformation $T$) with translation parameters $(2,2,1)$, namely $(3-1,3-1,2-1)$</li>
<li>rotation around $x$ (transformation $R_x$)</li>
<li>rotation around $y$ (transformation $R_y$)</li>
</ol>

<p>Thus, the transformation is:
$R_yR_xT$ when $T$ is the first matrix which must be applied. Thus, the transformation to "map" a point of $A$ into the the corresponding point in $B$ coordinates is the inverse namely:
$(T^{-1})(Rx^{-1})(Ry^{-1})$</p>

<p>My main doubt is if it's correct, for converting $A$ and $B$, to do a translation first.</p>

<p>In general, is this process correct?</p>

<rendering><transformations><mathematics><matrix><camera-matrix>
Correctness of logical steps for create the matrix of viewing transformation
Nick
# Correctness of logical steps for create the matrix of viewing transformation

(Asked by: username_0 on 2016-10-10)

In general, I understand the creation of viewing transformation matrix, but I have my doubts.

For example, let's say that a world coordinate (called $A$) has a center at $(1,1,1)$, and the view reference point (VRP) (called $B$) has a center at $(3,3,2)$.

Each vertex of the world must be "mapped" to $B$. The axes of $A$ and $B$ aren't aligned so a translation isn't enough, but there are two necessary rotations (around $x$ and $y$ of two certain angles).

I want to know if I am proceeding in a correct way. For overlapping the axes from $A$ to $B$ these are the following steps:

1. translate (transformation $T$) with translation parameters $(2,2,1)$, namely $(3-1,3-1,2-1)$
2. rotation around $x$ (transformation $R\_x$)
3. rotation around $y$ (transformation $R\_y$)

Thus, the transformation is:
$R\_yR\_xT$ when $T$ is the first matrix which must be applied. Thus, the transformation to "map" a point of $A$ into the the corresponding point in $B$ coordinates is the inverse namely:
$(T^{-1})(Rx^{-1})(Ry^{-1})$

My main doubt is if it's correct, for converting $A$ and $B$, to do a translation first.

In general, is this process correct?

**Tags:** rendering, transformations, mathematics, matrix, camera-matrix


---

## 2 answers

### Answer by username_1 on 2016-10-11. Score: 2

I'm assuming you mean $A$ is object$\rightarrow$world matrix and $B$ is your camera$\rightarrow$world matrix? If that's the case, to calculate object object$\rightarrow$camera matrix you calculate:

$$C=B^{-1}\*A$$

In general your math is correct, i.e. the order of matrix multiplication is reversed for the inverse calculation. It's just that normally these transformations are combined to a single 4x4 transformation matrix which does rotation, scaling and translation, and then you just work with that single matrix instead of it being decomposed to separate rotation & translation matrices. Anyway, if you want to decompose the matrix multiplication, based on the above you would do:

$$A=T\_A\*Ry\_A\*Rx\_A$$
$$B=T\_B\*Ry\_B\*Rx\_B$$
$$C=Rx\_B^{-1}\*Ry\_B^{-1}\*T\_B^{-1}\*T\_A\*Ry\_A\*Rx\_A$$

> **Comments:**
> **username_0**: No,no!   A is  the world reference system (the coordinate system, Oxyz) and B is the reference system of the camera (Ouvn).   Maybe I had not specified.   In light of these explanations it is correct what I said in my original post?  
> **username_2**: @Umbert why would world be anything other than identity? I mean lack of identity world would mean there is something more fundamental than world in the scene. So the identity basis is present no matter what even if its below your world meaning world is a object space of somekind. There is always a explicit assumption that something identity is at the lowest level of a transformation chain.  
> **username_1**: @Umbert It's important to say coordinate system relatively to what. "World" is usually considered global "root" frame username_2 explained in his answer. If $A$ is transformation to your "world" then where is it transformation from? Global frame? The answer I gave still holds if both $A$ and $B$ are defined relatively to the same frame, just use different names (world=global frame, object=world).  

---

### Answer by username_2 on 2016-10-12. Score: 2

I would like to address an issue in your naming. This issue makes the question a bit odd, but not impossible, as I will try to show.

There is an, often unspoken, implied relationship between the matrices. For a matrix to be meaningful there has to be a common ancestor of the matrix that all matrices relate to. See a transformation chain works like a disk system or the root node of a XML document. There is always a base node, in computer graphics texts we choose to call this node **World**\*. Calling something else world is just defining your own definition of things.

[![enter image description here](https://i.sstatic.net/lF8WK.png)](https://i.sstatic.net/lF8WK.png)

**Image 1**: The implied hierarchy of matrices, we have agreed to name the root **World**.

Now there is assumed to be nothing outside the world. Although just like zeroes before numbers there is a possibility of infinite worlds within worlds, but those extra worlds do not participate in our model so they hardly matter.

The hierarchy determines how the matrices interact with each other. All matrices are identity matrices ($I$) when viewed from inside the object. Therefore we have the following property for world:

$$T\_{world} = I.$$

Anything else would imply that World is not World but rather an object as [@username_1's answer](https://computergraphics.stackexchange.com/a/4119/38) implies, so there is yet another World outside what you call World. Also because world is the identity it can be omitted from your calculations, which is why it's sometimes left unnamed.

Now it is obviously possible to name objects. This is smart as it makes talking about things easier. So you could call a bicycle object object "bicycle", makes sense. In fact we do this by calling the camera, "Camera". These names are arbitrary, so it is possible to call an object space World. But then the discussion just drops into confusion.

Now we can address the confusion as your description is ambiguous. This is also is why you have problems reasoning about this. So either what you describe is like:

[![enter image description here](https://i.sstatic.net/ysBhE.png)](https://i.sstatic.net/ysBhE.png)

**Image 2**: Since you have renamed World we do not know what your relationship is.

So by reinventing naming convention you have made the question confused. If you had not then there would be a really easy rule you would append the multiplication as normal as long as you move towards the world and inverted if you move away from the world.

\* There are traditions where this is called the *Inertial frame*, *Reference Frame* and even sometimes rarely *Base*.

> **Comments:**
> **username_0**: My question is simple. I must aplly the view transfrormation. I supposed that the matrix for pass from Object space to world  has already been applied.Thus I'm in world coordinates (Oxyz).I must pass in camera coordinates (Ouvn).(change of coordinates)Then I overlap the 3 axes (x,y,z) on 3 axes (u,v,n) with a transformation namely Rx*Ry*T. Later for map a point P of the coordinate system of the world (Oxyz) to the Ouvn I do (T^-1)*(Ry^-1)*(Rx^-1)*P . My doubt is: is right the transformation Rx*Ry*T for ovelaps the 2 axes?Or the right transformation is  T*Rx*Ry and then (Ry^-1)*(Rx^-1)*(T^-1)P?  

---

