0
\$\begingroup\$

My current understanding of the Model matrix is that it is per object and stores the transformation, rotation, and scale of the object in local object space.

What I'm not sure about, is that whether or not the World matrix is a matrix that is product of all the Model matrices e.g. WorldMatrix = ModelMatrix_object1 * ModelMatrix_object2 * ... * ModelMatrix_ObjectN

Or that the World matrix is just another name for the Model matrix?

I should probably also note that I am trying to render multiple objects to the screen and not a single object.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Looks like this has been asked before. Yes the world matrix and the Model matrix is the same, depending on the context. \$\endgroup\$
    – Vaillancourt
    Jul 29 at 21:03
1
\$\begingroup\$

The names "world matrix" and "model matrix" are just terminology, and are not 100% standardised, so depending which source you read you may see them being used to refer to a number of different things.

Generally speaking, your 3D scene will consist of the following:

  • Objects that move around in the scene.
  • Static parts of the scene that don't move.
  • A "camera" that positions the player's viewpoint in the scene.
  • A projection that maps the 3D scene to 2D physical hardware (i.e. your monitor).

Each of these items can be defined by it's own matrix that specifies how the transform for that item is done. Everything else is terminology.

The projection that maps the 3D scene to 2D physical hardware is consistently referred to as the projection matrix and may be perspective or orthographic.

For objects that move around in the scene the matrix that positions them in the scene is commonly called a model matrix, an object matrix, or a world matrix.

For static parts of the scene that don't move there is often no matrix - these parts of the scene don't move. If a 3D engine does define a matrix for these, it may be identity.

For a "camera" that positions the player's viewpoint in the scene, this is a single matrix that may be called the camera matrix, the world matrix or the view matrix.

Some 3D engines may treat objects that move around in the scene and static parts of the scene that don't move as different cases of the same object type, in which case the matrices for the former defines their positions in the scene, whereas the matrix for the latter is just identity.

Classic fixed-function OpenGL concatenates all of the above matrices into a single modelview matrix containing transforms for an objects position in the scene, as well as for the player's viewpoint in this single matrix.

Classic fixed-function Direct3D uses two matrices with the terminology world matrix for positioning objects in the scene, and view matrix for positioning the player's viewpoint in the scene.

If you're writing a paper or presenting something to other people, model matrix (or object matrix) and view matrix are probably the most unambiguous terms to use; otherwise you should probably clearly define your terminology so that people can understand what you mean when you use each term.

And you don't even have to do any of it in these ways. You could, for example concatenate the projection and the player viewpoint to a single matrix, then each object in the scene would have it's own matrix. You could split things out even further if you wanted, maybe by splitting rotations out from other transforms if you needed to special-case them for whatever you're doing. In cases such as these the terminology you use is entirely up to you, so long as it makes sense to you and to anyone else who might be reading your code.

With programmable shaders there is not even a requirement to use the traditionally defined matrices and you can do whatever you want.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.