Projection Transform

In order to calculate what is displayed on the screen we work out a view volume; we do this by defining a 3d solid in the Projection Matrix. When it comes to drawing objects we work out if they are in the viewport, done in camera coordinates (e.g. negative z values are in front of the camera).

Typically we use a Frustum for Perspective and a rectangular prism for orothographical.

We only have to change our projection transform when we reshape our window, because there is no need to change the 3d shape of what we need to look at, only what it contains.

Foreshortening

In orthographic cameras, everything is the same height regardless of distance (it performs no shortening)

Screenshot%202014-09-04%2017.05.11.png

We can use projections to implement a perspective camera. We do this with setting the glMatrixMode to be GL_PROJECTION, rather than MODELVIEW.

Orthographic

Screenshot%202014-09-04%2017.05.15.png

Orthographic projection doesn’t really have transforms: x and y are irrelevant of z.

Screenshot%202014-09-04%2017.05.20.png

Malcolm’s Orthographic Projection Matrix (t = top, l = left, b = bottom, r = right, f = far, n = near)

Perspective

Screenshot%202014-09-04%2017.57.29.png

Perspective projection has a transform where qx is dependent on px and pz, and qy depends on py and pz (e.g. their value is determined based on their depth and distance away).

Screenshot%202014-09-04%2017.05.26.png

The perspective projection transform matrix (taking scaling into account)

Screenshot%202014-09-04%2017.05.31.png

A simplified perspective projection transform applied to a point

Mperspective refers to the full matrix above, not this one with ‘a’, ‘b’ and ‘n’.//

Screenshot%202014-09-04%2017.05.40.png

The perspective matrix transforms a perspective view volume into a rectangular view volume.

Depth/Pseudodepth

The depth of an object is its z value (e.g. p3 or q3). The z value is only important because it specifies the relative distance of objects, and their ordering in the scene. To make it easier to manipulate we convert this depth to a ‘pseudodepth’ (similar to normalising it).

Screenshot%202014-09-04%2017.05.44.png

Screenshot%202014-09-04%2017.05.48.png

Psuedodepth:depth has a logarithmic relationship.