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)

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

# Orthographic

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

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

# Perspective

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

The perspective projection transform matrix (taking scaling into account)

A simplified perspective projection transform applied to a point

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

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

Psuedodepth:depth has a logarithmic relationship.

page revision: 6, last edited: 04 Sep 2014 08:00