Parallel and Perspective Projections

This notebook lists the steps that are required for parallel and perspective projections in computer graphics

Farhad Kamangar 2017

Projection

In order to be able to display the objects in the real world to the screen, we need to define a process that maps from 3-dimensional coordinate system to a 2-dimensional plane. This process is called projection.

To define a projection we need to define a projection plane.

  • The projection plane is defined by a point on the plane and a vector normal to the plane.
  • The point on the plane is called View Reference Point (VRP)
  • The normal to the projection plane is called View Plane Normal (VPN)
  • The VRP is the origin of the View Reference Coorinate (VRC) system, which is also called camera coordinate system.
  • Rather than $x$, $y$, and $z$, the 3 axes on the VRC are called $u$ , $v$ , and $n$.
  • The VPN is the $n$ axis of the VRC coordinate system.
  • A vector called View Up Vector (VUP) determines the $v$ axis of the VRC system. Notice that the VUP vector is not the same as the $v$ axis of the VRC, rather, the projection of the VUP on the projection plane is the $v$ axis.
  • The $u$ axis of the VRC is determined by the cross product of the $v$ and $n$ axes.

Parallel Projection

Wiki: A parallel projection is a projection of an object in three-dimensional space onto a fixed plane, known as the projection plane or image plane, where the rays, known as lines of sight or projection lines, are parallel to each other.

Steps to convert a parallel projection volume into canonical view

Given the viewing parameters for a parallel projection, i.e, VRP, VPN, VUP, PRP, umin, umax, vmin, vmax, nmin, nmax, find the sequence of transformations which will transform this viewing volume into a standard parallel view volume which is bounded by the planes x=1 ; x=-1 ; y=1 ; y=-1 ; z=0 ; z=1

  • Step 1: Translate VRP to origin
  • Step 2: Rotate VPN around x until it lies in the xz plane with positive z
  • Step 3: Rotate VPN' around y until it aligns with the positive z axis.
  • Step 4: Rotate VUP'' around z until it lies in the yz plane with positive y
  • Step 5: Shear such that the Direction of Projection (DOP) becomes parallel to the z axis. DOP is defined by connecting center of window to PRP.
  • Step 6: Translate the Center of Window on the front plane (nmin) to the origin
  • Step 7: Scale such that the view volume becomes the canonical parallel view volume which is bounded by the planes x=1 ; x = -1 ; y=1 ; y = -1 ; z=0 ; z=1

Note: after the step 2 the vectors VPN and VUP vectors will change. For convenience they are called VPN' and VUP'. After the Step 3, the vectors VPN' and VUP' will change again and they are called VPN'' and VUP''

Perspective Projection

Encyclopedia definition: A method of projection in which a three-dimensional object can be represented by projecting points upon a picture plane using straight lines converging at a fixed point, representing the eye of the viewer.

Steps to convert a perspective projection volume into canonical view

Given the viewing parameters for a perspective projection, i.e, VRP, VPN, VUP, PRP, umin, umax, vmin, vmax, nmin, nmax, find the sequence of transformations which will transform this viewing volume into a standard perspective view volume which is bounded by the planes x=z ; x=-z ; y=z ; y=-z ; z=1

  • Step 1: Translate VRP to origin
  • Step 2: Rotate VPN around x until it lies in the xz plane with positive z
  • Step 3: Rotate VPN' around y until it aligns with the positive z axis.
  • Step 4: Rotate VUP'' around z until it lies in the yz plane with positive y
  • Step 5: Translate PRP (COP) to the originimage.png
  • Step 6: Shear such that the center line of the view volume becomes the z axis
  • Step 7: Scale such that the view volume becomes the canonical perspective volume

Note The first 4 steps of the parallel and perspective projections are exactly the same.