Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
Contributors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii
PART I GEOMETRY
3
Chapter 1
Generating Complex Procedural Terrains Using the GPU . . . . . . . . . . . 7
Ryan Geiss, NVIDIA Corporation
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Marching Cubes and the Density Function . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.1 Generating Polygons Within a Cell . . . . . . . . . . . . . . . . . . . . . 9
1.2.2 Lookup Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3 An Overview of the Terrain Generation System . . . . . . . . . . . . . . . . . . 12
1.3.1 Generating the Polygons Within a Block of Terrain . . . . . . . . 13
1.3.2 Generating the Density Values . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.3 Making an Interesting Density Function . . . . . . . . . . . . . . . . 14
1.3.4 Customizing the Terrain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.4 Generating the Polygons Within a Block of Terrain. . . . . . . . . . . . . . . . 20
1.4.1 Margin Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.4.2 Generating a Block: Method 1 . . . . . . . . . . . . . . . . . . . . . . . . 23
1.4.3 Generating a Block: Method 2 . . . . . . . . . . . . . . . . . . . . . . . . 25
1.4.4 Generating a Block: Method 3. . . . . . . . . . . . . . . . . . . . . . . . 26
1.5 Texturing and Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.6 Considerations for Real-World Applications . . . . . . . . . . . . . . . . . . . . . 35
1.6.1 Level of Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
1.6.2 Collisions and Lighting of Foreign Objects . . . . . . . . . . . . . . 36
1.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Contents
v
From the new book GPU Gems 3, edited by Hubert Nguyen, published by Addison-Wesley Professional, August 2007, ISBN 0321515269. Copyright 2008 NVIDIA Corporation. For more information, please visit: www.awprofessional.com/title/0321515269.
Chapter 2
Animated Crowd Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Bryan Dudash, NVIDIA Corporation
2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.2 A Brief Review of Instancing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.3 Details of the Technique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3.1 Constants-Based Instancing . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.3.2 Palette Skinning Using an Animation Texture . . . . . . . . . . . . 44
2.3.3 Geometry Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.3.4 The Level-of-Detail System . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.4 Other Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.1 Color Variations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.2 Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.3 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Chapter 3
DirectX 10 Blend Shapes: Breaking the Limits . . . . . . . . . . . . . . . . . . 53
Tristan Lorach, NVIDIA Corporation
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.2 How Does It Work?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.1 Features of DirectX 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.2 Defining the Mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.3 The Stream-Out Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.2.4 The Buffer-Template Method . . . . . . . . . . . . . . . . . . . . . . . . 60
3.3 Running the Sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.4 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Chapter 4
Next-Generation SpeedTree Rendering. . . . . . . . . . . . . . . . . . . . . . . . 69
Alexander Kharlamov, NVIDIA Corporation
Iain Cantlay, NVIDIA Corporation
Yury Stepanenko, NVIDIA Corporation
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.2 Silhouette Clipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.2.1 Silhouette Fin Extrusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2.2 Height Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.2.3 Silhouette Level of Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
vi
Contents
Copyright NVIDIA Corporation. All rights reserved.
4.3 Shadows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.3.1 Leaf Self-Shadowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.3.2 Cascaded Shadow Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.4 Leaf Lighting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.4.1 Two-Sided Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.4.2 Specular Lighting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.5 High Dynamic Range and Antialiasing . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.6 Alpha to Coverage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.6.1 Alpha to Coverage Applied to SpeedTrees . . . . . . . . . . . . . . . 85
4.6.2 Level-of-Detail Cross-Fading . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.6.3 Silhouette Edge Antialiasing . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Chapter 5
Generic Adaptive Mesh Refinement . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Tamy Boubekeur, LaBRI–INRIA, University of Bordeaux
Christophe Schlick, LaBRI–INRIA, University of Bordeaux
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.2 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.3 Adaptive Refinement Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.3.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.4 Rendering Workflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.4.1 Depth-Tagging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.4.2 The CPU-Level Rendering Loop . . . . . . . . . . . . . . . . . . . . . . 99
5.4.3 The GPU-Level Refinement Process . . . . . . . . . . . . . . . . . . . 99
5.5 Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.6 Conclusion and Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Chapter 6
GPU-Generated Procedural Wind Animations for Trees . . . . . . . . . . 105
Renaldas Zioma, Electronic Arts/Digital Illusions CE
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.2 Procedural Animations on the GPU . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.3 A Phenomenological Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.3.1 The Wind Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.3.2 The Conceptual Structure of a Tree . . . . . . . . . . . . . . . . . . . 107
6.3.3 The Two Categories of Simulation . . . . . . . . . . . . . . . . . . . . 107
6.4 The Simulation Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.4.1 The Quaternion Library in HLSL. . . . . . . . . . . . . . . . . . . . . 115
Contents
vii
Copyright NVIDIA Corporation. All rights reserved.
6.5 Rendering the Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.5.1 DirectX 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.6 Analysis and Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
6.6.1 Pros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.6.2 Cons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.6.3 Performance Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Chapter 7
Point-Based Visualization of Metaballs on a GPU . . . . . . . . . . . . . . 123
Kees van Kooten, Playlogic Game Factory
Gino van den Bergen, Playlogic Game Factory
Alex Telea, Eindhoven University of Technology
7.1 Metaballs, Smoothed Particle Hydrodynamics, and Surface Particles . . 124
7.1.1 A Comparison of Methods. . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.1.2 Point-Based Surface Visualization on a GPU . . . . . . . . . . . . 126
7.2 Constraining Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
7.2.1 Defining the Implicit Surface . . . . . . . . . . . . . . . . . . . . . . . . 128
7.2.2 The Velocity Constraint Equation . . . . . . . . . . . . . . . . . . . . 128
7.2.3 Computing the Density Field on the GPU . . . . . . . . . . . . . . 131
7.2.4 Choosing the Hash Function . . . . . . . . . . . . . . . . . . . . . . . . 132
7.2.5 Constructing and Querying the Hash. . . . . . . . . . . . . . . . . . 132
7.3 Local Particle Repulsion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.3.1 The Repulsion Force Equation . . . . . . . . . . . . . . . . . . . . . . . 135
7.3.3 Nearest Neighbors on a GPU . . . . . . . . . . . . . . . . . . . . . . . . 137
7.4 Global Particle Dispersion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.5 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.6 Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
PART II
LIGHT AND SHADOWS
151
Chapter 8
Summed-Area Variance Shadow Maps . . . . . . . . . . . . . . . . . . . . . . . 157
Andrew Lauritzen, University of Waterloo
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
8.2 Related Work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
viii
Contents
Copyright NVIDIA Corporation. All rights reserved.
8.3 Percentage-Closer Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
8.3.1 Problems with Percentage-Closer Filtering . . . . . . . . . . . . . . 159
8.4 Variance Shadow Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8.4.1 Filtering the Variance Shadow Map . . . . . . . . . . . . . . . . . . . 162
8.4.2 Biasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8.4.3 Light Bleeding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.4.4 Numeric Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
8.4.5 Implementation Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
8.4.6 Variance Shadow Maps and Soft Shadows . . . . . . . . . . . . . . 172
8.5 Summed-Area Variance Shadow Maps . . . . . . . . . . . . . . . . . . . . . . . . . 174
8.5.1 Generating Summed-Area Tables . . . . . . . . . . . . . . . . . . . . . 175
8.5.2 Numeric Stability Revisited. . . . . . . . . . . . . . . . . . . . . . . . . . 175
8.5.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
8.6 Percentage-Closer Soft Shadows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
8.6.1 The Blocker Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
8.6.2 Penumbra Size Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . 180
8.6.3 Shadow Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
8.6.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
8.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
8.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Chapter 9
Interactive Cinematic Relighting with Global Illumination . . . . . . . 183
Fabio Pellacini, Dartmouth College
Miloš Hašan, Cornell University
Kavita Bala, Cornell University
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
9.2 An Overview of the Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
9.3 Gather Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
9.4 One-Bounce Indirect Illumination . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
9.5 Wavelets for Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
9.6 Adding Multiple Bounces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
9.7 Packing Sparse Matrix Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
9.8 A GPU-Based Relighting Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
9.8.1 Direct Illumination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
9.8.2 Wavelet Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
9.8.3 Sparse Matrix Multiplication . . . . . . . . . . . . . . . . . . . . . . . . 198
9.9 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
9.10 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
9.11 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Contents
ix
Copyright NVIDIA Corporation. All rights reserved.
Chapter 10
Parallel-Split Shadow Maps on Programmable GPUs . . . . . . . . . . . 203
Fan Zhang, The Chinese University of Hong Kong
Hanqiu Sun, The Chinese University of Hong Kong
Oskari Nyman, Helsinki University of Technology
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
10.2 The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
10.2.1 Step 1: Splitting the View Frustum . . . . . . . . . . . . . . . . . . . 206
10.2.2 Step 2: Calculating Light’s Transformation Matrices . . . . . . 209
10.2.3 Steps 3 and 4: Generating PSSMs and Synthesizing
Shadows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
10.3 Hardware-Specific Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . 214
10.3.1 The Multipass Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
10.3.2 DirectX 9-Level Acceleration . . . . . . . . . . . . . . . . . . . . . . . . 217
10.3.3 DirectX 10-Level Acceleration . . . . . . . . . . . . . . . . . . . . . . . 220
10.4 Further Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
10.5 Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
10.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
10.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Chapter 11
Efficient and Robust Shadow Volumes Using Hierarchical
Occlusion Culling and Geometry Shaders . . . . . . . . . . . . . . . . . . . . 239
Martin Stich, mental images
Carsten Wächter, Ulm University
Alexander Keller, Ulm University
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
11.2 An Overview of Shadow Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
11.2.1 Z-Pass and Z-Fail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
11.2.2 Volume Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
11.2.3 Performance and Optimizations. . . . . . . . . . . . . . . . . . . . . . 243
11.3 Our Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
11.3.1 Robust Shadows for Low-Quality Meshes . . . . . . . . . . . . . . 244
11.3.2 Dynamic Volume Generation with Geometry Shaders. . . . . 246
11.3.3 Improving Performance with Hierarchical Occlusion
Culling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
11.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
11.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
x
Contents
Copyright NVIDIA Corporation. All rights reserved.
Chapter 12
High-Quality Ambient Occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Jared Hoberock, University of Illinois at Urbana-Champaign
Yuntao Jia, University of Illinois at Urbana-Champaign
12.1 Review. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
12.2 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
12.2.1 Disk-Shaped Artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
12.2.2 High-Frequency Pinching Artifacts . . . . . . . . . . . . . . . . . . . 261
12.3 A Robust Solution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
12.3.1 Smoothing Discontinuities. . . . . . . . . . . . . . . . . . . . . . . . . . 261
12.3.2 Removing Pinches and Adding Detail . . . . . . . . . . . . . . . . . 263
12.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
12.5 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
12.6 Caveats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
12.6.1 Forcing Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
12.6.2 Tunable Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
12.7 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
12.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Chapter 13
Volumetric Light Scattering as a Post-Process . . . . . . . . . . . . . . . . . 275
Kenny Mitchell, Electronic Arts
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
13.2 Crepuscular Rays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
13.3 Volumetric Light Scattering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
13.3.1 Controlling the Summation . . . . . . . . . . . . . . . . . . . . . . . . . 278
13.4 The Post-Process Pixel Shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
13.5 Screen-Space Occlusion Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
13.5.1 The Occlusion Pre-Pass Method . . . . . . . . . . . . . . . . . . . . . 281
13.5.2 The Occlusion Stencil Method . . . . . . . . . . . . . . . . . . . . . . 282
13.5.3 The Occlusion Contrast Method. . . . . . . . . . . . . . . . . . . . . 282
13.6 Caveats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
13.7 The Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
13.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
13.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
13.10 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Contents
xi
Copyright NVIDIA Corporation. All rights reserved.
PART III RENDERING
287
Chapter 14
Advanced Techniques for Realistic Real-Time Skin Rendering . . . . 293
Eugene d’Eon, NVIDIA Corporation
David Luebke, NVIDIA Corporation
14.1 The Appearance of Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
14.1.1 Skin Surface Reflectance . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
14.1.2 Skin Subsurface Reflectance. . . . . . . . . . . . . . . . . . . . . . . . . 296
14.2 An Overview of the Skin-Rendering System . . . . . . . . . . . . . . . . . . . . 297
14.3 Specular Surface Reflectance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
14.3.1 Implementing a Physically Based Specular Reflectance
Model for Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
14.4 Scattering Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
14.4.1 Diffusion Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
14.4.2 Rendering with Diffusion Profiles . . . . . . . . . . . . . . . . . . . . 306
14.4.3 The Shape of Diffusion Profiles . . . . . . . . . . . . . . . . . . . . . . 307
14.4.4 A Sum-of-Gaussians Diffusion Profile . . . . . . . . . . . . . . . . . 308
14.4.5 Fitting Predicted or Measured Profiles. . . . . . . . . . . . . . . . . . 311
14.4.6 Plotting Diffusion Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . 312
14.4.7 A Sum-of-Gaussians Fit for Skin . . . . . . . . . . . . . . . . . . . . . 312
14.5 Advanced Subsurface Scattering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
14.5.1 Texture-Space Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
14.5.2 Improved Texture-Space Diffusion . . . . . . . . . . . . . . . . . . . . 316
14.5.3 Modified Translucent Shadow Maps . . . . . . . . . . . . . . . . . . 336
14.6 A Fast Bloom Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
14.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
14.7.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
14.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Chapter 15
Playable Universal Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
George Borshukov, Electronic Arts
Jefferson Montgomery, Electronic Arts
John Hable, Electronic Arts
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
15.2 The Data Acquisition Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
xii
Contents
Copyright NVIDIA Corporation. All rights reserved.