CPS 124/296.3
Fall 2002

CSG Modeler

The purpose of this assignment is to help you understand how to build and manipulate objects in 3D space.

Specifications

When computer graphic artists are creating a three-dimensional scene, you will very seldom see them sitting at a text editor modifying a scene file or program by hand. It is simply a far too tedious medium to deal with reasonably. On the other hand, you will often see CG/CAD artists using programs that allow them to interactively place objects in a scene and then modify their properties. Such programs, known as modelers, are a true time (and sanity) saver for the artist. Modeling programs come in various shapes and sizes, each with a specifically tailored purpose. Some are meant for freeform surface design, others are meant as composite object construction, some are designed to allow extremely accurate manipulation of the objects, and some attempt to combine all of these. In this assignment you will be implementing a simple modeler that allows the user to create arbitrary objects using CSG, constructive solid geometry.

The user should be able to start with a blank scene, or a one that has been read in from your scene graph file (if you implemented that feature in the last assignment), add new shapes to the scene interactively, and define how to combine two shapes constructively. Once a shape has been added, the user should be able to interact with it (as described below), change its geometry (from a set of basic shapes), and change how it is combined with other objects.

The user should have the ability to interactively move objects around in space, resize and rotate them, as well as adjust the camera position, orientation, and settings. All this will be done using as intuitive mouse and key actions as you can possibly make. You may choose which specific keys and mouse buttons control which functions, but make sure they are clearly documented in your README file.

Object

  • Film Plane Translate: clicking an object and then dragging the mouse should cause the object to follow the mouse in a plane parallel to the film plane.

  • Z Translate: clicking an object and then dragging the mouse should cause the object to move along an imaginary axis that is aligned along the look vector.

  • Trackball Rotate: clicking on an object and then dragging the mouse should rotate it as if they were moving it with the tip of their finger. That is, the shape should rotate in the direction of mouse movement over the shape.

  • Uniform Scale: clicking an object and dragging should scale that object. For major extra credit, try to implement non-uniform scale (scaling in any direction an arbitrary amount).

Camera

  • Camera Trackball: This interaction is very similar to the object trackball. However, instead of rotating a single object around its center, you are rotating the camera around the scene. This has the effect of rotating the entire scene about its center. To avoid the rotation issues discussed in class, you should implement your trackball using quaternions instead OpenGL's standard rotation matrices.

  • Spin: For this interaction, a mouse movement simply causes the camera (or the scene) to spin around the axis formed by the camera's look vector.

  • Zoom: This operation simply translates mouse movement into changes in the camera's view angle, resulting in an effect similar to zooming in or out with a camera. Note: the eye point is not moved!

  • Pan: This interaction is to film plane translate as camera trackball is to object trackball. Instead of moving a single object, Pan moves the eye point. This has the effect of sliding the camera in a plane parallel to the film plane.

  • Dolly: For this interaction you will need to find some way (again, left to your discretion) to interpret mouse movements so as to translate the camera along the look vector.

In general, the actual relationship between mouse and object motion is left up to you. Note that for each of these interactions, you must carefully weigh the effect the mouse movement has on the object. If you move your mouse very slightly, and the objects are flying off the screen because your are moving too fast, you will lose points.

Extra Credit

There are many parts of the homework that are open ended. You can earn bonus points with extremely creative and intuitive solutions. Make sure that you mention your assumptions, extra features, and how to run your program in your README file.

To get you started, here are some extra credit ideas

  • allow arbitrary objects instead of the standard set provided by glut
  • allow users to group objects (e.g., specify a parent-child relationship)
  • allow users to move objects constrained to the plane on which the parent objects lie
  • allow added objects to snap to the coordinate system of their parent objects
  • incorporate fancy interaction techniques from commercial modelers (i.e., StudioMax)
  • allow user to save objects that have been modeled

Resources

 

Feedback?