<p>The Object-To-World matrix is often called "model-matrix".</p>

<p>This martix tells us how the object relates to some "World". This world is relative and arbitrary but really convenient because we can place all our objects and even the camera in it and the math works out pretty well.</p>

<p>The short answer is, that you imagine that the model is defined in the origin of the world, so that the center of gravity of the object lies exactly in the $(0.0, 0.0, 0.0)$ position of the world.</p>

<p>Now if you want to place multiple objects in the same scene, you have to give them a position, and it is really convenient to give all objects a position relative to this world-origin. So you just create a matrix for each object that tells you how you move the object in relation to the world-origin.</p>

<p>For example translating an object is $\begin{bmatrix} 1 &amp; 0 &amp; 0 &amp; x \\ 0 &amp; 1 &amp; 0 &amp; y \\ 0 &amp; 0 &amp; 1 &amp; z \\ 0 &amp; 0 &amp; 0 &amp; 1 \end{bmatrix} $ then your object will have the world-relative position of $(x, y, z)$ (I will omit the useage of homogeneous coordinates which would be better suited for another question).</p>

<p>In a similar fashion you can use translation, scaling and rotation (take care of what order you apply these transformations)</p>

<p>Things get a bit complicated if you want to do camera-space computations and projections and stuff like that, but in the simplest version you can just build your model-matrix this way.</p>

<p>Multiplying each point of your model with this model-matrix gives you the position of the point in world-space (meaning relative to the origin of the world!) and for meshes this moves the whole model just as you would expect.</p>

CC BY-SA 3.0
2016-06-02T05:24:49.527Z
Is it correct to think of this model-matrix as a model-to-world matrix? in case I want to transform a point to the coordinate system of the model, then will I have to use the inverse of the model-matrix?
BRabbit27
CC BY-SA 3.0
2016-06-02T05:27:06.040Z
Regarding the camera-matrix (built with cam position, lookat point and up vector), can I call it a camera-to-world matrix? Then, if I want to go from world to camera space, will I have to use the inverse of that camera-matrix?
BRabbit27
CC BY-SA 3.0
2016-06-02T15:55:16.567Z
The model-matrix is indeed a model-to-world matrix. If you can call the camera-matrix or often view-matrix a "camera-to-world" or "world-to-camera" matrix depends on how you build it i think. I aways use a approach of "world-to-camera" in which the matrix is composed with the coordinate system and the _negative_ position of the camera. Then multiplying by this takes a world coordinate into camera/view space. http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ explains this in a much more detailed fashion and in the way I use the terms and matrices.
Dragonseel
CC BY-SA 3.0
2016-01-28T20:06:48.473Z
2016-01-29T03:35:00.793Z
2016-01-29T03:35:00.793Z
Dragonseel
<p>No! If you dont have this info and must have a extra frame, just assume the reference frame is a identity matrix*. The point of the extra reference frame is just to be able to move the object but if you have no info about how the object should relate to other objects it does not really matter operator can move it where they want. Everything is relative, if theres no relation then no problems.</p>

<p>* choosing identity is like choosing a arbitrary constant to be 1, its numerically easy to work with.</p>

CC BY-SA 3.0
2016-01-28T19:29:07.043Z
Using the identity matrix is equivalent to placing the object at the origin, with no scaling, and no rotation.
RichieSams
CC BY-SA 3.0
2016-01-28T19:46:41.473Z
@RichieSams yes, same as putting object to world coordinates (or other parent), except theres a matrix in between to manipulate.
joojaa
CC BY-SA 3.0
2016-01-28T18:56:25.217Z
2016-01-28T18:56:25.217Z
joojaa
<p>I want to ray trace a triangular mesh that I load from a file. The vertices' coordinates are expressed in the reference frame associated with the object  (i.e the mesh) and I don't know the object-to-world matrix. Is there a way to calculate this matrix given these coordinates? If no, how can I ensure that the mesh's triangles are transformed to the world's reference frame? </p>

<raytracing><rendering><transformations><mesh><triangulation>
How to determine the object-to-world matrix
S.E.K.
# How to determine the object-to-world matrix

(Asked by: username_0 on 2016-01-28)

I want to ray trace a triangular mesh that I load from a file. The vertices' coordinates are expressed in the reference frame associated with the object (i.e the mesh) and I don't know the object-to-world matrix. Is there a way to calculate this matrix given these coordinates? If no, how can I ensure that the mesh's triangles are transformed to the world's reference frame?

**Tags:** raytracing, rendering, transformations, mesh, triangulation


---

## 2 answers

### Answer by username_3 on 2016-01-28. Score: 4 | Accepted answer

No! If you dont have this info and must have a extra frame, just assume the reference frame is a identity matrix\*. The point of the extra reference frame is just to be able to move the object but if you have no info about how the object should relate to other objects it does not really matter operator can move it where they want. Everything is relative, if theres no relation then no problems.

\* choosing identity is like choosing a arbitrary constant to be 1, its numerically easy to work with.

> **Comments:**
> **username_4**: Using the identity matrix is equivalent to placing the object at the origin, with no scaling, and no rotation.  
> **username_3**: @username_4 yes, same as putting object to world coordinates (or other parent), except theres a matrix in between to manipulate.  

---

### Answer by username_1 on 2016-01-28. Score: 2

The Object-To-World matrix is often called "model-matrix".

This martix tells us how the object relates to some "World". This world is relative and arbitrary but really convenient because we can place all our objects and even the camera in it and the math works out pretty well.

The short answer is, that you imagine that the model is defined in the origin of the world, so that the center of gravity of the object lies exactly in the $(0.0, 0.0, 0.0)$ position of the world.

Now if you want to place multiple objects in the same scene, you have to give them a position, and it is really convenient to give all objects a position relative to this world-origin. So you just create a matrix for each object that tells you how you move the object in relation to the world-origin.

For example translating an object is $\begin{bmatrix} 1 & 0 & 0 & x \\ 0 & 1 & 0 & y \\ 0 & 0 & 1 & z \\ 0 & 0 & 0 & 1 \end{bmatrix} $ then your object will have the world-relative position of $(x, y, z)$ (I will omit the useage of homogeneous coordinates which would be better suited for another question).

In a similar fashion you can use translation, scaling and rotation (take care of what order you apply these transformations)

Things get a bit complicated if you want to do camera-space computations and projections and stuff like that, but in the simplest version you can just build your model-matrix this way.

Multiplying each point of your model with this model-matrix gives you the position of the point in world-space (meaning relative to the origin of the world!) and for meshes this moves the whole model just as you would expect.

> **Comments:**
> **username_2**: Is it correct to think of this model-matrix as a model-to-world matrix? in case I want to transform a point to the coordinate system of the model, then will I have to use the inverse of the model-matrix?  
> **username_2**: Regarding the camera-matrix (built with cam position, lookat point and up vector), can I call it a camera-to-world matrix? Then, if I want to go from world to camera space, will I have to use the inverse of that camera-matrix?  
> **username_1**: The model-matrix is indeed a model-to-world matrix. If you can call the camera-matrix or often view-matrix a "camera-to-world" or "world-to-camera" matrix depends on how you build it i think. I aways use a approach of "world-to-camera" in which the matrix is composed with the coordinate system and the _negative_ position of the camera. Then multiplying by this takes a world coordinate into camera/view space. http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ explains this in a much more detailed fashion and in the way I use the terms and matrices.  

---

