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 #3: Hierarchical Cars and Trucks

Specification

In this assignment, you are building slideview2d, a 2D dynamic SLIDE viewer program which only needs to work for wire frames. You will need to implement 2D matrix transformations, instancing hierarchies, hierarchical axis aligned bounding boxes, tagging of dynamic subtrees of the scene graph, and a shape preserving viewport mapping of the toplevel bounding box. Take note that CSLIDEInstances do not have their own bounding box. It is overkill to put bounding boxes here because there is exactly one child node, so having a bounding box in an instance would actually make the processing less efficient.

You will also need to deal with the SLIDE surface statement for the color of faces. Other surface properties can be ignored for now, since they don't make sense in a 2D world.

User Interface

Data Files

Using slidedraw and slideedit create some useful shapes for a road scene containing trucks and cars. For instance you may place a couple of trucks on a road or a bridge, each with one or two cars on its flat bed (use different orientations), and with a plane flying overhead. Of course,you may grab some of the shapes from your previous assignments. Have fun, but don't go overboard.

Start by building some simple dynamic test .slf files, which you then test by viewing them with the solution slideview2d; verify that you understand how to make things move in SLIDE! Make the cars go back and forth or bounce up and down.

Hierarchy and Transformations

The new SLIDE statements that you will be implementing for this assignment are surface, object, group, instance, rotate, scale, translate, render, and viewport. You can ignore the solid flags, the shading flags, and LOD flags. In the render statement, a camera and a list of lights can be referenced, but we will be ignoring them in our simple implementation.

For this assignment everything is restricted to 2D. You need to implement a robust transformation package (easily extensible to 3D, in fact you may want to write 3D transformation but then only use 2D instantiations of them) that permits composition of hierarchical transforms. Do not use OpenGL's transformation routines to do this.

Bounding Boxes

Bounding boxes are useful for approximating the geometry of complicated objects and groups. In this assignment, you will learn how to construct bounds which will then be used to speed up rendering in later assignments.

After the provided parser builds up the SLIDE data structure, you must calculate rectangular axis aligned bounding boxes to mark the extents of groups and objects in a recursive manner. The transformed corners of the bounding box of an instanced group or object can be used to efficiently calculate a bounding box for the enclosing group. This may not give the tightest bounds possible, but it is a fast and easy approach.

You should be able to render the bounding box around an object or a group as a white rectangle in its own defining coordinate system, suitably transformed into the WORLD coordinate system by all the instance transformations above it. You should also be able to color in red the bounding boxes of nodes with dynamic geometry in them.

Viewport Mapping

When you have computed the bounding box for the top level of your scene hierarchy, you should construct a viewport transformation that maps the bounding box of your scene to the viewport area of the window specified in the render statement. In your data files, you should make a viewport which covers the center 90% of your window (i.e. the [0.05,0.95]x[0.05,0.95] viewport). You should choose a mapping that gives you the largest undistorted view of your scene within that viewport.

Color

You should use the color field of the surface statement to determine the color with which faces are drawn. You should always use the surface which is specified closest to a CSLIDEPoint in the scene hierarchy, but nodes can forfeit there control of the color by not specifying a surface (in which case they will get the default surface CSLIDESurface::GetSLF_INHERIT()).


Background

2D Linear Algebra Notes

In this assignment, you will be exploring 2D transformations, vector spaces, and affine spaces. To learn more about the mathematical theory behind the assignment read the 2D Linear Algebra Notes.

SLIDE Modeling Hierarchy

You will be making a hierarchical model in this assignment. To learn about modeling with SLIDE read the SLIDE Modeling Hierarchy Notes. There is also a description of bounding boxes.


Getting Started

Follow the listed instructions for as3.


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.

SLIDE Tcl Basics Tutorial

The SLIDE Tcl Basics Tutorial gives enough information amount the Tcl language to create a basic SLIDE dynamic scene.

Code Details

Some code-specific hints might help you understand the SLIDE engine better.

Submission Details

  1. This assignment is to be done in pairs. Talk about your work with your partner, so you learn all aspects of this assignment even if you are not directly involved in writing code for all parts.
    Include a README file in your submission package that states who your partner was and briefly describes the division of work.
  2. Submit all the homework to be graded for each pair in only one of the two accounts in the as2 directory. The README file in the other account should state where to find the relevant as2 directory. Please do not maintain two copies of object files and executables since disk space is limited.

  3. Follow the listed instructions for as3.



This page was originally built by Jordan Smith.

Last modified: Tuesday, 21-Sep-2004 16:51:03 PDT