Date: Sun, 24 Nov 1996 23:09:55 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Fri, 28 Oct 1994 20:37:32 GMT Content-length: 12230 Forefronts Teaching Computer Graphics with DX article

Cornell Theory Center

This article originally appeared in Cornell Theory Center's Forefronts newsletter.

Teaching Computer Graphics and Scientific Visualization using the Dataflow Block Diagram Language DataExplorer

by Bruce Land, Visualization Project Leader, Cornell Theory Center

Abstract

The scientific visualization language DataExplorer (DX) from IBM has been found to be useful in undergraduate education as a vehicle for teaching computer graphics at an introductory level. Although it is designed for scientific data visualization, DX can be used to construct student lab exercises in computer graphics. DX has been used for two years as an environment which emphasizes graphics manipulations (e.g. rotation, perspective) while not requiring the programming overhead of traditional computer languages.

Introduction

Computer graphics is a topic that requires mathematical, programming, and artistic skills, among others. The content of the computer graphics fundamentals course at Cornell focuses on mathematical skills but must include programming to illuminate the math. The course covers the following topics: The programming aspect of the course attempts to give students practical experience with many of the techniques taught in lecture. Lab exercises written in DX cover nine computer graphics topics. These exercises include: All exercises have example programs to introduce the concepts and descriptions of the manipulations required of the student.

The first two exercises deal with construction of objects and are an introduction to DX. In the first exercise, students are introduced to the notion of polyhedron construction with vertex and face lists. They are expected to design a couple of polyhedra and perform a simple animation of one object. They experiment with determining the normals to the surface. The second exercise introduces parametric surfaces. Students design quadric surfaces, figures of rotation, and bilinear patches. After this lab they can design quite complex single objects.

Exercise three teaches them how to hierarchically combine objects and how to concatenate 3D transforms to make complex motion. They design either:

When done correctly, the exercise shows them how to design parts of a complicated object (e.g. props or wheels), move them, and duplicate them for re-use several times in the final construction.

In exercise four, students turn off perspective in DX and write their own pseudo-perspective transform for a simple scene. This introduces the use of homogeneous coordinates and matrix manipulation in DX. The calculation is complicated enough to introduce the various structuring aids of DX which make the code more readable.

Exercises five and six explore lighting. Students first design a landscape to be lit by two simulated suns, a white dwarf, and a red giant in two different orbits. Then they turn off the default lighting model in DX (Phong illumination with Gouraud shading) and design their own lighting. They code a lighting model based on light positions, viewer position, and object normals, and extend the model to produce a spotlight depth cueing based on intensity.

Exercise seven introduces image manipulation and filtering. Students are asked to anti-alias a simple scene using postfiltering and to determine a "best" scheme based on available filters and system resource (i.e. memory, CPU time). They then edge-enhance an image. Finally they texture-map an image onto a quadric surface by parametrically modifying the image pixel coordinates. In DX, an image has extent in world space, with each pixel having a position.

Exercise eight introduces scientific visualization by having the students make judgments based on graphical representation of fields. The first part of this exercise is to identify the geographic location of a landscape height field, then to enhance the slope and exposure by modifying the program. The second part is to identify the sources and sinks in a 3D vector flow field. They are shown how to draw flow lines, vector arrow icons, and isosurfaces of speed. They then combine these techniques to find the sources and sinks.

The final design project is to produce an animation of hierarchically modeled objects. Typical projects have included:

The complexity and sophistication of many of the projects can be amazing.

DX as a Programming Language

At the introductory level, lack of programming tools often interferes with learning graphics operations. Typically, graphical operations are either provided as a large library of routines that students must learn, or derive from relatively simple programming projects that students must code from scratch. The block diagram interface of DX can be customized to make a "visual subroutine library" of often-used graphics routines. Students can construct very complex scenes including camera and lighting control in a short time. They can also "open up" various visual subroutines and modify or extend them. The graphical nature of the user interface and its easy extensibility make it possible for students to rapidly prototype a graphics operation, see the effects and modify the program. The structure of DX that allows such easy interaction is described next.

DX is a block diagram, point and click programming language designed for producing high quality images based on 3D data which may represent objects (walls, stars) or fields (density, electric field). DX can easily be extended to construct the objects and perform the operations needed for an introductory graphics class. The block diagram program is built up of "modules" and "wires" connecting them. A module is a primitive program function that appears on the screen as a block with input and output tabs. Wires are dragged with the mouse from outputs to inputs. A group of modules can be hidden inside of another module to form a user "macro." System supplied DX modules include vector and scalar field rendering, and geometric operations (rotate, translate), in addition to x and y plotting. There is direct programming support for producing custom MOTIF control panels. The Theory Center has added modules to make parametric surfaces, texture maps, bumpmaps, spotlights, and a variety of other graphically oriented functions.

Students are expected to design visual programs to perform some particular assigned task. They are expected to produce working programs that are readable and documented. A visual language has a different style of organization for readability than text-based code, but for programs bigger than one screen wide, organization is no less important. Any module can have a comment field and the Theory Center encourages a comment in all but the most obvious modules. Programs tend to build an object of some kind (e.g. house) by defining its parts, combining them, and then moving them to some position. Such a section of code tends to be small (perhaps 20 modules) but cryptic unless the designer minimally labels the output of the code block. DX supports labeling of wires to document what is flowing through them. In many cases a small code block can be made into a macro, which then appears to be another module with a user-chosen name. At some point objects have to be combined to make higher order structures. Careful arrangement of the hierarchical structure (which is all visual) helps during program tracing and debugging. We have found that, as with all programming, providing a few examples and a programming manual is an effective way of introducing students to the subject matter.

Conclusions

DX allows students to concentrate on learning the graphics content of the course rather than investigating the details of a programming environment. Students can generate code to make images in a fraction of the time required of a C language environment, encouraging experimentation. At the time of writing, course evaluations are not yet available from students, but will be when this article appears in Forefronts. Preliminary student feedback indicates satisfaction with DX as a vehicle for learning graphics. The acquired background in computer graphics using DX is already being put to use in scientific visualization as students incorporate their class skills into research projects across campus. This year students in the course were mostly upper division computer science and engineering majors. It should be possible to construct a freshman-level course using DX which introduces computer graphics and visualization at an appropriate mathematical level and whets their appetites for further instruction. A downside to DX use in the classroom is that it requires a graphics workstation such as an IRIS Indigo, SPARC station, HP workstation, or RISC System/6000, not a Mac or PC, which is the hardware most readily available to college and university students. Hopefully the trend of cheaper workstations and more powerful personal computers will continue to open new possibilities. Designing complex scenes in DX is easy enough that many projects put a large demand on the workstations for CPU and memory. During the final project many of the students ran out of memory while using 32 MByte machines. In most cases, scaling down the resolution of texture maps solved the large size, but in a few cases the objects and motions became too complex.

The lab exercise software plus student lab instructions are available on-line from an anonymous ftp site at Cornell University (info.tc.cornell.edu). Contact Bruce Land (bruce@tc.cornell.edu) for more information.