Skip to main content

3D world to viewing coordinate matrix

Short answer

Define view reference point R0, view-plane normal N, view-up vector V. Compute u = (V×N)/|V×N|, v = n×u, n = N/|N|. World-to-viewing matrix M = |u1 u2 u3 -(u·R0); v1 v2 v3 -(v·R0); n1 n2 n3 -(n·R0); 0 0 0 1|. It translates R0 to origin then rotates u,v,n to x,y,z axes.

Derive (develop) the complete transformation matrix to transform an object from the three-dimensional world coordinate system to the viewing coordinate system.

Viewing coordinate system is defined by:

  • View reference point R0 = (x0, y0, z0), the origin of the viewing system.
  • View-plane normal vector N, the viewing z-axis (direction of view).
  • View-up vector V, which fixes the viewing y-axis direction.

Step 1: unit vectors of the viewing system

  • n = N/|N| = (n1, n2, n3)
  • u = (V × N)/|V × N| = (u1, u2, u3)
  • v = n × u = (v1, v2, v3)

u, v, n are mutually perpendicular unit vectors that become the new x, y, z axes.

        v (y)
        |
        |___ u (x)
       /
      n (z)   (viewing direction)

Step 2: translate R0 to the world origin

T = | 1 0 0 -x0 |
    | 0 1 0 -y0 |
    | 0 0 1 -z0 |
    | 0 0 0  1  |

Step 3: rotate so that u, v, n coincide with the x, y, z axes

R = | u1 u2 u3 0 |
    | v1 v2 v3 0 |
    | n1 n2 n3 0 |
    | 0  0  0  1 |

(Each row of R is a unit vector of the new axes, so R maps u → (1,0,0), v → (0,1,0), n → (0,0,1).)

Step 4: composite world-to-viewing matrix

M_wc,vc = R · T

M = | u1 u2 u3 -(u·R0) |
    | v1 v2 v3 -(v·R0) |
    | n1 n2 n3 -(n·R0) |
    | 0  0  0   1      |

A world point P is converted to viewing coordinates by P_vc = M · P_wc. (Alternative route: rotate about x, y and z axes to align N with z, which gives the same matrix.)

Example: R0 = (0,0,0), N = (0,0,1), V = (0,1,0) gives u = (1,0,0), v = (0,1,0), n = (0,0,1), so M = identity.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 4 questions →