X

Post-Siggraph book review: "GPU Gems 3"

Glaskowsky reviews the latest in a series of GPU programming guides.

Peter Glaskowsky
Peter N. Glaskowsky is a computer architect in Silicon Valley and a technology analyst for the Envisioneering Group. He has designed chip- and board-level products in the defense and computer industries, managed design teams, and served as editor in chief of the industry newsletter "Microprocessor Report." He is a member of the CNET Blog Network and is not an employee of CNET. Disclosure.
Peter Glaskowsky
3 min read

As I described in my recent blog entries about Siggraph 2007, there's a lot of cool stuff going on in hardware and software development for graphics processors (GPUs).

GPUs are programmable devices like the more familiar CPUs, but the programing model is very different. A CPU core implements a simple linear model; programs consist of one instruction after another, though a good CPU scans the instruction stream for opportunities to execute a few instructions in parallel. A busy GPU, on the other hand, always does hundreds of things at once. CPUs aren't good at running GPU code, and vice-versa.

Most new computer-science graduates have a good understanding of CPU programming, but GPU programming is a very different skill that is usually acquired after a software engineer enters the workforce. And since GPU designs change dramatically every year or two, and different vendors build their chips differently, GPU programming skills must be constantly relearned.

All GPU vendors offer training for the engineers who program their chips, and this training comes in many forms. NVIDIA's developer-training program produces the "GPU Gems" series of books. The title is an homage to the "Graphics Gems" series of the early 1990s, which documented the rapid progress of the computer-graphics industry during that time. The Graphics Gems books are still in print and still indispensible for graphics software developers.

GPU Gems 3, edited by Hubert Nguyen and published by Addison-Wesley, is the latest in the new series. It's full of programming examples that are specific to NVIDIA's software-development environment, but the principles behind the examples can also be applied to AMD graphics chips.

The techniques described in this book, combined with the latest graphics chips from AMD or NVIDIA, can produce amazing results. Like the other GPU Gems volumes, GPU Gems 3 is printed in full color so readers can see exactly what they're going to get. Chapter 14, titled "Advanced Techniques for Realistic Real-Time Skin Rendering," also contributed the cover image: a truly photorealistic rendering of a human face.

This image can be rendered in real time on a state-of-the-art graphics chip-- but just barely, so it'll be a while before the necessary techniques can be incorporated into games.

Chapter 14 also illustrates the key to achieving these results. In the real world, a scene like this cover image would be "rendered" using about 10^20 (100 quintillion) photons interacting with an even larger number of atoms in the subject's face before a tiny fraction of them end up in the viewer's eyes.

In a GPU, it's impossible to model the behavior of all of those photons. A different type of rendering known as ray tracing works this way, but is too slow to produce good results in real time.

Instead, GPU programming consists of one drastic shortcut after another. Objects start out as roughly faceted collections of polygons. Surface appearance is defined by 2D artwork wrapped around the object. The perspective errors that would otherwise appear in this artwork are smoothed out by other tricks. Lighting effects, such as the subsurface scattering that real photons would undergo, are faked by another series of tricks.

The process of 3D rendering mimics the evolution of 3D rendering-- a progression of tricks creating images by successive approximation.

Expertise in GPU programming consists of achieving the best results within the performance limits of the hardware available. In practical terms, this means that the more shortcuts you use, the better your results. A new method that yields 90% of the visual quality from 50% of the instructions means a second layer of refinements can be applied, producing better results than the full-quality version of the first effect.

Hence the focus of the GPU Gems books. They're essential for anyone working in computer graphics, and fascinating reading for those who can handle the complicated math and want to know how these amazing results are achieved.