---
title: "3D world to viewing coordinate matrix"
subject: "Computer Graphics"
chapter: 4
key: "semester_5/computer_graphics:world-to-viewing-3d-matrix"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/world-to-viewing-3d-matrix
site: BCT Engineering
---

# 3D world to viewing coordinate matrix

Computer Graphics · Chapter 4: Three-Dimensional Graphics

- Asked in: 2078 Kartik, 7 marks; 2075 Asoj, 5 marks (asked 2 times)
- Video: [3D viewing](https://www.youtube.com/watch?v=rfqMRI7hdcQ) — SG Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/world-to-viewing-3d-matrix
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-4

## Question

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

## 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.

## Answer

**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.

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

**Step 2: translate R0 to the world origin**

```text
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**

```text
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

```text
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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which items define the viewing coordinate system?
   A. Only the window and viewport
   B. View reference point R0, view-plane normal N, view-up vector V
   C. Light position, colour and normal
   D. Projection angle and zprp
   Answer: B. R0 is the origin, N the viewing z-axis, and V fixes the y direction. (Key point: Viewing system)

2. How are the viewing axes computed?
   A. u = N/|N|, v = V, n = u×v without normalising
   B. n = V×N, u = N, v = V
   C. n = N/|N|, u = (V×N)/|V×N|, v = n×u
   D. u = V/|V|, v = N/|N|, n = u+v
   Answer: C. They form mutually perpendicular unit vectors that become the new x, y, z axes. (Key point: Unit vectors)

3. The world-to-viewing matrix is:
   A. M = R·T (translate R0 to origin, then rotate)
   B. M = T·R (rotate, then translate)
   C. M = R only
   D. M = T only
   Answer: A. First translate R0 to the origin, then rotate u, v, n onto the x, y, z axes. (Key point: Matrix composition)

4. The rows of the rotation matrix R are:
   A. The columns of identity scaled by R0
   B. The vectors R0, V, N
   C. x, y, z world axes
   D. The unit vectors u, v, n
   Answer: D. Each row is a new axis, so R maps u, v, n to (1,0,0), (0,1,0), (0,0,1). (Key point: Rotation matrix rows)

## Related in Computer Graphics

- [2D viewing pipeline with matrices](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aviewing-pipeline-2d-matrices) — Computer Graphics, chapter 3, asked 5×
- [3D viewing pipeline](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aviewing-pipeline-3d) — Computer Graphics, chapter 4, asked 5×
- [3D window to viewport transformation](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Awindow-viewport-3d-matrix) — Computer Graphics, chapter 4
- [Derive perspective projection matrix](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aperspective-projection-matrix-derive) — Computer Graphics, chapter 4, asked 3×
- [Short note: Application of 3D transformation](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Ashort-note-application-3d-transformation) — Computer Graphics, chapter 4
- [Geometric tables for 3D object](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Ageometric-tables-3d-error-free) — Computer Graphics, chapter 6

## Related in other subjects

- [Derive one-dimensional heat equation](https://www.bctengineer.com/question.md?key=semester_4%2Fapplied_mathematics%3Aheat-eq-derive) — Applied Mathematics, chapter 3, asked 5×
- [Derive one-dimensional wave equation](https://www.bctengineer.com/question.md?key=semester_4%2Fapplied_mathematics%3Awave-eq-derive) — Applied Mathematics, chapter 3, asked 2×
- [Derive two-dimensional heat equation](https://www.bctengineer.com/question.md?key=semester_4%2Fapplied_mathematics%3Aheat-eq-2d-derive) — Applied Mathematics, chapter 3, asked 2×
- [Analytical resection, derive coordinate expression](https://www.bctengineer.com/question.md?key=semester_4%2Fsurveying_ii%3Aanalytical-resection-derive-three-known) — Surveying II, chapter 5
