Computers&Graphics, Vol.18:3

Teaching Image Synthesis as a Physical Science

G. Scott Owen Georgia State University Atlanta, GA 30309 owen@siggraph.org
Introduction

The image synthesis component of Computer Graphics has traditionally been taught as a collection of ad-hoc techniques. Students are taught how to turn on a pixel, draw lines, polygons, two and three dimensional modeling transformations, viewing transforma tions and finally, perhaps a simple empirical shading model. There is no underlying theory behind the methods so there is no conceptual framework for the students. In contrast to this approach, other scientific disciplines, such as chemistry or physics, t each students a basic underlying theory that provides a conceptual framework for the different techniques and approximations. Teaching image synthesis from a physical science viewpoint provides this underlying theory and conceptual framework.

Another consideration for some graphics courses is the type of image that the students can produce. Students see the complex and interesting images from graphics packages and in advertisements and want to produce some interesting images of their own. In a traditional course the best they can produce are very simple shaded 3D images with no shadows or textures.

In the sections below, I discuss the objectives of the computer graphics course, give a brief description of the structure of my previous course, a discussion of how natural science courses are taught, a description of the new course, a discussion of some technology considerations, and a conclusion.

Course objectives

While the primary objective of the course is to have students learn the fundamental concepts of Computer Graphics, there are other secondary objectives. Some of these are directly relevant to computer graphics and some to computer science in general. As was suggested in [SCHAL92], the students should do some graphics programming but also learn to use a modern graphics package. Thus, I try to expose them to modern technology and graphics packages. They use the Graphical User Interface (GUI) of MS Windows and X Windows. They use the Pixar Renderman Development System that runs in a UNIX environment. The students also gain experience in using networks and different graphics image formats. Renderman runs on a Silicon Graphics 4D/280 Powerstation that the stu dents access via a network. They produce an image in a tiff file format on the SGI, and then download it to their PC where they convert the tiff to a gif format and display it.

The computer graphics course can integrate and use several aspects of the computer science curriculum, such as the following: mathematics, software engineering, and algorithm analysis. Computer graphics uses classical mathematics, such as matrix and vect or algebra and solid geometry, more than any other course in the undergraduate computer science curriculum. The programs that students write for the computer graphics course are usually the largest programs they will write as an undergraduate. I give them two programming assignments (discussed in more detail later) in which they must develop a large program and then enhance it, and thus illustrating software engineering concepts.

Another area that is used is algorithm analysis. Computer graphics is verycomputationally expensive and so the use of the fastest possible algorithms is imperative. When several algorithms are presented for possible use, an analysis is made of correctnes s and speed. Examples of this are the DDA versus Bresenham line drawing algorithms and the algebraic versus geometric ray-sphere intersection tests in ray tracing.

Background

Most current computer graphics courses start out with a brief description of graphics hardware and systems and then proceed to simple image synthesis (see for example [FOLE90]). The students are taught how to turn on a pixel and then draw lines and circle s, using the Bresenham algorithm. Next they are taught how to scan convert solid polygons and two and three dimensional modeling transformations. The two dimensional viewing transformation (mapping from world to normalized to physical device coordinates) is then covered. Three dimensional viewing transformations, i.e., projections and the viewing coordinate space (camera space) to world coordinate space transformation is covered. Visible surface algorithms are covered. Finally a simple illumination model , such as the Phong model, is developed, on a strictly empirical basis with no underlying physical theory.

This is how I have always taught my first Computer Graphics course. By the end of the course I would get into some simple illumination and shading models, but would not cover any global illumination. As the hardware technology has improved, I have include d more advanced topics in the course, and begun to use the Pixar Renderman system so the students could develop more interesting images and experiment with texture mapping (see for example [OWEN90], [OWEN91], and [OWEN92a]). However, the basic structure o f the course remained unchanged. This was intellectually unsatisfying so I have finally restructured the course. The description of the new course is given below, along with the technology considerations that made the new course possible.

Comparison with Science

In science, one starts with basic theory to describe nature, and then builds a model based on the theory. Since the complete model is usually computationally intractable, the scientist simplifies the model by making approximations. As both knowledge and t echnology improves, the scientists can move the model closer to reality by making better and more realistic approximations.

A specific example of this is the study of molecular electronic structure or molecular orbital (MO) theory [PILA68]. From the Schroedinger equation a complete and correct mathematical expression can be written to describe any molecular system. However, it is impossible to solve this for anything other than the trivial hydrogen molecule. Thus, approximations must be made to apply this to molecules of interest to chemists. Thirty years ago, with computers being very slow and expensive, the state of the art was the semi-empirical Huckel MO theory that dealt with only a few of the electrons in a molecule. Later the extended Huckel theory that accounted for most of the electrons was used.

