GPU Gems

GPU Gems

GPU Gems is now available, right here, online. You can purchase a beautifully printed version of this book, and others in the series, at a 30% discount courtesy of InformIT and Addison-Wesley.

The CD content, including demos and content, is available on the web and for download.


Curtis Beeson moved from SGI to NVIDIA's Demo Team more than five years ago; he focuses on the art path, the object model, and the DirectX renderer of the NVIDIA demo engine. He began working in 3D while attending Carnegie Mellon University, where he generated environments for playback on head-mounted displays at resolutions that left users legally blind. Curtis specializes in the art path and object model of the NVIDIA Demo Team's scenegraph API—while fighting the urge to succumb to the dark offerings of management in marketing.

Kevin Bjorke works in the Developer Technology group developing and promoting next-generation art tools and entertainments, with a particular eye toward the possibilities inherent in programmable shading hardware. Before joining NVIDIA, he worked extensively in the film, television, and game industries, supervising development and imagery for Final Fantasy: The Spirits Within and The Animatrix; performing numerous technical director and layout animation duties on Toy Story and A Bug's Life; developing games on just about every commercial platform; producing theme park rides; animating too many TV commercials; and booking daytime TV talk shows. He attended several colleges, eventually graduating from the California Institute of the Arts film school. Kevin has been a regular speaker at SIGGRAPH, GDC, and similar events for the past decade.

Rod Bogart came to Industrial Light & Magic (ILM) in 1995 after spending three years as a software engineer at Pacific Data Images. His early work in camera tracking is published in Graphics Gems II. At ILM, Rod developed the core engine of the interactive compositing tools, and he oversaw much of the design and implementation of ILM's other imageprocessing and image-viewing techniques.

Ian Buck is completing his Ph.D. in computer science at the Stanford University Graphics Lab, researching general-purpose computing models for GPUs. His research focuses on programming language design for graphics hardware, as well as general-computing applications that map to graphics hardware architectures. Ian received his B.S.E. in computer science from Princeton University in 1999 and is a recipient of Stanford School of Engineering and NVIDIA fellowships.

Michael Bunnell graduated from Southern Methodist University with degrees in computer science and electrical engineering. He wrote the Megamax C compiler for the Macintosh, Atari ST, and Apple IIGS before co-founding what is now LynuxWorks. After working on real-time operating systems for nine years, he moved to Silicon Graphics, focusing on image processing and on video and graphics software. Next, he worked at Gigapixel, then at 3dfx, and now he works at NVIDIA, where, interestingly enough, he is developing compilers again—this time, shader compilers.

Cem Cebenoyan is a software engineer working in the Developer Technology group. He spends his days researching graphics techniques and helping game developers get the most out of graphics hardware. He has spoken at past Game Developer Conferences on character animation, graphics performance, and nonphotorealistic rendering. Before joining NVIDIA, Cem was a student/research assistant in the Graphics, Visualization, and Usability Lab at the Georgia Institute of Technology.

Joe Demers received a B.S. from Carnegie Mellon University and an M.S. from the University of Southern California. He worked on Nendo, a simple but powerful 3D modeling and painting package from Nichimen Graphics, and on numerous demos at NVIDIA, where he has worked since 1999.

Eugene d'Eon recently completed a B.S. in applied mathematics and computer science at the University of Waterloo. He currently resides in California, working on the Demo Team at NVIDIA. He can occasionally be found in the office playing piano late at night.

Sim Dietrich manages the U.S. Developer Technology team at NVIDIA. Sim has written chapters for Game Programming Gems 1 and Game Programming Gems 2 and served as editor of the Graphics Display section of Gems 2. Sim was a key contributor to the CgFX effort, bringing real-time shaders to 3ds max, Maya, and Softimage|XSI for the first time. Sim's interests include new shadow techniques and improving graphics workflow through efforts such as Cg and CgFX.

William Donnelly is an undergraduate student in mathematics and computer science at the University of Waterloo in Ontario. He has completed internships with Okino Computer Graphics, writing extensions to the NuGraf ray tracer, and with NVIDIA, creating real-time graphics demos for the GeForce FX. He has been destined for computer graphics ever since his dreams were shattered at the age of eight upon discovering that Lego set building was not a viable career path.

