GPU GemsGPU 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 IV: Image Processing
When most people think of GPU power, they focus on purely 3D applications, yet the pictures we actually see on our monitors are 2D. Programmable pixel shaders provide personal computers with unprecedented image-processing power, extending our abilities for both 2D and 3D development.
Graphic designers and illustrators have long used complex controls in still-image photo-editing applications, but such programs can process only one picture at a time. The newest GPUs can perform these previously slow operations at interactive rates, allowing us to apply the full power of complex compositing and color-control applications not just to still images and layouts, but also to full-motion video and gameplay. Complex video coloring that previously required an entire suite of specialized equipment can now be done on a laptop PC.
Understanding color spaces is one aspect of image processing, whether we are mapping 2D images into new 2D images or rendering 3D scenes to the screen. Equally important is understanding how images of varying sizes and shapes can be filtered during manipulations to provide smooth, fast results. GPUs are capable of executing the same filtering algorithms as CPU-based image-processing tools, but they also can invoke new hardware-accelerated methods.
In Chapter 21, "Real-Time Glow," Greg James and John O'Rorke give us an example of how 3D gameplay can be enhanced with 2D image processing. By adding 2D lighting effects such as glows, they show how a little image processing can completely alter the feel and play-action of 3D imagery. Once you see how these results are accomplished, you may not be able to enjoy 3D imagery without them again.
In Chapter 22, "Color Controls," I extend the discussion of image processing in games to the uses and methods of technical and artistic color control, for moving imagery into and out of unusual color spaces, as well as quickly adding polished color-tuning to any scene, 2D or 3D. The colors we see in print and on television today are almost universally color-controlled. Developers should be able to understand and use the same tools for their game engines.
In Chapter 23, "Depth of Field: A Survey of Techniques," Joe Demers writes about using GPU operations to create depth-of-field effects in real time. By following a few simple filtering rules, developers can simulate the complex effects of real-world camera focusing, film saturation, and more on 3D models.
Chapter 24, "High-Quality Filtering," generalizes image filtering and effects to images of arbitrary size, applying the notion of filter kernels and analytic calculation to the problem of 2D and 3D antialiasing. Significantly, we can see that some "classical" antialiasing and filtering problems are best solved on the GPU by using hardware accelerations not typically available to CPU-based approaches.
Matt Pharr describes an unusual application of texturing in 2D space in Chapter 25, "Fast Filter-Width Estimates with Texture Maps." By cleverly manipulating the results of texture operations, he's able to determine local partial derivatives of complex functions, even when using hardware profiles that don't provide direct hardware support for these operations.
In Chapter 26, "The OpenEXR Image File Format," Florian Kainz, Rod Bogart, and Drew Hess of Industrial Light & Magic (ILM) describe the OpenEXR standard, a new, high-dynamic-range image format that's quickly spreading through the top tiers of motion-picture computer imaging. OpenEXR is a key tool for developers looking to exploit the new world of image-based lighting, and the ILM team shows how they've adopted GPU processing speed to make OpenEXR a valuable day-to-day tool at ILM—not just for 3D work, but also for image acquisition, compositing, and playback—again, in real time.
Of course, to apply these techniques requires the developer to manage image-processing tasks. In Chapter 27, "A Framework for Image Processing," Frank Jargstorff presents a scheme for 2D image processing that's flexible and applicable to a variety of applications. The framework can even be extended to mix GPU and CPU operations in a way that's fairly transparent to developers of games, photo applications, and video applications alike.
Kevin Bjorke, 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
For sales outside of the U.S., please contact:
Visit Addison-Wesley on the Web: www.awprofessional.com
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
- Part I: Natural Effects
- Chapter 1. Effective Water Simulation from Physical Models
- Chapter 2. Rendering Water Caustics
- Chapter 3. Skin in the "Dawn" Demo
- Chapter 4. Animation in the "Dawn" Demo
- Chapter 5. Implementing Improved Perlin Noise
- Chapter 6. Fire in the "Vulcan" Demo
- Chapter 7. Rendering Countless Blades of Waving Grass
- Chapter 8. Simulating Diffraction
- Part II: Lighting and Shadows
- Chapter 10. Cinematic Lighting
- Chapter 11. Shadow Map Antialiasing
- Chapter 12. Omnidirectional Shadow Mapping
- Chapter 13. Generating Soft Shadows Using Occlusion Interval Maps
- Chapter 14. Perspective Shadow Maps: Care and Feeding
- Chapter 15. Managing Visibility for Per-Pixel Lighting
- Chapter 9. Efficient Shadow Volume Rendering
- Part III: Materials
- Part IV: Image Processing
- Part V: Performance and Practicalities
- Chapter 28. Graphics Pipeline Performance
- Chapter 29. Efficient Occlusion Culling
- Chapter 30. The Design of FX Composer
- Chapter 31. Using FX Composer
- Chapter 32. An Introduction to Shader Interfaces
- Chapter 33. Converting Production RenderMan Shaders to Real-Time
- Chapter 34. Integrating Hardware Shading into Cinema 4D
- Chapter 35. Leveraging High-Quality Software Rendering Effects in Real-Time Applications
- Chapter 36. Integrating Shaders into Applications
- Part VI: Beyond Triangles