University of California, Berkeley
EECS Dept, CS Division
Jordan Smith SLIDE: Scene Language for
Interactive Dynamic Environments
Prof. Carlo H. Séquin

Home Goals Publications People Gallery Assignments Distributions

Assignment 5: 3D Parallel Projections and the Crystal Ball Interface


In this assignment, you are building slideortho3d, a 3D SLIDE viewer which handles parallel projections and flat shading of convex polygons. You will need to implement the following:

Rendering Options

New options appear in bold.

3D Transformations

You must implement 3D version of the matrix transformations. The supported transformations are 3D translations, 3D scaling, 3D rotations, and the special LookAt transformation. The LookAt transformation is convenient for placing cameras in your scene. The LookAt transformation is really a rigid body transformation which is the combination of a 3D rotation around an arbitrary axis and a translation. In the LookAt, you are given an eye point, a target position which you are looking at, and an up direction.

For more details read the 3D Transformation Notes. And see the notes about using Rodrigues' Formula for computing rotation matricies.

Parallel Projection Cameras

The camera object must create a projection matrix which maps points in View Reference Coordinates (VRC) to the Canonical Clipping Volume space. Then you will use the viewport mapping transform from the last assignment to map the clipped geometry to the viewport window. This is very similar to the viewport mapping process from the last assignment.

The volume defined by the camera frustum ([Xmin, Xmax], [Ymin, Ymax], [Zmin, Zmax]) is mapped to become the Canonical Half Cube ([-1, 1], [-1, 1], [-1, 0]) in Projection space. This is the VRC->PROJ transformation. Then the 2D viewport mapping is applied to the Half Cube preserving the Z values. This is the PROJ->VP transformation. The actual projection happens when the Z value is now dropped completing the parallel projection. The 2D vertices now define 2D polygons which can be rendered by OpenGL.

The following figures show the coordinate systems involved in the projection transformation and viewport mapping.

VRC Canonical Half Cube Viewport

For more information on how to calculate the Gproj<-vrc read parallel projection section of the Camera Projection Notes.

3D Bounding Box Culling

Extend your bounding box culling routines to work in 3D. You can easily extend the outcode idea to 3D where the outcodes become (forward, back, up, down, right, left). The diagram uses color to distinguish depth in the forward/back dimension Z.

Back Face Culling

Back face culling is when you do not render a polygon because its normal is pointing away from the viewer's eye point. A naive way of preforming this check would be to construct a vector from the eye point to a point on the face and compute the dot product of this line of sight vector and the normal vector. If this scalar is positive then the face is pointing away and consequently can be culled. A more sophisticated way of making this check is to transform the face's normal into the projection space, where the line of sight vector is always the negative Z-axis. Then the check for back face culling is just to see if the Z component of the transformed normal is negative.

Back face culling should never be preformed on objects which have the SLF_HOLLOW solid flag, and it should not be preformed if it is disabled in the rendering options.

For more details read the Back Face Culling Notes.

3D Polygon Clipping

Extend your polygon clipping routines to work in 3D. In principle, it is the same algorithm just run over 6 half spaces with the addition of the near and far clipping planes instead of the 4 half spaces from 2D.

Crystal Ball User Interface

Define the necessary C++ functions to implement a crystal ball interface. The interface should work as follows:

    Dragging the mouse with the right button held down controls rotation about the z-axis. The angle of rotation is defined by the angle between the lines through the center of the window and the start and end points of the drag. This rotation should be incremental, not absolute.


    Dragging the mouse with the middle button held down gives incremental zoom control; dragging upwards makes the object bigger and dragging downwards makes it smaller. Implement this by uniformly scaling the object. Leave the object centered around the origin.


    Dragging the mouse with the left button held down controls an arbitrary rotation of the object about some axis through the origin. You should compute this rotation using great circle rotations with an optional enhancement for points outside of the crystal ball circle:

3D Scene

Make a 3D dynamic scene ortho3d.slf which shows off your 3D rendering system.
Don't be timid with your transformations! Make big moves in your scene, so that lot's of stuff get's clipped. Your objects do not have to move in a physically realistic sense!

Getting Started

Follow the listed instructions for as5.

SLIDE Implementation Specification

The SLIDE Implementation Specification gives information about the C++ class structure which implements the SLIDE viewer. It also gives an outline of the operation of the viewer.

Submission Details

  1. This assignment is to be done in pairs. Find a brand new partner.
  2. Follow the listed instructions for as5. Remember to turn in a dynamic 3D SLIDE scene in the SLIDE directory.

This page was originally built by Jordan Smith.

Last modified: Thursday, 07-Oct-2004 11:10:25 PDT