SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
The first comprehensive collection of practical techniques, tips, and tricks for programming real-time computer graphics.
° Removes the mystery behind complex effects and reveals the full potential of programmable GPUs (graphics processing units)
° Covers some of the coolest and most difficult effects, such as simulating fire, water, and waving blades of grass
° Contains advice from experts with major graphics companies such as Softimage, AliasWavefront, Industrial Light and Magic, and Sony
GPU Gems has won a prestigious Front Line Award from Game Developer Magazine. The Front Line Awards recognize products that enable faster and more efficient game development, advancing the state of the art.
FULL COLOR THROUGHOUT!
“This collection of articles is particularly impressive for its depth and breadth. The book includes product-oriented case studies, previously unpublished state-of-the-art research, comprehensive tutorials, and extensive code samples and demos throughout.”
—Eric Haines, Author of Real-Time Rendering
“GPU Gems is a cool toolbox of advanced graphics techniques. Novice programmers and graphics gurus alike will find the Gems practical, intriguing and useful.”
—Tim Sweeney, Lead Programmer of Unreal at Epic Games
GPU Gems is a compilation of articles covering practical real-time graphics techniques arising from the research and practice of cutting-edge developers. It focuses on the programmable graphics pipeline available in today’s graphics processing units (GPUs) and highlights quick and dirty tricks used by leading developers, as well as fundamental, performance-conscious techniques for creating advanced visual effects. The contributors and editors, collectively, bring countless years of experience to enlighten and propel the reader into the fascinating world of programmable real-time graphics.
Major topics covered include:
Contributors are from the following universities and corporations:
The accompanying CD-ROM includes complementary examples and sample programs.
Chapter 3 was such a huge demand from our readers that the authors have agreed to share with you an additional free chapter from their book.
Download the sample chapters related to this title:
Chapter
3: Skin in the "Dawn: demo
Chapter
14: Perspective Shadow Maps
Foreword.
Preface.
Contributors.
I. NATURAL EFFECTS.
1. Effective Water Simulation from Physical Models, Mark Finch, (Cyan Worlds).Goals and Scope.
The Sum of Sines Approximation.
Authoring.
Runtime Processing.
Conclusion.
References.
2. Rendering Water Caustics, Juan Guardado, (NVIDIA) and Daniel Sanchez-Crespo, (Universitat Pompeu Fabra/Novarama Technology).Introduction.
Computing Caustics.
Our Approach.
Implementation Using OpenGL.
Implementation Using a High-Level Shading Language.
Conclusion.
References.
3. Skin in the "Dawn" Demo, Curtis Beeson, (NVIDIA) and Kevin Bjorke, (NVIDIA).Introduction.
Skin Shading.
Lighting the Scene.
How Skin Responds to Light.
Implementation.
Conclusion.
References.
4. Animation in the "Dawn" Demo, Curtis Beeson, (NVIDIA).Introduction.
Mesh Animation.
Morph Targets.
Skinning.
Conclusion.
References.
5. Implementing Improved Perlin Noise, Ken Perlin, (New York University).The Noise Function.
The Original Implementation.
Deficiencies of the Original Implementation.
Improvements to Noise.
How to Make Good Fake Noise in Pixel Shaders.
Making Bumps Without Looking at Neighboring Vertices.
Conclusion.
References.
6. Fire in the "Vulcan" Demo, Hubert Nguyen, (NVIDIA).Creating Realistic Flames.
Implementing Animated Sprites.
Particle Motion.
Performance.
Post-Rendering Effects.
Conclusion.
7. Rendering Countless Blades of Waving Grass. Kurt Pelzer, (Piranha Bytes).Introduction.
Overview.
Preparation of the Grass Objects.
Animation.
Conclusion.
Further Reading.
8. Simulating Diffraction, Jos Stam, (Alias Systems).What Is Diffraction?
Implementation.
Results.
Conclusion.
References.
II. LIGHTING AND SHADOWS.
9. Efficient Shadow Volume Rendering, Morgan McGuire, (Brown University).Introduction.
Program Structure.
Detailed Discussion.
Debugging.
Geometry Optimizations.
Fill-Rate Optimizations.
Future Shadows.
References.
10. Cinematic Lighting, Fabio Pellacini and Kiril Vidimce, (Pixar Animation Studios).Introduction.
A Direct Lighting Illumination Model.
The Uberlight Shader.
Performance Concerns.
Conclusion.
References.
11. Shadow Map Antialiasing, Michael Bunnell, (NVIDIA) and Fabio Pellacini, (Pixar Animation Studios).Introduction.
Percentage-Closer Filtering.
A Brute-Force Implementation.
Using Fewer Samples.
Why It Works.
Conclusion.
References.
12. Omnidirectional Shadow Mapping, Philipp S. Gerasimov, (iXBT.com).Introduction.
The Shadow-Mapping Algorithm.
Implementation.
Adding Soft Shadows.
Conclusion.
References.
13. Generating Soft Shadows Using Occlusion Interval Maps, William Donnelly, (University of Waterloo) and Joe Demers, (NVIDIA).The Gas Station.
The Algorithm.
Creating the Maps.
Rendering.
Limitations.
Conclusion.
References.
14. Perspective Shadow Maps: Care and Feeding, Simon Kozlov, (SoftLab-NSK).Introduction.
Problems with the PSM Algorithm.
Tricks for Better Shadow Maps.
Results.
References.
15. Managing Visibility for Per-Pixel Lighting, John O'Rorke, (Monolith Productions).Visibility in a GPU Book?
Batches and Per-Pixel Lighting.
Visibility As Sets.
Generating Sets.
Visibility for Fill Rate.
Practical Application.
Conclusion.
References.
III. MATERIALS.
16. Real-Time Approximations to Subsurface Scattering, Simon Green, (NVIDIA).The Visual Effects of Subsurface Scattering.
Simple Scattering Approximations.
Simulating Absorption Using Depth Maps.
Texture-Space Diffusion.
Conclusion.
References.
17. Ambient Occlusion, Matt Pharr, (NVIDIA) and Simon Green, (NVIDIA).Overview.
The Preprocessing Step.
Hardware-Accelerated Occlusion.
Rendering with Ambient Occlusion Maps.
Conclusion.
Further Reading.
18. Spatial BRDFs. David McAllister, (NVIDIAWhat Is an SBRDF?
Details of the Representation.
Rendering Using Discrete Lights.
Rendering Using Environment Maps.
Conclusion.
References.
19. Image-Based Lighting, Kevin Bjorke, (NVIDIA).Localizing Image-Based Lighting.
The Vertex Shader.
The Fragment Shader.
Diffuse IBL.
Shadows.
Using Localized Cube Maps As Backgrounds.
Conclusion.
Further Reading.
20. Texture Bombing, R. Steven Glanville, (NVIDIA).Texture Bombing.
Technical Considerations.
Advanced Features.
Conclusion.
References.
IV. IMAGE PROCESSING.
21. Real-Time Glow, Greg James, (NVIDIA) and John O'Rorke, (Monolith Productions).Overview of the Technique.
Rendering Glows: Step by Step.
Hardware-Specific Implementations.
Other Uses for Blur.
Adding the Effects to a Game Engine.
Conclusion.
References.
22. Color Controls, Kevin Bjorke, (NVIDIA).Introduction.
Channel-Based Color Correction.
Multichannel Color Correction and Conversion.
References.
23. Depth of Field: A Survey of Techniques, Joe Demers, (NVIDIA).What Is Depth of Field?
Ray-Traced Depth of Field.
Accumulation-Buffer Depth of Field.
Layered Depth of Field.
Forward-Mapped Z-Buffer Depth of Field.
Reverse-Mapped Z-Buffer Depth of Field.
Conclusion.
References.
24. High-Quality Filtering, Kevin Bjorke, (NVIDIA).Quality vs. Speed.
Understanding GPU Derivatives.
Analytical Antialiasing and Texturing.
Conclusion.
References.
25. Fast Filter-Width Estimates with Texture Maps, Matt Pharr, (NVIDIA).The Need for Derivatives in Shaders.
Computing Filter Width with Textures.
Discussion.
Further Reading.
26. The OpenEXR Image File Format, Florian Kainz, Rod Bogart, and Drew Hess, (Industrial Light and Magic).What Is OpenEXR?
The OpenEXR File Structure.
OpenEXR Data Compression.
Using OpenEXR.
Linear Pixel Values.
Creating and Using HDR Images.
Conclusion.
References.
27. A Framework for Image Processing, Frank Jargstorff, (NVIDIA).Introduction.
Framework Design.
Implementation.
A Sample Application.
Performance and Limitations.
Conclusion.
References.
V. PERFORMANCE AND PRACTICALITIES.
28. Graphics Pipeline Performance, Cem Cebenoyan, (NVIDIA).Overview.
Locating the Bottleneck.
Optimization.
Conclusion.
References.
29. Efficient Occlusion Culling, Dean Sekulic, (Croteam).What Is Occlusion Culling?
How Does Occlusion Query Work?
Beginning to Use Occlusion Queries.
One Step Further.
A Word About Bounding Boxes.
Other Issues.
A Little Reminder.
An Application: Lens Flares.
Conclusion.
References.
30. The Design of FX Composer, Christopher Maughan, (NVIDIA).Tools Development.
Initial Features and Target Audience.
Object Design.
File Format.
User Interface.
Direct3D Graphics Implementation.
Scene Management.
Conclusion.
References.
31. Using FX Composer, Christopher Maughan, (NVIDIA).Getting Started.
Sample Project.
Conclusion.
32. An Introduction to Shader Interfaces, Matt Pharr, (NVIDIA).The Basics of Shader Interfaces.
A Flexible Description of Lights.
Material Trees.
Conclusion.
References.
33. Converting Production RenderMan Shaders to Real-Time, Stephen Marshall, (Sony Pictures Imageworks).Introduction.
Lights.
The Vertex Program vs. the Fragment Program.
Using Vertex and Fragment Programs.
Optimization Techniques on the Fragment Program.
Results and Conclusions.
References.
34. Integrating Hardware Shading into Cinema 4D, Jorn Loviscach, (Hochschule Bremen).Introduction.
Connecting Cinema 4D to CgFX.
Shader and Parameter Management.
Emulating the Offline Renderer.
Results and Performance.
Lessons Learned.
References.
35. Leveraging High-Quality Software Rendering Effects in Real-Time Applications, Alexandre Jean Claude, and Marc Stevens, (Softimage).Introduction.
The Content Pipeline for Hardware Rendering.
Components of Hardware Rendering.
Generating the Components.
Test Case and Results.
Conclusion.
References.
36. Integrating Shaders into Applications, John O'Rorke, (Monolith Productions).Introduction.
About Shaders.
The Anatomy of an Effect File.
Types of Shader Data.
Communicating with the Shader.
Extending the Effect File Format.
Conclusion.
References.
VI. BEYOND TRIANGLES.
37. A Toolkit for Computation on GPUs, Ian Buck, and Tim Purcell, (Stanford University).Computing with the GPU.
Reduce.
Sort and Search.
Challenges.
Conclusion.
Further Reading.
38. Fast Fluid Dynamics Simulation on the GPU, Mark J. Harris, (University of North Carolina at Chapel Hill).Introduction.
Mathematical Background.
Implementation.
Applications.
Extensions.
Conclusion.
References.
39. Volume Rendering Techniques, Milan Ikits, (University of Utah), Joe Kniss, (University of Utah), Aaron Lefohn, (University of California, Davis) and Charles Hansen, (University of Utah).Introduction.
Volume Rendering.
Texture-Based Volume Rendering.
Implementation Details.
Advanced Techniques.
Performance Considerations.
Summary.
References.
40. Applying Real-Time Shading to 3D Ultrasound Visualization, Thilaka Sumanaweera, (Siemens Medical Solutions USA, Inc.).Background.
Introduction.
Results.
Conclusion.
References.
41. Real-Time Stereograms, Fabio Policarpo, (Paralelo Computacao Ltda.).What Is a Stereogram?
Creating a Single-Image Stereogram.
Sample Application.
References.
42. Deformers, Eugene d'Eon, (University of Waterloo).What Is a Deformer?
Deforming on the GPU.
Limitations.
Performance.
Example: Wave Deformer.
Conclusion.
Index.
Now is an excellent time to be working in the field of computer graphics. Over the past five years, GPU technology has advanced in astounding ways, and at an explosive pace. The rendering rate, as measured in pixels per second, has been approximately doubling every six months during those five years. A factor of two is certainly exciting enough, but more exciting is the wonder of compounding. Five years represents the doubling of performance ten times-that's two to the tenth power, a factor of one thousand!
Not only has performance increased, but also the quality of computation and the flexibility of graphics programming have steadily improved during that same time. Five years ago, PCs and computer workstations had graphics accelerators, not graphics processing units (GPUs). The implication was that a graphics accelerator does simply that: it accelerates graphics. Furthermore, the word accelerator implied that the computer would perform exactly the same rendering operations as before, only faster. As graphics accelerators were replaced by GPUs, we abandoned the old concept of graphics acceleration. We advanced to graphics processing, embracing the idea of processors that enable new graphics algorithms and effects.
We have entered the era of programmable GPUs. The graphics hardware pipeline, which had not previously changed significantly in twenty years, was broken down to its component, hard-wired elements and rebuilt out of programmable, parallel-pipelined processors. In a hard-wired pipeline, triangle vertices are transformed and lit, triangles are rasterized, and pixels are shaded with diffuse lighting, specular exponentiation, fog blending, and frame-buffer blending. In a programmable pipeline, each of these operations is abstracted to its component memory accesses and mathematical operations. A programmer can still write a program that calculates the same results as a hard-wired pipeline (and in fact, such a program is often the first one a student programmer writes for a programmable processor!), but the opportunity presented is so much greater than this.
The first effects of fast, programmable GPUs are subtle. Previously difficult graphics problems become much more tractable through the application of one thousand-fold performance increases. Offline rendering techniques become more practical for interactive applications. Historically, brute force has been a popular algorithmic approach; simply casting a graphics problem in a way that it can run on a GPU is an unsubtle application of brute force-it works, but it leaves opportunity on the table.
Beyond that, algorithm development gets more interesting. Graphics programmers can now experiment with new algorithms and techniques that would not have been practical on a slower, single-threaded serial processor such as a CPU. The parallel-stream-processing nature of the GPU, coupled with flexibility and programmability, allows new algorithms to be developed and invites experimentation. Any computationally demanding problem-not just graphics-that can take advantage of large-scale parallelism, larger memory bandwidth, and geometric performance growth is a good candidate for GPU implementation. As an industry, we're still learning which problems will benefit most from GPU solutions.
The true beneficiaries of the programmable GPU revolution are the computer graphics algorithm designer, the researcher, the application developer, and ultimately the end user or consumer-the gamer, the moviegoer, and so on. GPU Gems is a timely book, as the GPU programming field is young and vibrant, and many developers are reinventing the same techniques again and again. This volume contains straightforward applications of known techniques to a structure more amenable to GPU execution, as well as innovative new algorithms and effects that were not previously possible.
At this time in the history of GPU programming, many problems remain unsolved and many challenges remain unmet. Consequently, this first volume of GPU Gems is a compendium of approaches and examples of work carried out so far, rather than a cookbook of completed effects to be plugged into applications. This collection will allow programmers to benefit from the exciting progress already made, and it will enable tomorrow's developers to stand on the shoulders of giants, the pioneers of programming GPUs. It's up to you to take the next steps of innovation!
David Kirk
Chief Scientist
NVIDIA Corporation
Download the Index
file related to this title.