Randima (Randy) Fernando has loved computer graphics from the age of eight. Working in NVIDIA's Developer Technology group, he helps teach developers how to take advantage of the latest GPU technology. Randy has a B.S. in computer science and an M.S. in computer graphics, both from Cornell University. He has been published in SIGGRAPH and is the coauthor (along with Mark Kilgard) of The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics.

Mark Finch has a B.S. in physics from Georgia Institute of Technology and an M.S. in computer science from the University of North Carolina at Chapel Hill. His professional graphics work started when he did image processing and rendering for the Star Wars program, but he soon moved to game programming, which he finds equally challenging and more constructive. He is currently the graphics programmer behind Cyan's Uru project.

Philipp Gerasimov is a Russian 3D programmer and game designer. He is currently working on the creation of RightMark 3D, an open-source 3D hardware benchmark by iXBT.

Steve Glanville received his Ph.D. in computer science from UC Berkeley in 1977. In 1978, he founded Silicon Valley Software and served as president for 15 years, where he developed C and FORTRAN compilers. After spending too many years attending SIGGRAPH, in 1995 he finally made the switch to graphics and began developing OpenGL drivers. His past eventually caught up with him, however, and he is now one of the principal designers and implementers of the Cg language at NVIDIA.

Simon Green is an engineer in the Developer Technology group at NVIDIA. After graduating from Reading University, England, with a degree in computer science, Simon worked in the video game industry for two years before emigrating to the United States to work for Silicon Graphics. He has presented at the Game Developer and Apple World Wide Developer conferences. His interests include OpenGL, cellular automata, image-based rendering, and analog synthesizers. He spends his time at NVIDIA thinking up new and interesting ways to abuse graphics hardware.

In between riding camelback through the Sahara and lounging on the Brazilian coast, Juan Guardado enjoys contributing graphics technologies to the computer game industry. After graduating from McGill University with a bachelor's degree in computer engineering, he joined Matrox Graphics, where his work culminated in the development of hardware-accelerated displacement mapping. He now works at NVIDIA with the Developer Technology team based in the United Kingdom. He has given numerous talks at industry events, including GDC (U.S. and Europe), and he has been published in ShaderX and in Gamasutra online magazine.

Charles Hansen received a B.S. in computer science from Memphis State University in 1981 and a Ph.D. in computer science from the University of Utah in 1987. He is currently an associate professor of computer science at the University of Utah. From 1989 to 1997, he was a technical staff member in the Advanced Computing Laboratory (ACL) located at Los Alamos National Laboratory, where he formed and directed the visualization efforts of the ACL. He was a Bourse Chateaubriand Postdoctoral Fellow at INRIA Rocquencourt, France, in 1987 and 1988. His research interests include large-scale scientific visualization and computer graphics.

Mark Harris received a B.S. from the University of Notre Dame in 1998 and a Ph.D. in computer science from the University of North Carolina at Chapel Hill in 2003. At UNC, Mark's research covered a wide variety of computer graphics topics, including real-time cloud simulation and rendering, general-purpose computation on GPUs, global illumination, nonphotorealistic rendering, and virtual environments. During his graduate studies, Mark worked briefly at Intel, iROCK Games, and NVIDIA. Mark now works with NVIDIA's Developer Technology team based in the United Kingdom.

Drew Hess is a software developer in the Software Research and Development department at Industrial Light & Magic. In a past life, he was a member of the IA-64 architecture team at Intel Corporation. Drew received a B.S. in computer engineering from the University of Illinois at Urbana-Champaign and an M.S. in computer science from Stanford University.

Milan Ikits is a Ph.D. candidate in the School of Computing at the University of Utah and a research assistant at the Scientific Computing and Imaging Institute. His current research interests lie in the areas of computer graphics, scientific visualization, immersive environments, and human-computer interaction. He received a diploma in computer science from the Budapest University of Technology and Economics in 1997. Milan is the creator of the popular OpenGL Extension Wrangler library (GLEW).

Growing up in a house where 3D graphics movies and computers were left unlocked and out in plain sight, it's no wonder that Greg James became addicted to graphics at an early age. Attempts to cure him using respectable math and science have failed, but he did come away with a B.S. in physics and a minor in studio art in 1995. Fortunately, Greg has found a safe environment with the developer community outreach program at NVIDIA, where he helps himself and others work through their afflictions. He has developed and contributed to visual effects in many games. Among these are the reflective water animation in Morrowind, the glow in Tron 2.0, and a volume translucency effect for an upcoming title. His works have appeared in various computer graphics and physics publications, and he is particularly excited by the combination of physics and computer graphics.

