6
\$\begingroup\$

What does multiplying an object in local space with a WVP(world,view,projection) matrix do? My book says "local space to homogeneous clip space"

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 5444). Mercury Learning and Information. Kindle Edition.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ It "moves" the vertices from being in a "human conceived" world to a "camera conceived" world. Once in the "camera" space (homogeneous clip space), the "camera" will be able to decide what vertex are visible, clip the vertices that are not visible, sort the vertices and the faces, and then render it. (Roughly.) \$\endgroup\$
    – Vaillancourt
    Commented Oct 26, 2015 at 15:07
  • 1
    \$\begingroup\$ This question seems related. \$\endgroup\$
    – Vaillancourt
    Commented Oct 26, 2015 at 15:07
  • \$\begingroup\$ Simply put, the GPU can only render what is in [-1,1] cube, these matrices transform "visible" part of the world so it fits into this cube in such way it looks like 3D scene when flattened onto screen. \$\endgroup\$
    – wondra
    Commented Oct 26, 2015 at 19:20
  • 1
    \$\begingroup\$ People finding this question might find useful: The view matrix finally explained \$\endgroup\$
    – Theraot
    Commented Feb 22, 2021 at 10:33

1 Answer 1

10
\$\begingroup\$

The world matrix translates the coordinates of your vertices from model space to world space. This transformation includes the position of the object in the world as well as its orientation and potentially scale.

The view matrix translates those vertices from world space to camera/view space. This means the transformed coordinates are in relation to the camera/point of view.

The projection matrix finally translates those coordinates from camera/view space to projection space. Projection space coordinates specify where the vertex is located on your display/monitor as well as containing depth information (i.e. How far away from the camera the point is). This coordinate space is the "homogeneous clip space", because all the x/y components of all visible points are in the range [-1,1]. Depth (z component) lies in [0, 1].

If you premultiply those matrices you get a world-view-projection matrix and can do all those steps in one single matrix multiplication. Note that it actually makes sense to premultiply view and projection Matrix, as those usually don't change in the timeframe of one frame. You'll save calculations this way if there are a lot of objects needing to be rendered. Also you only have to send 2 different matrices to you GPU instead of 3 (World Matrix is different for every object you'll render, but it could also make sense to include the world matrix in your premultiplication when meshes have a lot of vertices).

Look here for further reference.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ World matrix transforms from 'local' or 'model' space to 'world coordinates'. \$\endgroup\$ Commented Oct 26, 2015 at 16:38
  • \$\begingroup\$ Edited to clarify this \$\endgroup\$
    – LukeG
    Commented Oct 26, 2015 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .