University of California, Berkeley
EECS Dept, CS Division
SLIDE: Scene Language for
Interactive Dynamic Environments
|Prof. Carlo H. Séquin|
In this assignment, you are building slide3d, a 3D SLIDE viewer which handles parallel and perspective projections and flat shading of convex polygons. You will need to implement the following:
New options appear in bold.
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.
For more information on how to calculate the Gproj<-vrc read perspective projection section of the Camera Projection Notes.
Also look at the old perspective notes.
Extend your bounding box culling routines to work in 4D on homogeneous point values. This ends up being very similar to 3D clipping.
Extend your polygon clipping routines to work in 4D on vertices with homogeneous point values. This is very similar to 3D clipping.
You should be able to make a stereo viewer without writing any C++ code. If you make use of multiple viewports, render statements, and cameras in a single SLIDE file you can create the illusion of 3D. For more information on stereo viewing read the Stereo Viewing Notes.
Your stereo viewer can be written entirely in SLIDE with no additional C++ code by appropriate use of the camera, instance, viewport, and render statements
To create a stereoscopic image, you need to render two slightly different images of your object, corresponding to the two views from two eye positions separated in space. Then, display the two views, side by side, on your window. For best results, the object should be about 5 eye-separations in front of the eye pair and have a size smaller than the eye separation.
As an example, the following special setup would achive this goal:
Make your object about the size of a unit cube, center it at the
origin of the world coordinate system, and place the two eyes at
(1 0 10) and
(-1 0 10)
Choose a clipping window:
(-0.2 -0.2 -0.01) (0.2 0.2 100) and
display the views from the two cameras side by side in square
viewports within a window that is twice as wide as it is tall.
A more correct formulation uses two different oblique cameras that are focused on the same view plane from two different positions.
In this figure, the eye separation is 2a, the distance from your eye to the monitor is v, and the width of the viewport is w. Assume that the viewport has some height, h. You can use those values to set up the camera geometry. For instance, the left eye will have a frustum of (a/v, -h/v, *) ((a+w)/v, h/v, *)
Then, when you create your scene, you have to place your left eye camera at (-a, 0, d) in the relative coordinates of your SLIDE world and make sure that your object is centered at the origin. You can calculate the distance to the image plane, d, by computing the intersection of the lines from each eye through the midpoint of their respective viewports, or by computing the intersection of one such line with the midline.
Follow the listed instructions
hints are useful.
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.
This page was originally built by Jordan Smith.
Last modified: Monday, 18-Oct-2004 19:22:03 PDT