Frank Jargstorff is a software engineer working on the Developer Technology team. He works on tools for digital content creation and helps DCC companies integrate new technologies into their products. Before joining NVIDIA, he worked for IBM, CoCreate, and Fraunhofer Research on topics ranging from streaming 3D to mainframe operating systems. Frank received his degree in computer science in 1997 from the University of Tübingen, Germany.

Alexandre Jean Claude currently works as the team lead for rendering and pipeline at Softimage. For the past few years, he has focused on game development pipelines and hardware-rendering technologies. He graduated from the Université du Québec à Montréal in computer science.

Florian Kainz joined Industrial Light & Magic (ILM) in 1995 as a member of the research and development group. In his current role of computer graphics principal engineer, he leads the team that is responsible for the core architecture of ILM's in-house computer animation system. Kainz has worked on developing particle, fur, and implicit surface renderers, as well as a network protocol that forms the basis of a fault-tolerant, distributed batch-processing system. Kainz is one of the authors of the OpenEXR file format. Before joining ILM, Kainz worked as a software engineer for Steiner Film in Munich, Germany, and for Twenty-Five Frames in Singapore, writing image-processing and 3D rendering software. He received a degree in computer science in 1992 from the Technical University in Munich, Germany.

Joe Kniss received a B.S. in 1999 from Idaho State University and an M.S. in computer science from the University of Utah in 2002. He is currently pursuing a Ph.D. in computer science at the University of Utah, where he is a member of the Scientific Computing and Imaging Institute. His research interests include computer graphics, light transport in participating media, human-computer interaction, and immersive environments.

Simon Kozlov graduated from Novosibirsk State University in June 2003, specializing in physics and computer science. Since 2001, Simon has worked at SoftLab-NSK, a game developer in Russia. Simon's current project is Rig 'n' Roll, a truck simulation game.

Aaron Lefohn is a Ph.D. student in the computer science department at the University of California at Davis and a graphics software engineer at Pixar Animation Studios. His research interests include general computation with graphics hardware, photorealistic rendering, and physically based animation. Aaron received an M.S. in computer science from the University of Utah in 2003, an M.S. in theoretical chemistry from the University of Utah in 2001, and a B.A. in chemistry from Whitman College in 1997. Aaron is an NSF graduate fellow in computer science.

Jörn Loviscach published many articles in popular computing magazines about programming and electronic music before receiving his doctorate degree in mathematical physics in 1993. He later worked at several computer magazines, becoming deputy editor-in-chief of the German computer magazine c't. He remained in this position for three years before accepting a professorship at Hochschule Bremen (University of Applied Sciences) in 2000, where he now teaches and researches in the field of computer graphics.

Stephen Marshall has worked as a software engineer at Sony Pictures Imageworks and currently is an effects technical director. Before joining Imageworks, Stephen was a developer in Engineering Animation's software and litigation animation divisions.

Chris Maughan has worked in the graphics hardware industry for 10 years. He began his career working on a video digitizer product for a startup company, soon followed by a move to 3Dlabs, where he wrote the first OpenGL device driver for Windows 95, in collaboration with Microsoft. Chris then developed the company's DirectX driver, staying for five years before leaving to join NVIDIA. At NVIDIA, he works in the Developer Technology group, focusing on providing tools and sample software for game developers. Chris works from home in York, in the north of England, where he lives with his wife, Stacey. He's still trying to figure out what he did right to get the girl, the job, and the location.

David McAllister has been a computer graphics architect for NVIDIA since 2000. He received a Ph.D. in computer science from the University of North Carolina at Chapel Hill in 2002, where he did research in image-based rendering, reflectance measurement and representation, and graphics hardware. He spent the summer of 1997 at Hewlett-Packard working on the PixelFlow graphics supercomputer. David worked at Evans & Sutherland from 1989 to 1996 and received a B.S. from the University of Utah in 1995. David lives in Salt Lake City, Utah.

Morgan McGuire leads the Games Research Group at Brown University. His Ph.D. research is on real-time global illumination models for games. He has received master's degrees from MIT and Brown University, and he is the project manager for the Open Source G3D library at