The approximations used in these theories were extremely coarse but they were computationally tractable. As faster and cheaper computers became more accessible to researchers more "correct" theories with better (but more computationally expensive) approxi mations were used, for example the CINDO/INDO methods. As computers continued to improve more researchers started to use ab initio methods, which were theoretically more accurate but much more computationally expensive. Now, even undergraduates use sophis ticated ab initio molecular orbital calculations. These still have approximations but they are far closer to the basic theory of quantum mechanics than were the semi-empirical methods.

New Computer Graphics Course

In the summer of 1993 I radically changed the course structure. The objective was to start with the basic physics of light and light-surface interactions, develop a full theory of reflectance, and then, by making approximations, to develop conventional il lumination models. A few examples of this approach, condensed to fit into this paper, are given below.

The full integral version of the rendering equation was presented to the students as part of a global illumination model. This presentation included specular and diffuse reflections and interreflections, the fact that the reflected spectrum of a surface i s the full product of the spectrum of the incoming light and the reflectance spectrum of the surface and that, because of the Fresnel term, the reflected spectrum was also a function of the incidence angle of the incoming light. After developing this theo retical base, I then discussed the approximations that were commonly used to simplify the theory and the consequences of these approximations.

If we assume that the lights are point sources and sample the light spectrum at only three wavelengths, i.e., "red", "green", and "blue", then the rendering equation integral reduces to a set of three summations. The Phong local illumination model can the n be obtained by lumping all interreflections into an "ambient" term and by making other approximations for the diffuse and specular reflections. Students are told that this model is the basis for most conventional rendering packages and commercial graphi cs images. They can understand how coarse a model it is and the consequences of the model, for example, no shadows and no interreflections.

Next, the students are presented with more physically realistic approximations to the theory. Radiosity is briefly discussed as a way to handle diffuse interreflections. A large amount of time is spent on ray tracing and how it can handle specular interre flections, shadows, and transmittance. The next topic discussed is modeling transformations in two and three dimensions. This is not because pedagogically this is the best place for it but the students need this information early to develop their own prog rams (see below).

The rest of the course is devoted to conventional graphics topics, as given in the weekly outline below. As the different topics are discussed, particularly advanced topics such as texture mapping and shadows, the ease of implementing these in a ray trace r as opposed to a conventional graphics package is stressed.

Whenever new material is added to a course, some older material must be deleted. For example, the only visible surface algorithms that were covered were the Z-buffer and the back face cull. The only line-clipping algorithm covered was the Sutherland-Cohen algorithm. Most Computer- Human Interaction (CHI) topics were eliminated since most of the students take the CHI course.

The course was taught using HyperGraph [OWEN92b] as the primary text. HyperGraph, a hypermedia system for teaching computer graphics, runs in a Microsoft Windows environment and the students could run it on the campus network or have their own copies. Ano there required text was [UPST89]. Suggested reference books included [FOLE90], [GLAS89], [WATT89], and [WATT92].

Course Assignments

In the previous version of the course, the students wrote a 2D polygon transformation program and then a 3D program, which might include a constant shading model and z-buffer visible surface algorithm. They used Renderman to develop images illustrating mo re advanced concepts, such as texture and bump mapping. The students did nothing with global illumination and it was barely mentioned, usually in one lecture on ray tracing and radiosity.

In the new course the students did not write a conventional rendering program but instead wrote two ray tracing programs. The first program displayed a single sphere on a plane, using the Phong local illumination model and including shadows and specular i nterreflections. The second program incorporated other shapes, such as quadrics and slabs, and texture mapping. Renderman was used by the students to produce conventional rendering analogs of their ray traced images (without the shadows and reflections). These projects counted for 50% of the final course grade.

The ray tracing programs were about as difficult to write as the conventional graphics programs for the previous courses and produced much more spectacular images. Ray tracing has several advantages over conventional graphics techniques in that it implici tly handles several problems that must be explicitly dealt with in conventional rendering. Examples of these include: the 3D viewing transformation, perspective projection, visible surface determination, and clipping to a window. Other problems that are e asy in ray tracing are difficult in conventional graphics. Examples of these include: shadows, multiple reflections, determining a surface normal, texture mapping, and transmittance with refraction. Data structures are also easier for objects such as plan es, spheres, quadrics, and boxes since they can be defined by their equations rather than as a polygon mesh.

