Dean is a programmer/analyst developing graphics and imaging applications. He can be contacted at 71160.2426@compuserve.com.
While its applicability to economics may be uncertain, the trickle-down theory definitely applies to computing power, and where hardware goes, software is sure to follow. The two books I'll examine here provide a PC perspective on subjects that, until now, have been captives of high-end workstations. Radiosity: A Programmer's Perspective, by Ian Ashdown, explores the radiosity method for creating synthetic imagery, while the special-effects technique of image compositing is the topic of Tim Wittenburg's Photo-Based 3D Graphics in C++.
Unlike ray tracing, which is most efficient at simulating the contribution of external light sources on a scene, radiosity attempts to take into account the contribution of individual parts of a scene on all other parts. This is a fundamentally harder problem that, until recently, was considered beyond the power of the typical desktop computer. Ian Ashdown's Radiosity: A Programmer's Perspective breaks the PC barrier.
The book has three parts. The first is an introduction to the basic concepts of illumination and radiosity theory. The second discusses the program files used to describe scenes and a viewing system for displaying them. The last part--nearly half the book--covers calculating form factors (which form a matrix defining the radiant contributions of each patch in a scene on all other patches) and solving the radiosity equation itself.
Radiosity doesn't shirk the deeper theoretical underpinnings--or their equations. Ashdown assures us more than once that mathematical sophistication is not a prerequisite: The math is there, but it's explained carefully and thoroughly. Ashdown excels at explaining technical ideas in a style that is efficient and orderly, yet relaxed and conversational.
The book includes a disk with a working radiosity rendering program, Helios, C++ source code, and a few sample scenes. There's also a program to convert from the AutoCAD .DXF file format to the text format used by Helios. The program isn't fancy but it works. (An upgrade with an improved user interface is available from the author.) In several places, Ashdown suggests ways to optimize his implementation. His disk contains programs representing three different ways of calculating form factors: hemicube, cubic tetrahedron, and ray casting. The book also includes numerous ideas for extending the basic radiosity program, such as adaptive meshing and texture mapping.
Perhaps best of all are the extensive references, including over 200 bibliographical entries. And if that doesn't satisfy you, you can download a document containing over 700 radiosity references from the author's Web site at http://www.ledalite.com/library/rrt.html.
Radiosity is a first-class effort, both as a reference work and as a source of ready-to-wear code. Highly recommended.
Image compositing is a deceptively simple idea that's used extensively in the video and motion picture industries for producing special effects. It's what lets the Enterprise fly through a star field and makes dinosaur clones rattle around a kitchen.
Photo-Based 3D Graphics in C++ documents the algorithms and development of a program called Image Compositor's Toolkit (ICT), a Windows application for creating scenes composed of multiple cutout images that can be rotated, scaled, and positioned over a background image. The program combines these images using alpha blending, which uses a separate alpha-channel image to control the proportion of background versus cutout in the combined image. There are provisions for animating each of these effects. The C++ source code for this application is included on the book's diskette.
Photo is organized in three major sections, plus appendices. The "Fundamentals" section presents an overview of object-oriented design and C++, color representations, Windows bitmap images, 3-D coordinates and transforms, and the classes and file formats used in the book's code.
The next section, "Image Compositing Tools," discusses creating cutouts (irregular polygonal portions clipped from an image), warping (rotating and scaling the cutouts), alpha blending, hidden-surface removal, and animating. Again, the files and classes to implement these are presented.
The final section, "Applications," has two demonstration scenes for the book's application program, though the data files and images for the demonstrations aren't included. Appendices include a description of setting up and using the ICT program (which runs under Windows 3.1 or Windows 95), an index to ICT functions and classes and the files that contain them, and a bibliography.
Wittenburg tries to cover so much territory that none of it has much depth. The C++ and OOD sections are barely introductions, as is the section on using the Borland IDE. The chapter on image warping, which is essentially about texture mapping, mentions aliasing as a potential problem; but rather than deal with it in general terms, Wittenburg restricts his discussion to the blockiness caused by enlarging an image. The morphing technique Wittenburg describes may be "morphing" in a strict technical sense, but it isn't the effect that most of us associate with the word.
The book's diskette contains source code and Borland project files for building the ICT application--there's no executable on the diskette. The program compiled under BC 4.51 with only a few warnings. ICT uses Borland's OWL for interface code. Visual C++/MFC source is also supplied, but I didn't test it.
ICT works pretty much as advertised. Using the ICT, you can display color images (only 24-bit .BMP images are supported), create cutouts and alpha-channel images for compositing, and experiment with transformations. To create composite images you have to create a scene file--a text file that describes the different images to be pulled together and the transforms to apply to them--but ICT can't generate scene files; it can only read, preview, and render them. The diskette contains a second program called "Scene File Maker" which automates the creation of ICT scene files. Oddly, this program is written in Visual Basic instead of C++. An executable is included on the diskette.
Image compositing, particularly applied to animation/video, is a fascinating and rarely encountered topic that could use a solid, down-to-earth, hands-on treatment. While it's good as far as it goes, Photo-Based 3D Graphics in C++ should not be considered more than an introduction.
Radiosity: A Programmer's Perspective
Ian Ashdown
John Wiley & Sons, 1994
$59.95
ISBN 0-471-30488-3
Photo-Based 3D Graphics in C++
Tim Wittenburg
John Wiley & Sons, 1995
$44.95
ISBN 0-471-04972-7