Hubert Nguyen is a software engineer at NVIDIA working on the Demo Team. He spends his time searching for novel effects that show off the features of NVIDIA's latest GPUs. He has spoken at past Game Developer Conferences on the techniques used to create NVIDIA demos. Before joining NVIDIA, Hubert was an engineer at 3dfx Interactive, the creators of Voodoo graphics. Prior to 3dfx, Hubert was part of the R&D department of Cryo Interactive (Paris, France). Hubert started to develop 3D graphics programs when he was involved in the European demoscene. He holds a bachelor's degree in computer science.

John O'Rorke has been creating games since the age of six. During high school, he worked after school with Hewlett-Packard in their firmware division and then attended the DigiPen Institute of Technology. He is currently an engine architect at Monolith Productions, where he has worked on Aliens vs. Predator 2, Tron 2.0, No One Lives Forever 2: A Spy in H.A.R.M.'s Way, and is currently developing engine technology for future products.

Fabio Pellacini was born in Italy, where he spent the first 24 years of his life. During this time, he received a Laurea degree in physics from University of Parma and worked one year for Milestone building a physics engine. Following this experience, he decided to pursue his interests in computer graphics by moving to the United States, where he received a Ph.D. in computer graphics from Cornell University and published a few papers (four of which luckily got accepted to SIGGRAPH). These days he is spending his time in a dark office at Pixar Animation Studios designing and implementing the next generation of lighting technology for the studio.

Kurt Pelzer is a senior software engineer at Piranha Bytes, where he worked on the PC game Gothic, the top-selling Gothic II (awarded "RPG of the Year" in Germany during 2001 and 2002, respectively), and the add-on Gothic II: The Night of the Raven. Previously, he was a senior programmer at Codecult and developed several real-time simulations and technology demos built on Codecult's high-end 3D engine Codecreatures (for example, a simulation of the Shanghai TRANSRAPID track for SIEMENS AG, and the well-known Codecreatures Benchmark Pro). He has published in ShaderX 2 and Game Programming Gems 4.

Ken Perlin, a professor in the NYU Department of Computer Science, directs the Media Research Laboratory and Center for Advanced Technology. He has received an Academy Award for his procedural texturing algorithms (widely used in games and films), the New York City Mayor's Award for Excellence in Science and Technology, the Sokol Faculty Award for outstanding NYU science faculty, and a National Science Foundation Presidential Young Investigator Award. Ken received a Ph.D. in computer science from NYU and a B.A. in theoretical mathematics from Harvard. He has headed software development at R/GA and Mathematical Applications Group, Inc., and has worked on various films, starting with Tron. He serves on the board of directors of the New York Software Industry Association.

Matt Pharr is a member of the technical staff at NVIDIA, where he works on issues related to high-quality interactive graphics, programmable shading, and language features in the Cg group. Previously, he was a co-founder of Exluna, which developed offline rendering software, and was investigating advanced shading algorithms for graphics hardware. He was a Ph.D. student in the Stanford University Graphics Lab, where he researched systems issues for rendering and the theoretical foundations of rendering; he published a series of SIGGRAPH papers on these topics. With Greg Humphreys, he is the author of the book Physically-Based Rendering: From Theory to Implementation, which will be published in 2004.

Fabio Policarpo graduated from UFF Federal University in Rio de Janeiro and has written books and applications for classical and real-time computer graphics. Fabio has coauthored the books The Computer Image, 3D Games Volume 1, and 3D Games Volume 2, with Alan Watt (both published by Addison-Wesley).

Tim Purcell is finishing his Ph.D. in computer science at Stanford University. He received a B.S. in computer science from the University of Utah in 1998 and an M.S. in computer science from Stanford University in 2001. He is a recipient of the National Science Foundation Graduate Research Fellowship and is an NVIDIA fellowship winner. His current research interests include stream programming, ray tracing, and leveraging GPUs for general-purpose computation.

Daniel Sánchez-Crespo is one of the leading voices in game research in Spain and Europe. His academic career started in 1997, working as a researcher on user interfaces and virtual reality at Universitat Politècnica de Catalunya in Barcelona, Spain. By 2001, he had founded Europe's first master's degree in video game creation, held at Universitat Pompeu Fabra, where he still teaches and serves as the degree's director. He's written three books, most recently Core Techniques and Algorithms in Game Programming, published by New Riders/Prentice-Hall. His latest venture is Novarama, a game development studio focused on new forms of entertainment for the masses and recently recognized as Spain's third most innovative company for 2003.