Course Outline

The following is an outline of the course. During the summer we have a short quarter (nine weeks rather than ten weeks) and meet for about five and one-half lecture hours per week. During week eight of the quarter I was gone to the ACM SIGGRAPH conference .

Week One
introduction to HyperGraph
introduction to UNIX/Renderman
basic physics of light and reflection
rendering or pixel equation
Week Two
global illumination models
simple local illumination model (Phong model)
Week Three
general theory of ray tracing (primary rays, secondary reflection rays, shadow rays, transmitted rays, concept of a ray tree)
detailed algorithms to generate: primary rays, reflection rays, shadow rays
ray - sphere intersection
ray-plane intersection
ray-slab intersection
format of a BMP file
Week Four
two dimensional modeling transformations
three dimensional modeling transformations
lighting a pixel
DDA and Bresenham algorithm for lines and circles
line clipping (Sutherland-Cohen)
Week Five
scan converting a polygon
area-fill and flood-fill algorithms
solid polygon clipping (Sutherland - Hodgman)
two dimensional viewing transformation (window to viewport to physical device)
Week Six
three dimensional viewing transformation
projections (parallel (orthographic) and perspective)
visible surface algorithms (back - face cull, Z-buffer )
Week Seven
texture and bump mapping:2D to 3D (using bitmaps), 3D to 3D (procedural textures and a noise function) Week Eight
ACM SIGGRAPH Conference
Week Nine
parametric curves and surfaces: Hermite, Bezier, B-Spline, Surfaces (Teapot)
anti-aliasing (Nyquist theorem, supersampling, adaptive supersampling )
fractals and procedural modeling (definitions and triadic Koch curve, Mandelbrot set, Iterated Function Systems)
Technology Considerations

Ray Tracing programs, even simple ones, require substantial computing power. However, this capability is now available for a low price. In the Fall of 1992, GSU purchased over three hundred 80486 based systems, all with at least eight megabytes RAM, and 8 00 x 600 8-bit graphics adapters. The current price of such a system (including a 200 mbyte disk and color monitor) is well under $2,000 and many of our students have their own systems. A typical ray traced image, computed with no anti-aliasing, a few obj ects, and at a size of 256 x 192 pixels, takes only about one or two minutes on this type of machine.

The students wrote their program output to a Microsoft Windows 24-bit bitmap (BMP) file. They were given sample code for creating BMP files. Shareware utilities allowed the students to convert and display the 24-bit images on their 8-bit graphics systems. The BMP file format was chosen because it is very simple and is a standard format that can be displayed with many free programs.

Conclusion

I was generally pleased with the new orientation of the course. It was more intellectually satisfying to both me and the students. The students reacted positively, partially because they could create some very interesting images from their ray tracing pro grams. Since it was the first trial there are several things I will change the next time, but these are primarily in the help given the students in the assignments. Thus, except for some fine tuning, I will continue teaching the course this way.


References:

[FOLE90] James D. Foley, Andries van Dam, Steven K. Feiner, and John F. Hughes, Computer Graphics Principles and Practice, Addison-Wesley, 1990 (Second Edition).

[GLASS89] Andrew S. Glassner, An Introduction to Ray Tracing, Academic Press, 1989.

[OWEN90] G. Scott Owen, "Experiences in Teaching an Advanced Computer Graphics Course", Proceedings of the twenty-first SIGCSE Technical Symposium on Computer Science Education, February, 1990.

[OWEN91] G. Scott Owen, "A Two Quarter Computer Graphics Sequence", Computer Graphics, Vol. 25, Num. 3, July, 1993.

[OWEN92a] G. Scott Owen, "Teaching Computer Graphics Using Renderman", Proceedings of the Twenty-Third SIGCSE Technical Symposium on Computer Science Education, March, 1992.

[OWEN92b] G. Scott Owen, "HyperGraph - A Hypermedia System for Computer Graphics Education", Interactive Learning Through Visualization, S. Cunningham and R. J. Hubbold, ed., Springer-Verlag, 1992.

[PILA68] Frank L. Pilar, Elementary Quantum Chemistry, McGraw-Hill, 1968.

[UPST90] Steve Upstill, The RenderMan Companion, Addison-Wesley, 1990.

[WATT89] Alan Watt, Fundamentals of Three-Dimensional Computer Graphics, Addison-Wesley, 1989.

[WATT92] Alan Watt, Advanced Animation and Rendering Techniques, Addison-Wesley, 1992.


Examples:
Click here for examples.

Return to Research Papers.