Programmable vertex and fragment shaders have proven to be powerful additions to the OpenGL and Direct3D rendering pipelines. Beyond its expected uses in traditional graphics applications, this programmability has also enabled entirely new classes of GPU-based algorithms for image creation and analysis. This part of the book focuses on these kinds of image-oriented GPGPU techniques.
Hardware-assisted texture mapping is a key part of the modern graphics pipeline. Texture mapping on the GPU normally requires that objects be parameterized with texture coordinates, which can be difficult with certain types of models. Octree textures provide the usual benefits of texture mapping but do not require the use of texture coordinates. In Chapter 37, "Octree Textures on the GPU," Sylvain Lefebvre, Samuel Hornus, and Fabrice Neyret of GRAVIR/IMAG–INRIA show how octree textures can be implemented on GPUs and demonstrate their use in two interactive applications.
Images produced by GPUs typically only account for direct illumination from light sources and ignore diffuse and glossy reflection between objects. Toshiya Hachisuka of the University of Tokyo describes how the GPU's high-performance rasterization capabilities can be leveraged to implement a global illumination rendering system in Chapter 38, "High-Quality Global Illumination Rendering Using Rasterization." By using rasterization to effectively cast many rays in the same direction at once, it is possible to efficiently include a wide variety of nonlocal illumination effects.
Next, in Chapter 39, "Global Illumination Using Progressive Refinement Radiosity," Greg Coombe of the University of North Carolina at Chapel Hill and Mark Harris of NVIDIA describe a different kind of GPU-based global illumination renderer. By inverting the usual roles of "shooters" and "receivers" in progressive refinement radiosity, they are able to use the GPU to efficiently produce images that account for diffuse interreflection between large numbers of scene elements.
Computer vision is often referred to as the inverse of computer graphics: graphics generates images from models; vision does the opposite. James Fung of the University of Toronto turns the traditional graphics pipeline on its head in Chapter 40, "Computer Vision on the GPU." James shows how a GPU—or multiple GPUs—can be leveraged to form the backbone of a low-cost, high-performance computer vision system capable of running sophisticated vision algorithms at interactive rates.
Rendering images of data that is in a format not directly supported by graphics hardware is a common problem in GPGPU applications. In Chapter 41, "Deferred Filtering: Rendering from Difficult Data Formats," Joe Kniss of the University of Utah, Aaron Lefohn, and Nathaniel Fout, both of the University of California, Davis, demonstrate how these "difficult" data formats can be tamed through a two-pass rendering approach that takes advantage of the GPU's native texturing capabilities.
In the final chapter of this part, Chapter 42, "Conservative Rasterization," Jon Hasselgren, Tomas Akenine-Möller, and Lennart Ohlsson of Lund University make a valuable contribution to the GPGPU toolbox. They show how an application can control when and how fragments for partially covered pixels are generated, which is extremely useful when running a GPGPU calculation over a discretized domain. This capability allows applications to make conservative assumptions about which pixels are rasterized, resulting in more accurate GPU-based algorithms for applications ranging from collision detection to occlusion culling.
By their very nature, GPUs will continue to excel at image-oriented computation as their capabilities evolve. The techniques presented in this part offer a broad look at what is possible today, and they provide foundations upon which tomorrow's cutting-edge applications can be built. I trust you will find them to be as useful and thought provoking as I have.
Craig Kolb, 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.
NVIDIA makes no warranty or representation that the techniques described herein are free from any Intellectual Property claims. The reader assumes all risk of any such claims based on his or her use of these techniques.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
For sales outside of the U.S., please contact:
Visit Addison-Wesley on the Web: www.awprofessional.com
Library of Congress Cataloging-in-Publication Data
GPU gems 2 : programming techniques for high-performance graphics and general-purpose
computation / edited by Matt Pharr ; Randima Fernando, series editor.
Includes bibliographical references and index.
ISBN 0-321-33559-7 (hardcover : alk. paper)
1. Computer graphics. 2. Real-time programming. I. Pharr, Matt. II. Fernando, Randima.
GeForce™ and NVIDIA Quadro® are trademarks or registered trademarks of NVIDIA Corporation.
Nalu, Timbury, and Clear Sailing images © 2004 NVIDIA Corporation.
mental images and mental ray are trademarks or registered trademarks of mental images, GmbH.
Copyright © 2005 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 in the United States on recycled paper at Quebecor World Taunton in Taunton, Massachusetts.
Second printing, April 2005
To everyone striving to make today's best computer graphics look primitive tomorrow