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.

Part VI: Beyond Triangles

Graphics processors are no longer used just for processing graphics. The advent of graphics processing units (GPUs) that are fully programmable and support floating-point mathematical operations has enabled them to be used for many types of more general-purpose computation as well. Indeed, today's researchers are using GPUs in ways never imagined by their original designers.

This part of the book describes a number of nontraditional applications of GPUs, from simulating physics to rendering stereoscopic images. Although some of these applications may not be widely used on today's hardware, they offer an insight into how graphics processors might be used in the future.

Chapter 37, "A Toolkit for Computation on GPUs" by Ian Buck and Tim Purcell, provides an introduction to general-purpose computing on the GPU, and it describes a number of programming primitives that can be used to implement general algorithms on the GPU. Even if you didn't know that your GPU can be programmed to sort and search arrays, this chapter will show you how.

Chapter 38, "Fast Fluid Dynamics Simulation on the GPU" by Mark J. Harris, describes in detail how to implement a physically accurate fluid simulation that executes entirely on the GPU. Modeling physics is an inherently parallel problem and therefore well suited to the parallel-processing ability of the GPU. As graphics hardware becomes faster, more parallel, and more flexible, we will see more and more types of physical simulation migrating to the GPU. The final output of many physics simulations is graphics, so it makes sense to keep the computation close to the display.

This part also includes two chapters on volume rendering. In 1991, Jim Kajiya famously predicted, "In ten years, all rendering will be volume rendering." Although this prediction has not come true, volume rendering definitely still has advantages for visualizing data that cannot be described as polygonal geometry. As texture memory becomes cheaper and shading power increases, volume rendering will become more widespread. Chapter 39, "Volume Rendering Techniques" by Milan Ikits, Joe Kniss, Aaron Lefohn, and Charles Hansen, provides a nice overview of volume rendering. Chapter 40, "Applying Real-Time Shading to 3D Ultrasound Visualization" by Thilaka Sumanaweera, describes some of the practical issues that arise when using volume rendering to render ultrasound data.

Chapter 41, "Real-Time Stereograms" by Fabio Policarpo, explains how to use the GPU to generate single-image random-dot stereograms (SIRDs). These images are interesting because they prove that the human visual system can infer depth purely from matching features in stereo images, even in the absence of all other depth cues such as texture and perspective. When Bela Julesz invented random-dot stereograms in the 1960s, he probably never imagined that it would be possible to produce stereograms of a dynamic 3D scene in real time.

Finally, in Chapter 42, "Deformers," Eugene d'Eon generalizes the concept of animation by encompassing several techniques into what he calls "deformers." Using this definition, he then develops a standard method for obtaining a vertex normal using a Jacobian matrix, hence removing the necessity of using finite differences to derive the gradient vectors.

This part will give you a feel for applications of the GPU outside the normal realm of video games, and we hope it will inspire you to find your own ways to use and abuse the hardware.

Simon Green, NVIDIA


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