Allison Barlow and David German - Engineering 26 Portfolio

Lab 6: 3D Viewing Pipeline

In this lab exercise, we added 3-D perspective transformations to our Matrix library.

Procedure

Our graphics environment continues to follow Prof. Maxwell's Graphics Environment Specification.

A perspective projection generates a two-dimensional view of a three-dimensional world as seen by an eye situated within that world. A perspective transformation matrix can be developed from the following parameters.

The perspective matrix is the composite of the following transformations, most of which we developed in Lab 4. Projection onto the viewplane simply sets the homogeneous coordinate to z/d; the drawer must then divide the x and y coordinates by h to find the actual point where a ray emanating from a given point on an object intersects the viewplane.

Results

Group Images

Image 1 is a unit cube in two-point perspective. Our perspective view parameters match those specified in the lab handout.

The transformation matrices and transformed vertex points our code generates match those reported by Prof. Maxwell. In summary, the vertices in mathematical space are
{(0,0,0), (0, 1, 0), (1, 1, 0), (1, 0, 0), (0, 0, 1), (0, 1, 1), (1, 1, 1), (1, 0, 1)}.
The placewise-corresponding coordinates in the 100x100 screen space with the given perspective are
{(75, 75), (75, 25), (25, 25), (25, 75), (70, 70), (70, 30), (30, 30), (30, 70)}.

A cube in two-point perspective.
Image 1. A unit cube in Octant I, viewed from a two-point perspective.

The parameters for the following three-point perspective view of the same cube, with a 200x200 screen size, are

A cube in three-point perspective
Image 2. The cube of Image 1, viewed from a three-point perspective.

The following images illustrate the effects of varying the VRP, the VUP, du, and dv.

distant cube
Image 3. As Image 1, but d = 1, causing the cube to occupy less of the view volume.

closer cube
Image 4. As Image 1, but d = 3, causing the cube to occupy more of the view volume.

rotated cube
Image 5. As Image 1, but VUP = (1, 1, 0), rotating the cube with respect to the viewframe.

shrunk cube
Image 6. As Image 1, but (du,dv) = (10,10), causing the cube to occupy less of the view volume.

grown cube
Image 7. As Image 1, but (du, dv) = (.5,.5), causing the cube to occupy more of the view volume.

distorted cube
Image 8. As Image 1, but (du, dv) = (.8, .3), stretching the cube in the x-direction.

We draw three-dimensional circles to make a wire globe by evaluating parametric equations for the circle at arbitrarily-defined intervals of the parameter, and connecting the resulting points with straight lines. The larger the parameter interval, the less smooth the approximation. More surprisingly, smaller parameter intervals cause the lines of latitude to become dashed on the far side of the globe; the smaller the interval, the more black space in the line. We do not presently know why this happens.

Globe frame
Image 9. A unit wire globe, centered at the origin with poles on the z-axis, viewed from an aesthetically pleasing perspective.

Conclusions and Future Work

The transition from 2D to 3D drawing was surprisingly straightforward, since the architecture of the existing graphics system components anticipated the need for z and homogeneous coordinates. We expect no greater complications to arise when we integrate perspective into our modeling system.

Appendices

Our code is available with AES256 encryption. The passphrase is only available to Dr. Maxwell.

This entire project was pair-programmed. David wrote this report.