With a couple of his best friends, Dean Sekulic founded Croteam in 1993, right after he realized that making computer games could be more fun than just playing them. For the last couple of years, he has specialized in coding sound and vision. He also graduated from Zagreb University of Business Informatics and Computer Design in 1996, and with a little luck, he hopes to stay in computer game programming for the next one or two hundred years.

John Spitzer is director of European Developer Technology at NVIDIA, where he oversees development of tools, technology, art, and educational materials for the 3D software development community. John collaborates with game developers on a daily basis, evaluating the technology in their games and assisting in the implementation of advanced visual effects. John has participated in a number of industry standards committees relating to 3D graphics, including the OpenGL Architectural Review Board (ARB), and is a founding member and chair of the SPEC OpenGL Performance Characterization (SPECopc) organization. While serving on SPECopc, John defined, designed, and implemented the industry-standard SPECglperf benchmark. John presents at many developer educational events each year on topics ranging from performance optimization to advanced shading techniques. John holds bachelor's and master's degrees in computer science from Rice University.

Jos Stam is a research scientist at Alias Systems. He holds a Ph.D. in computer science from the University of Toronto and is interested in most areas of computer graphics. He is a regular contributor at SIGGRAPH and other conferences. His best research has been in the areas of physics-based animation, rendering, texture mapping, and subdivision surfaces.

Marc Stevens holds a master's degree in computer science from Brown University and has over 12 years experience in the graphics industry. Marc is currently employed by Softimage/AVID, where he has held various positions over the past nine years in software development. He was one of the principal architects of Softimage|XSI and is now the director of Research and Development and Special Projects for Softimage.

Thilaka Sumanaweera has been having fun with first GL and then OpenGL since the late 1980s, creating applications—ranging from 2D to 4D—in computer vision, image processing, and medical imaging. He received his Ph.D. in electrical engineering from Stanford University in 1992 and then joined Radiological Sciences Laboratory at Stanford's Radiology Department as a post-doc and a research associate developing CT/MRI image fusion and image-guided neurosurgery. Currently a fellow at Siemens Medical Solutions USA, Inc., Ultrasound Division, he holds many patents for techniques related to medical imaging and visualization and has published extensively in medical journals.

Kiril Vidimce is a graphics software engineer in Pixar's Research & Development group and is working on their next-generation renderer. Previously, he was locked down in the Visualization Lab at Mississippi State University working under the guidance of Professor David Banks and producing 3D graphics and publications. Kiril's work has been published at SIGGRAPH, IEEE Visualization, IEEE Computer Graphics & Applications, and Graphics Interfaces. In his spare time and in between paper deadlines, he also managed to complete B.S. degrees in computer science and mathematics and internships at SGI, SRI, and Caltech. Originally from Macedonia's capital and largest city, Skopje, he now resides in San Francisco, California.


Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.

The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.

The publisher offers discounts on this book when ordered in quantity for bulk purchases and special sales. For more information, please contact:

U.S. Corporate and Government Sales
(800) 382-3419

For sales outside of the U.S., please contact:

International Sales

Visit Addison-Wesley on the Web:

Library of Congress Control Number: 2004100582

GeForce™ and NVIDIA Quadro® are trademarks or registered trademarks of NVIDIA Corporation.
RenderMan® is a registered trademark of Pixar Animation Studios.
"Shadow Map Antialiasing" © 2003 NVIDIA Corporation and Pixar Animation Studios.
"Cinematic Lighting" © 2003 Pixar Animation Studios.
Dawn images © 2002 NVIDIA Corporation. Vulcan images © 2003 NVIDIA Corporation.

Copyright © 2004 by NVIDIA Corporation.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. Published simultaneously in Canada.

For information on obtaining permission for use of material from this work, please submit a written request to:

Pearson Education, Inc.
Rights and Contracts Department
One Lake Street
Upper Saddle River, NJ 07458

Text printed on recycled and acid-free paper.

5 6 7 8 9 10 QWT 09 08 07

5th Printing September 2007