Labs ICT
โญ Pro Login

Projection

Perspective and orthographic projections

2 min read | Computer Graphics
โญ

Want the full learning experience?

Get structured courses, certificates, projects, and instructor support with LabsICT Pro.

Explore Pro Courses

Projection

Projection transforms 3D coordinates into 2D coordinates for display. There are two main types: orthographic (parallel) and perspective.

Orthographic Projection

Projects objects onto a plane parallel to the view direction. Parallel lines remain parallel, and there is no depth distortion. Used in engineering and architectural drawings.

Orthographic Projection Matrix:

  [ 2/(r-l)    0       0      -(r+l)/(r-l) ]
  [ 0          2/(t-b) 0      -(t+b)/(t-b) ]
  [ 0          0      -2/(f-n) -(f+n)/(f-n)]
  [ 0          0       0       1            ]

Where:
  l, r = left, right
  t, b = top, bottom
  n, f = near, far

Simplified (centered):
  [ 1  0  0  0 ]
  [ 0  1  0  0 ]
  [ 0  0  1  0 ]
  [ 0  0  0  1 ]

Perspective Projection

Objects farther away appear smaller, creating a sense of depth. Parallel lines converge at vanishing points. This mimics how the human eye and cameras work.

Perspective Projection Matrix:

  [ 2n/(r-l)    0       (r+l)/(r-l)   0          ]
  [ 0           2n/(t-b) (t+b)/(t-b)   0          ]
  [ 0           0      -(f+n)/(f-n)  -2fn/(f-n)   ]
  [ 0           0      -1             0          ]

After division by w:
  x_screen = x_clip / w_clip
  y_screen = y_clip / w_clip
  z_screen = z_clip / w_clip

This division creates the perspective effect.

Field of View (FOV)

  fov_y = vertical field of view angle

  aspect = width / height

  f = 1 / tan(fov_y / 2)

  [ f/aspect  0    0           0 ]
  [ 0         f    0           0 ]
  [ 0         0   (f+n)/(n-f) -1 ]
  [ 0         0   2fn/(n-f)    0 ]

Example: 90ยฐ FOV, 16:9 aspect
  f = 1/tan(45ยฐ) = 1
  matrix[0][0] = 1/(16/9) = 0.5625

View Volume (Frustum)

  Perspective frustum:

        Near plane
       +---------+
      /|        /|
     / |       / |
    +---------+  |  Far plane
    |  +------|--+
    | /       | /   The visible 3D region
    |/        |/    is shaped like a
    +---------+     truncated pyramid

๐Ÿงช Quick Quiz

In perspective projection, parallel lines appear to: