Tải bản đầy đủ (.pdf) (417 trang)

Introduction to computer graphics a practical learning approach

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.49 MB, 417 trang )

Introduction to

COMPUTER

GRAPHICS
A Practical Learning Approach

FABIO GANOVELLI • MASSIMILIANO CORSINI
SUMANTA PATTANAIK • MARCO DI BENEDETTO





Fabio Ganovelli
Massimiliano Corsini
Sumanta Pattanaik
Marco Di Benedetto

Boca Raton London New York

CRC Press is an imprint of the
Taylor & Francis Group, an informa business

A CHAPMAN & HALL BOOK


CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742


© 2015 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Version Date: 20140714
International Standard Book Number-13: 978-1-4822-3633-0 (eBook - PDF)
This book contains information obtained from authentic and highly regarded sources. Reasonable
efforts have been made to publish reliable data and information, but the author and publisher cannot
assume responsibility for the validity of all materials or the consequences of their use. The authors and
publishers have attempted to trace the copyright holders of all material reproduced in this publication
and apologize to copyright holders if permission to publish in this form has not been obtained. If any
copyright material has not been acknowledged please write and let us know so we may rectify in any
future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com ( or contact the Copyright Clearance Center, Inc. (CCC), 222
Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at

and the CRC Press Web site at



To Reni
F. Ganovelli
To my grandmother, my parents and my wife
M. Corsini
To my parents

S. Pattanaik
To my family
M. Di Benedetto



Contents

List of Figures

xvii

List of Listings

xxvii

Preface

xxxi

1 What Computer Graphics Is
1.1 Application Domains and Areas of Computer Graphics . . .
1.1.1 Application Domains . . . . . . . . . . . . . . . . . . .
1.1.2 Areas of Computer Graphics . . . . . . . . . . . . . .
1.2 Color and Images . . . . . . . . . . . . . . . . . . . . . . . .
1.2.1 The Human Visual System (HVS) . . . . . . . . . . .
1.2.2 Color Space . . . . . . . . . . . . . . . . . . . . . . . .
1.2.2.1 CIE XYZ . . . . . . . . . . . . . . . . . . . .
1.2.2.2 Device-Dependent and Device-Independent
Color Space . . . . . . . . . . . . . . . . . . .

1.2.2.3 HSL and HSV . . . . . . . . . . . . . . . . .
1.2.2.4 CIELab . . . . . . . . . . . . . . . . . . . . .
1.2.3 Illuminant . . . . . . . . . . . . . . . . . . . . . . . . .
1.2.4 Gamma . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2.5 Image Representation . . . . . . . . . . . . . . . . . .
1.2.5.1 Vector Images . . . . . . . . . . . . . . . . .
1.2.5.2 Raster Images . . . . . . . . . . . . . . . . .
1.3 Algorithms to Create a Raster Image from a 3D Scene . . .
1.3.1 Ray Tracing . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2 Rasterization-Based Pipeline . . . . . . . . . . . . . .
1.3.3 Ray Tracing vs Rasterization-Based Pipeline . . . . .
1.3.3.1 Ray Tracing Is Better . . . . . . . . . . . . .
1.3.3.2 Rasterization Is Better . . . . . . . . . . . .

9
10
11
12
13
13
13
14
17
17
20
21
21
22

2 The

2.1
2.2
2.3
2.4

23
23
25
28
40

First Steps
The Application Programming Interface . . . . . . . . . . . .
The WebGL Rasterization-Based Pipeline . . . . . . . . . . .
Programming the Rendering Pipeline: Your First Rendering
WebGL Supporting Libraries . . . . . . . . . . . . . . . . . .

1
1
2
2
5
5
6
8

vii


viii


Contents
2.5

Meet NVMC . . . . . . . . . . . . . . . . . . . .
2.5.1 The Framework . . . . . . . . . . . . . . .
2.5.2 The Class NVMC to Represent the World
2.5.3 A Very Basic Client . . . . . . . . . . . .
2.5.4 Code Organization . . . . . . . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.

.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

40
41
42
42
48

3 How a 3D Model Is Represented
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .

3.1.1 Digitalization of the Real World . . . . . . . . .
3.1.2 Modeling . . . . . . . . . . . . . . . . . . . . . .
3.1.3 Procedural Modeling . . . . . . . . . . . . . . . .
3.1.4 Simulation . . . . . . . . . . . . . . . . . . . . .
3.2 Polygon Meshes . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Fans and Strips . . . . . . . . . . . . . . . . . . .
3.2.2 Manifoldness . . . . . . . . . . . . . . . . . . . .
3.2.3 Orientation . . . . . . . . . . . . . . . . . . . . .
3.2.4 Advantages and Disadvantages . . . . . . . . . .
3.3 Implicit Surfaces . . . . . . . . . . . . . . . . . . . . . .
3.3.1 Advantages and Disadvantages . . . . . . . . . .
3.4 Parametric Surfaces . . . . . . . . . . . . . . . . . . . .
3.4.1 Parametric Curve . . . . . . . . . . . . . . . . . .
3.4.2 B´ezier Curves . . . . . . . . . . . . . . . . . . . .
3.4.2.1 Cubic B´ezier Curve . . . . . . . . . . .
3.4.3 B-Spline Curves . . . . . . . . . . . . . . . . . .
3.4.4 From Parametric Curves to Parametric Surfaces
3.4.5 B´ezier Patches . . . . . . . . . . . . . . . . . . .
3.4.6 NURBS Surfaces . . . . . . . . . . . . . . . . . .
3.4.7 Advantages and Disadvantages . . . . . . . . . .
3.5 Voxels . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5.1 Rendering Voxels . . . . . . . . . . . . . . . . . .
3.5.2 Advantages and Disadvantages . . . . . . . . . .
3.6 Constructive Solid Geometry (CSG) . . . . . . . . . . .
3.6.1 Advantages and Disadvantages . . . . . . . . . .
3.7 Subdivision Surfaces . . . . . . . . . . . . . . . . . . . .
3.7.1 Chaikin’s Algorithm . . . . . . . . . . . . . . . .
3.7.2 The 4-Point Algorithm . . . . . . . . . . . . . . .
3.7.3 Subdivision Methods for Surfaces . . . . . . . . .
3.7.4 Classification . . . . . . . . . . . . . . . . . . . .

3.7.4.1 Triangular or Quadrilateral . . . . . . .
3.7.4.2 Primal or Dual . . . . . . . . . . . . . .
3.7.4.3 Approximation vs Interpolation . . . .
3.7.4.4 Smoothness . . . . . . . . . . . . . . . .
3.7.5 Subdivision Schemes . . . . . . . . . . . . . . . .
3.7.5.1 Loop Scheme . . . . . . . . . . . . . . .
3.7.5.2 Modified Butterfly Scheme . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

51
51
52
52
53
53
53
54
54
55
56
57
58
58
59
59
61
63
64
66
67
67
68
69
70

70
71
71
71
72
73
73
73
73
74
75
75
76
76


Contents
3.7.6 Advantages and Disadvantages . . . . . . . . . .
Data Structures for Polygon Meshes . . . . . . . . . . .
3.8.1 Indexed Data Structure . . . . . . . . . . . . . .
3.8.2 Winged-Edge . . . . . . . . . . . . . . . . . . . .
3.8.3 Half-Edge . . . . . . . . . . . . . . . . . . . . . .
3.9 The First Code: Making and Showing Simple Primitives
3.9.1 The Cube . . . . . . . . . . . . . . . . . . . . . .
3.9.2 Cone . . . . . . . . . . . . . . . . . . . . . . . . .
3.9.3 Cylinder . . . . . . . . . . . . . . . . . . . . . . .
3.10 Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . .
3.10.1 General . . . . . . . . . . . . . . . . . . . . . . .

ix

.
.
.
.
.
.
.
.
.
.
.

77
78
78
80
80
81
82
83
86
89
89

4 Geometric Transformations
4.1 Geometric Entities . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Basic Geometric Transformations . . . . . . . . . . . . . . .
4.2.1 Translation . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.3 Rotation . . . . . . . . . . . . . . . . . . . . . . . . . .

4.2.4 Expressing Transformation with Matrix Notation . . .
4.3 Affine Transformations . . . . . . . . . . . . . . . . . . . . .
4.3.1 Composition of Geometric Transformations . . . . . .
4.3.2 Rotation and Scaling about a Generic Point . . . . . .
4.3.3 Shearing . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.4 Inverse Transformations and Commutative Properties
4.4 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1 General Frames and Affine Transformations . . . . . .
4.4.2 Hierarchies of Frames . . . . . . . . . . . . . . . . . .
4.4.3 The Third Dimension . . . . . . . . . . . . . . . . . .
4.5 Rotations in Three Dimensions . . . . . . . . . . . . . . . . .
4.5.1 Axis–Angle Rotation . . . . . . . . . . . . . . . . . . .
4.5.1.1 Building Orthogonal 3D Frames from a Single
Axis . . . . . . . . . . . . . . . . . . . . . . .
4.5.1.2 Axis–Angle Rotations without Building the
3D Frame . . . . . . . . . . . . . . . . . . . .
4.5.2 Euler Angles Rotations . . . . . . . . . . . . . . . . .
4.5.3 Rotations with Quaternions . . . . . . . . . . . . . . .
4.6 Viewing Transformations . . . . . . . . . . . . . . . . . . . .
4.6.1 Placing the View Reference Frame . . . . . . . . . . .
4.6.2 Projections . . . . . . . . . . . . . . . . . . . . . . . .
4.6.2.1 Perspective Projection . . . . . . . . . . . . .
4.6.2.2 Perspective Division . . . . . . . . . . . . . .
4.6.2.3 Orthographic Projection . . . . . . . . . . .
4.6.3 Viewing Volume . . . . . . . . . . . . . . . . . . . . .
4.6.3.1 Canonical Viewing Volume . . . . . . . . . .

91
91
92

92
93
93
94
96
97
98
99
100
101
102
102
103
104
105

3.8

.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.

106
106
108
110
111
111
112
112
114
114
115
116


x

Contents
4.6.4


4.7
4.8

4.9
4.10

4.11

4.12
4.13

From Normalized Device Coordinates to Window
Coordinates . . . . . . . . . . . . . . . . . . . . . . . .
4.6.4.1 Preserving Aspect Ratio . . . . . . . . . . .
4.6.4.2 Depth Value . . . . . . . . . . . . . . . . . .
4.6.5 Summing Up . . . . . . . . . . . . . . . . . . . . . . .
Transformations in the Pipeline . . . . . . . . . . . . . . . .
Upgrade Your Client: Our First 3D Client . . . . . . . . . .
4.8.1 Assembling the Tree and the Car . . . . . . . . . . . .
4.8.2 Positioning the Trees and the Cars . . . . . . . . . . .
4.8.3 Viewing the Scene . . . . . . . . . . . . . . . . . . . .
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Handling the Transformations Matrices with a Matrix Stack
4.10.1 Upgrade Your Client: Add the View from above and
behind . . . . . . . . . . . . . . . . . . . . . . . . . . .
Manipulating the View and the Objects . . . . . . . . . . . .
4.11.1 Controlling the View with Keyboard and Mouse . . .
4.11.2 Upgrade Your Client: Add the Photographer View . .
4.11.3 Manipulating the Scene with Keyboard and Mouse: the

Virtual Trackball . . . . . . . . . . . . . . . . . . . . .
Upgrade Your Client: Create the Observer Camera . . . . . .
Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.13.1 General . . . . . . . . . . . . . . . . . . . . . . . . . .
4.13.2 Client Related . . . . . . . . . . . . . . . . . . . . . .

5 Turning Vertices into Pixels
5.1 Rasterization . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.1 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.2 Polygons (Triangles) . . . . . . . . . . . . . . . . . .
5.1.2.1 General Polygons . . . . . . . . . . . . . .
5.1.2.2 Triangles . . . . . . . . . . . . . . . . . . .
5.1.3 Attribute Interpolation: Barycentric Coordinates . .
5.1.4 Concluding Remarks . . . . . . . . . . . . . . . . . .
5.2 Hidden Surface Removal . . . . . . . . . . . . . . . . . . .
5.2.1 Depth Sort . . . . . . . . . . . . . . . . . . . . . . .
5.2.2 Scanline . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.3 z-Buffer . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.4 z-Buffer Precision and z-Fighting . . . . . . . . . . .
5.3 From Fragments to Pixels . . . . . . . . . . . . . . . . . . .
5.3.1 Discard Tests . . . . . . . . . . . . . . . . . . . . . .
5.3.2 Blending . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.2.1 Blending for Transparent Surfaces . . . . .
5.3.3 Aliasing and Antialiasing . . . . . . . . . . . . . . .
5.3.4 Upgrade Your Client: View from Driver Perspective
5.4 Clipping . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1 Clipping Segments . . . . . . . . . . . . . . . . . . .

.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

117
118
119
119
120
120
122
123
123
124
125

128
130
130
131
133
135
137
137
138
139
139
139
142
143
144
146
148
149
150
151
152
152
154
155
156
157
157
159
161
162



Contents

5.5

5.4.2 Clipping Polygons
Culling . . . . . . . . . .
5.5.1 Back-Face Culling
5.5.2 Frustum Culling .
5.5.3 Occlusion Culling .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

xi
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

165
165
166
167
169

6 Lighting and Shading
171
6.1 Light and Matter Interaction . . . . . . . . . . . . . . . . . . 172
6.1.1 Ray Optics Basics . . . . . . . . . . . . . . . . . . . . 174
6.1.1.1 Diffuse Reflection . . . . . . . . . . . . . . . 174
6.1.1.2 Specular Reflection . . . . . . . . . . . . . . 175
6.1.1.3 Refraction . . . . . . . . . . . . . . . . . . . 176
6.2 Radiometry in a Nutshell . . . . . . . . . . . . . . . . . . . . 177
6.3 Reflectance and BRDF . . . . . . . . . . . . . . . . . . . . . 180
6.4 The Rendering Equation . . . . . . . . . . . . . . . . . . . . 184
6.5 Evaluate the Rendering Equation . . . . . . . . . . . . . . . 185

6.6 Computing the Surface Normal . . . . . . . . . . . . . . . . . 186
6.6.1 Crease Angle . . . . . . . . . . . . . . . . . . . . . . . 189
6.6.2 Transforming the Surface Normal . . . . . . . . . . . . 190
6.7 Light Source Types . . . . . . . . . . . . . . . . . . . . . . . 191
6.7.1 Directional Lights . . . . . . . . . . . . . . . . . . . . 192
6.7.2 Upgrade Your Client: Add the Sun . . . . . . . . . . . 193
6.7.2.1 Adding the Surface Normal . . . . . . . . . . 193
6.7.2.2 Loading and Shading a 3D Model . . . . . . 195
6.7.3 Point Lights . . . . . . . . . . . . . . . . . . . . . . . . 197
6.7.4 Upgrade Your Client: Add the Street Lamps . . . . . 198
6.7.5 Spotlights . . . . . . . . . . . . . . . . . . . . . . . . . 200
6.7.6 Area Lights . . . . . . . . . . . . . . . . . . . . . . . . 201
6.7.7 Upgrade Your Client: Add the Car’s Headlights and
Lights in the Tunnel . . . . . . . . . . . . . . . . . . . 203
6.8 Phong Illumination Model . . . . . . . . . . . . . . . . . . . 205
6.8.1 Overview and Motivation . . . . . . . . . . . . . . . . 205
6.8.2 Diffuse Component . . . . . . . . . . . . . . . . . . . . 205
6.8.3 Specular Component . . . . . . . . . . . . . . . . . . . 206
6.8.4 Ambient Component . . . . . . . . . . . . . . . . . . . 207
6.8.5 The Complete Model . . . . . . . . . . . . . . . . . . . 207
6.9 Shading Techniques . . . . . . . . . . . . . . . . . . . . . . . 209
6.9.1 Flat and Gouraud Shading . . . . . . . . . . . . . . . 209
6.9.2 Phong Shading . . . . . . . . . . . . . . . . . . . . . . 210
6.9.3 Upgrade Your Client: Use Phong Lighting . . . . . . . 210
6.10 Advanced Reflection Models . . . . . . . . . . . . . . . . . . 211
6.10.1 Cook-Torrance Model . . . . . . . . . . . . . . . . . . 211
6.10.2 Oren-Nayar Model . . . . . . . . . . . . . . . . . . . . 213
6.10.3 Minnaert Model . . . . . . . . . . . . . . . . . . . . . 214
6.11 Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 215



xii

Contents
6.11.1 General . . . . . . . . . . . . . . . . . . . . . . . . . .
6.11.2 Client Related . . . . . . . . . . . . . . . . . . . . . .

215
215

7 Texturing
217
7.1 Introduction: Do We Need Texture Mapping? . . . . . . . . 217
7.2 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 218
7.2.1 Texturing in the Pipeline . . . . . . . . . . . . . . . . 220
7.3 Texture Filtering: from per-Fragment Texture Coordinates to
per-Fragment Color . . . . . . . . . . . . . . . . . . . . . . . 220
7.3.1 Magnification . . . . . . . . . . . . . . . . . . . . . . . 221
7.3.2 Minification with Mipmapping . . . . . . . . . . . . . 222
7.4 Perspective Correct Interpolation: From per-Vertex to perFragment Texture Coordinates . . . . . . . . . . . . . . . . . 225
7.5 Upgrade Your Client: Add Textures to the Terrain, Street and
Building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
7.5.1 Accessing Textures from the Shader Program . . . . . 229
7.6 Upgrade Your Client: Add the Rear Mirror . . . . . . . . . . 230
7.6.1 Rendering to Texture (RTT) . . . . . . . . . . . . . . 232
7.7 Texture Coordinates Generation and Environment Mapping
234
7.7.1 Sphere Mapping . . . . . . . . . . . . . . . . . . . . . 235
7.7.1.1 Computation of Texture Coordinates . . . . 236
7.7.1.2 Limitations . . . . . . . . . . . . . . . . . . . 236

7.7.2 Cube Mapping . . . . . . . . . . . . . . . . . . . . . . 236
7.7.3 Upgrade Your Client: Add a Skybox for the Horizon . 238
7.7.4 Upgrade Your Client: Add Reflections to the Car . . . 239
7.7.4.1 Computing the Cubemap on-the-fly for More
Accurate Reflections . . . . . . . . . . . . . . 240
7.7.5 Projective Texture Mapping . . . . . . . . . . . . . . . 241
7.8 Texture Mapping for Adding Detail to Geometry . . . . . . . 242
7.8.1 Displacement Mapping . . . . . . . . . . . . . . . . . . 243
7.8.2 Normal Mapping . . . . . . . . . . . . . . . . . . . . . 243
7.8.2.1 Object Space Normal Mapping . . . . . . . . 244
7.8.3 Upgrade Your Client: Add the Asphalt . . . . . . . . . 245
7.8.4 Tangent Space Normal Mapping . . . . . . . . . . . . 246
7.8.4.1 Computing the Tangent Frame for
Triangulated Meshes . . . . . . . . . . . . . . 247
7.9 Notes on Mesh Parametrization . . . . . . . . . . . . . . . . 249
7.9.1 Seams . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
7.9.2 Quality of a Parametrization . . . . . . . . . . . . . . 252
7.10 3D Textures and Their Use . . . . . . . . . . . . . . . . . . . 254
7.11 Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
7.11.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . 254
7.11.2 Client . . . . . . . . . . . . . . . . . . . . . . . . . . . 255


Contents
8 Shadows
8.1 The Shadow Phenomenon . . . . . . . . . . . . . . . . .
8.2 Shadow Mapping . . . . . . . . . . . . . . . . . . . . .
8.2.1 Modeling Light Sources . . . . . . . . . . . . . .
8.2.1.1 Directional Light . . . . . . . . . . . . .
8.2.1.2 Point Light . . . . . . . . . . . . . . . .

8.2.1.3 Spotlights . . . . . . . . . . . . . . . . .
8.3 Upgrade Your Client: Add Shadows . . . . . . . . . . .
8.3.1 Encoding the Depth Value in an RGBA Texture
8.4 Shadow Mapping Artifacts and Limitations . . . . . . .
8.4.1 Limited Numerical Precision: Surface Acne . . .
8.4.1.1 Avoid Acne in Closed Objects . . . . .
8.4.2 Limited Shadow Map Resolution: Aliasing . . . .
8.4.2.1 Percentage Closer Filtering (PCF) . . .
8.5 Shadow Volumes . . . . . . . . . . . . . . . . . . . . . .
8.5.1 Constructing the Shadow Volumes . . . . . . . .
8.5.2 The Algorithm . . . . . . . . . . . . . . . . . . .
8.6 Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . .
8.6.1 General . . . . . . . . . . . . . . . . . . . . . . .
8.6.2 Client Related . . . . . . . . . . . . . . . . . . .

xiii

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

257
257
259
260
260
260
261
262
263
266
266
267
268

268
269
271
272
273
273
273

9 Image-Based Impostors
9.1 Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Billboarding . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1 Static Billboards . . . . . . . . . . . . . . . . . . .
9.2.2 Screen-Aligned Billboards . . . . . . . . . . . . . .
9.2.3 Upgrade Your Client: Add Fixed-Screen Gadgets .
9.2.4 Upgrade Your Client: Adding Lens Flare Effects .
9.2.4.1 Occlusion Query . . . . . . . . . . . . . .
9.2.5 Axis-Aligned Billboards . . . . . . . . . . . . . . .
9.2.5.1 Upgrade Your Client: Better Trees . . . .
9.2.6 On-the-fly Billboarding . . . . . . . . . . . . . . .
9.2.7 Spherical Billboards . . . . . . . . . . . . . . . . .
9.2.8 Billboard Cloud . . . . . . . . . . . . . . . . . . .
9.2.8.1 Upgrade Your Client: Even Better Trees .
9.3 Ray-Traced Impostors . . . . . . . . . . . . . . . . . . . .
9.4 Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . . .
9.4.1 General . . . . . . . . . . . . . . . . . . . . . . . .
9.4.2 Client Related . . . . . . . . . . . . . . . . . . . .

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

275
276
277
278
278
278
280
281
284
285
287
288
289
290
290
292
292
292

10 Advanced
10.1 Image
10.1.1
10.1.2

Techniques
Processing . .
Blurring . . . .

Upgrade Your
Depth of Field

. . . .
. . . .
Client:
. . . .

. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
A Better Photographer
. . . . . . . . . . . . . . .

. . .
. . .
with
. . .

295
295
297
300


xiv

Contents

10.2
10.3

10.4

10.5

10.1.2.1 Fullscreen Quad . . . . . . . . . . . . . .
10.1.3 Edge Detection . . . . . . . . . . . . . . . . . . . .
10.1.4 Upgrade Your Client: Toon Shading . . . . . . . .
10.1.5 Upgrade Your Client: A Better Photographer with
Panning . . . . . . . . . . . . . . . . . . . . . . . .
10.1.5.1 The Velocity Buffer . . . . . . . . . . . .
10.1.6 Sharpen . . . . . . . . . . . . . . . . . . . . . . . .
Ambient Occlusion . . . . . . . . . . . . . . . . . . . . .
10.2.1 Screen-Space Ambient Occlusion (SSAO) . . . . .
Deferred Shading . . . . . . . . . . . . . . . . . . . . . .
Particle Systems . . . . . . . . . . . . . . . . . . . . . . .
10.4.1 Animating a Particle System . . . . . . . . . . . .
10.4.2 Rendering a Particle System . . . . . . . . . . . .
Self-Exercises . . . . . . . . . . . . . . . . . . . . . . . . .
10.5.1 General . . . . . . . . . . . . . . . . . . . . . . . .
10.5.2 Client Related . . . . . . . . . . . . . . . . . . . .

11 Global Illumination
11.1 Ray Tracing . . . . . . . . . . . . . . . . . . . . .
11.1.1 Ray–Algebraic Surface Intersection . . . . .
11.1.1.1 Ray–Plane Intersection . . . . . .
11.1.1.2 Ray–Sphere Intersection . . . . . .
11.1.2 Ray–Parametric Surface Intersection . . . .
11.1.3 Ray–Scene Intersection . . . . . . . . . . .
11.1.3.1 Ray–AABB Intersection . . . . . .
11.1.3.2 USS-Based Acceleration Scheme .

11.1.3.3 USS Grid Traversal . . . . . . . .
11.1.3.4 BVH-Based Acceleration Scheme .
11.1.4 Ray Tracing for Rendering . . . . . . . . .
11.1.5 Classical Ray Tracing . . . . . . . . . . . .
11.1.6 Path Tracing . . . . . . . . . . . . . . . . .
11.2 Multi-Pass Algorithms . . . . . . . . . . . . . . .
11.2.1 Photon Tracing . . . . . . . . . . . . . . . .
11.2.2 Radiosity . . . . . . . . . . . . . . . . . . .
11.2.3 Concept of Form Factor . . . . . . . . . . .
11.2.4 Flux Transport Equation and Radiosity
Equation . . . . . . . . . . . . . . . . . . .
11.2.4.1 Computation of Form Factor . . .
11.2.5 Solution of Radiosity System . . . . . . . .
11.2.5.1 Rendering from Radiosity Solution

. .
. .
. .

301
306
308

.
.
.
.
.
.
.

.
.
.
.
.

310
311
314
316
318
320
321
322
322
323
323
323

.
.
.
.
.
.
.
.
.
.
.

.

. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
Transport
. . . . . .
. . . . . .
. . . . . .
. . . . . .

A NVMC Class
A.1 Elements of the Scene . . . . . . . . . . . . . . . . . . . . . .
A.2 Players . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

325

325
326
326
327
327
328
328
330
332
335
337
339
341
344
344
345
345
347
348
351
353
355
355
357


Contents

xv


B Properties of Vector Products
B.1 Dot Product . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2 Vector Product . . . . . . . . . . . . . . . . . . . . . . . . . .

359
359
360

Bibliography

363

Index

367



List of Figures

1.1
1.2
1.3

1.4
1.5
1.6
1.7
1.8


1.9

1.10

1.11

1.12
2.1
2.2

2.3

Structure of a human eye. . . . . . . . . . . . . . . . . . . .
(Left) RGB additive primaries. (Right) CMY subtractive primaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(Top) CIE 1931 RGB color matching function (¯
x(λ), y¯(λ),
z¯(λ)). (Bottom) CIEXYZ color matching functions (¯
r(λ),
g¯(λ), ¯b(λ)). . . . . . . . . . . . . . . . . . . . . . . . . . . .
(Left) Chromaticities diagram. (Right) Gamut of different
RGB color systems. . . . . . . . . . . . . . . . . . . . . . .
HSL and HSV color space. . . . . . . . . . . . . . . . . . . .
Example of specification of a vector image (left) and the corresponding drawing (right). . . . . . . . . . . . . . . . . . .
The image of a house assembled using Lego pieces. . . . .
A grayscale image. (Left) The whole picture with a highlighted
area whose detail representation (Right) is shown as a matrix
of values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(Left) Original image with opaque background. (Middle)
Background color made transparent by setting alpha to zero
(transparency is indicated by the dark gray-light gray squares

pattern). (Right) A composition of the transparent image with
an image of a brick wall. . . . . . . . . . . . . . . . . . . . .
Vector vs raster images. (Left) A circle and a line assembled
to form a “9.” (From Left to Right) The corresponding raster
images at increased resolution. . . . . . . . . . . . . . . . . .
A schematic concept of ray tracing algorithm. Rays are shot
from the eye through the image plane and intersections with
the scene are found. Each time a ray collides with a surface it
bounces off the surface and may reach a light source (ray r1
after one bounce, ray r2 after two bounces). . . . . . . . . .
Logical scheme of the rasterization-based pipeline. . . . . . .
The WebGL pipeline. . . . . . . . . . . . . . . . . . . . . . .
Illustration of the mirroring of arrays from the system memory, where they can be accessed with JavaScript, to the graphics memory. . . . . . . . . . . . . . . . . . . . . . . . . . . .
The vertex flow. . . . . . . . . . . . . . . . . . . . . . . . . .

5
7

8
10
11
14
15

15

16

17


18
20
26

32
34

xvii


xviii
2.4
2.5
2.6
2.7
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11

3.12
3.13
3.14

3.15

3.16
3.17
3.18
3.19
3.20
3.21
3.22
3.23

List of Figures
Architecture of the NVMC framework. . . . . . .
The class NVMC incorporates all the knowledge
world of the race. . . . . . . . . . . . . . . . . . .
A very basic NVMC client. . . . . . . . . . . . . .
File organization of the NVMC clients. . . . . . .

. . . .
about
. . . .
. . . .
. . . .

. .
the
. .
. .
. .


42

An example of polygon mesh (about 22,000 faces). . . . . .
(Left) A strip of triangles. (Right) A fan of triangles. . . . .
Manifolds and non-manifolds. (Left) An example of 2manifold. (Right) Two non-manifold examples. . . . . . . .
Mesh orientation. . . . . . . . . . . . . . . . . . . . . . . . .
Mesh is a discrete representation. Curved surfaces are only
approximated. . . . . . . . . . . . . . . . . . . . . . . . . . .
Mesh is not a compact representation of a shape: a highdetailed surface requires many faces to be represented. . . .
Interpolation vs approximation. . . . . . . . . . . . . . . . .
Bernstein polynomials. (Top-Left) Basis of degree 1. (TopRight) Basis of degree 2. (Bottom) Basis of degree 3. . . . .
Cubic B´ezier curves examples. Note how the order of the control points influences the final shape of the curve. . . . . . .
B´ezier curves of high degree (degree 5 on the left and degree
7 on the right). . . . . . . . . . . . . . . . . . . . . . . . . .
B-splines blending functions. (Top) Uniform quadratic Bspline functions. Knots sequence ti = {0, 1, 2, 3, 4}. (Bottom)
Non-uniform quadratic B-spline function. Knots sequence ti =
{0, 1, 2.6, 3, 4} . . . . . . . . . . . . . . . . . . . . . . . . . .
Examples of B-splines of increasing order defined on eight
control points. . . . . . . . . . . . . . . . . . . . . . . . . . .
Bicubic B´ezier patch example. The control points are shown
as black dots. . . . . . . . . . . . . . . . . . . . . . . . . . .
Example of parametric surface representation with B´ezier
patches. The Utah teapot. . . . . . . . . . . . . . . . . . . .
NURBS surfaces modelling. (Left) NURBS head model from
the “NURBS Head Modeling Tutorial” by Jeremy Bim.
(Right) The grid on the final rendered version shows the UV
parameterization of the surface. . . . . . . . . . . . . . . . .
From pixels to voxels. . . . . . . . . . . . . . . . . . . . . . .
An example of voxels in medical imaging. . . . . . . . . . .
Constructive solid geometry. An example of a CSG tree. . .

Chaikin’s subdivision scheme. . . . . . . . . . . . . . . . . .
Primal and dual schemes for triangular and quadrilateral
mesh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Loop subdivision scheme. . . . . . . . . . . . . . . . . . . . .
Butterfly (modified) subdivision scheme. . . . . . . . . . . .
An example of indexed data structure. . . . . . . . . . . . .

53
54

43
43
49

55
56
56
57
59
60
62
63

64
65
66
66

68
68

69
70
72
74
76
77
79


List of Figures
3.24
3.25
3.26
3.27
3.28
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
4.15

4.16
4.17
4.18
4.19
4.20
4.21
4.22
4.23
4.24
4.25
4.26
4.27
4.28
4.29
4.30

Winged-edge data structure.
drawn in cyan. . . . . . . . .
Half-edge data structure. . .
Cube primitive. . . . . . . .
Cone primitive. . . . . . . .
Cylinder primitive. . . . . .

The pointers of the edge e5
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .


xix
are
. .
. .
. .
. .
. .

Points and vectors in two dimensions. . . . . . . . . . . . . .
Examples of translation (a), uniform scaling (b) and nonuniform scaling (c). . . . . . . . . . . . . . . . . . . . . . . .
Computation of the rotation of a point around the origin. .
(Left) Three collinear points. (Right) The same points after
an affine transformation. . . . . . . . . . . . . . . . . . . . .
Combining rotation and translation. . . . . . . . . . . . . .
How to make an object rotate around a specified point. . . .
Example of shearing for h = 0 and k = 2. . . . . . . . . . . .
Coordinates of a point are relative to the frame. . . . . . . .
(Right) An example of relations among frames. (Left) How it
can be represented in a graph. . . . . . . . . . . . . . . . . .
Handness of a coordinate system. . . . . . . . . . . . . . . .
An example of rotation around an axis. . . . . . . . . . . . .
How to build an orthogonal frame starting with a single axis.
Rotation around an axis without building a frame. . . . . .
A gimbal and the rotation of its rings. . . . . . . . . . . . .
Scheme of the relations among the three rings of a gimbal. .
Illustration of gimbal lock: when two rings rotate around the
same axis one degree of freedom is lost. . . . . . . . . . . . .
View reference frame. . . . . . . . . . . . . . . . . . . . . . .
The perspective projection. . . . . . . . . . . . . . . . . . .
The pinhole camera. . . . . . . . . . . . . . . . . . . . . . .

The orthographics projection. . . . . . . . . . . . . . . . . .
All the projections convert the viewing volume in the canonical viewing volume. . . . . . . . . . . . . . . . . . . . . . .
From CVV to viewport. . . . . . . . . . . . . . . . . . . . .
Summary of the geometric properties preserved by the different geometric transformations. . . . . . . . . . . . . . . . . .
Logic scheme of the transformations in the pipeline. . . . . .
Using basic primitives and transformations to assemble the
race scenario. . . . . . . . . . . . . . . . . . . . . . . . . . .
Hierarchy of transformations for the whole scene. . . . . . .
A snapshot from the very first working client . . . . . . . .
A view reference frame for implementing the view from behind
the car. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Adding the photographer point of view. . . . . . . . . . . .
The virtual trackball implemented with a sphere. . . . . . .

80
81
82
84
86
92
93
94
97
97
99
100
101
103
104
105

105
107
108
109
109
112
113
113
115
116
118
119
121
122
126
128
129
134
134


xx

List of Figures
4.31
4.32
4.33

5.1
5.2

5.3
5.4
5.5
5.6

5.7

5.8
5.9

5.10
5.11

5.12

5.13

A surface made by the union of a hyperbolid and a sphere. .
The virtual trackball implemented with a hyperbolid and a
sphere. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Adding the Observer point of view with WASD and Trackball
Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Discrete differential analyzer algorithm examples. . . . . . .
Bresenham’s algorithm. Schematization. . . . . . . . . . . .
Scanline algorithm for polygon filling. . . . . . . . . . . . . .
Any convex polygon can be expressed as the intersection of
the halfspaces built on the polygon edges. . . . . . . . . . .
Edge equation explained. . . . . . . . . . . . . . . . . . . . .
Optimization of inside/outside test for triangle filling. Pixels
outside the bounding rectangle do not need to be tested, as

well as pixels inside stamp A, which are outside the triangle,
and pixels inside stamps C and D, which are all inside the
triangle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Barycentric coordinates: (Top-Left) Barycenter on a segment
with two weights at the extremes. (Top-Right) Barycentric coordinates of a point inside a triangle. (Bottom-Left) Lines obtained keeping v0 constant area parallel to the opposite edge.
(Bottom-Right) Barycentric coordinates as a non-orthogonal
reference system. . . . . . . . . . . . . . . . . . . . . . . . .
Cases where primitives are not fully visible. . . . . . . . . .
(a) Depth sort example on four segments and a few examples of planes separating them. Note that C and D cannot be
separated by a plane aligned with the axis but they are by
the plane lying on C. D and E intersect and cannot be ordered without splitting them. (b) A case where, although no
intersections exist, the primitives cannot be ordered. . . . .
(a) Step of the scanline algorithm for a given plane. (b) The
corresponding spans created. . . . . . . . . . . . . . . . . .
State of the depth buffer during the rasterization of three
triangles (the ones shown in Figure 5.9(b)). On each pixel is
indicated the value of the depth buffer in [0, 1]. The numbers
in cyan indicate depth values that have been updated after
the last triangle was drawn. . . . . . . . . . . . . . . . . . .
Two truncated cones, one white and one cyan, superimposed
with a small translation so that the cyan one is closer to the
observer. However, because of z-buffer numerical approximation, part of the fragments of the cyan cones are not drawn
due to the depth test against those of the white one. . . . .
A plot showing the mapping between z-values in view space
and depth buffer space. . . . . . . . . . . . . . . . . . . . .

135
136
137
140

141
143
144
145

146

147
149

150
151

153

154
155


List of Figures
5.14

5.15

5.16

5.17
5.18
5.19
5.20

5.21
5.22

5.23

5.24

6.1
6.2
6.3
6.4
6.5
6.6
6.7

Stenciling example: (Left) The rendering from inside the car.
(Middle) The stencil mask, that is, the portion of screen that
does not need to be redrawn. (Right) The portion that is
affected by rendering. . . . . . . . . . . . . . . . . . . . . . .
Results of back-to-front rendering of four polygons. A and C
have α = 0.5, B and D have α = 1, and the order, from the
closest to the farthest, is A,B,C,D. . . . . . . . . . . . . . .
(Top-Left) A detail of a line rasterized with DDA rasterization. (Top-Right) The same line with the Average Area antialiasing. (Bottom) Results. . . . . . . . . . . . . . . . . . .
Exemplifying drawings for the cabin. The coordinates are expressed in clip space. . . . . . . . . . . . . . . . . . . . . . .
Adding the view from inside. Blending is used for the upper
part of the windshield. . . . . . . . . . . . . . . . . . . . . .
Scheme for the Cohen-Sutherland clipping algorithm. . . . .
Scheme for the Liang-Barsky clipping algorithm. . . . . . .
Sutherland-Hodgman algorithm. Clipping a polygon against
a rectangle is done by clipping on its four edges. . . . . . . .

(a) If a normal points toward −z in view space this does not
imply that it does the same in clip space. (b) The projection
of the vertices on the image plane is counter-clockwise if and
only if the triangle is front-facing. . . . . . . . . . . . . . . .
(Left) A bounding sphere for a street lamp: easy to test for
intersection but with high chances of false positives. (Right)
A bounding box for a street lamp: in this case we have little
empty space but we need more operations to test the intersection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example of a two-level hierarchy of Axis-Aligned Bounding
Boxes for a model of a car, obtained by slitting the bounding
box along two axes. . . . . . . . . . . . . . . . . . . . . . . .
Schematization of the effects that happen when light
interacts with matter. . . . . . . . . . . . . . . . . . . . . . .
Diffuse reflection. . . . . . . . . . . . . . . . . . . . . . . . .
Specular reflection. (Left) Perfect mirror. (Right) Non-ideal
specular material. . . . . . . . . . . . . . . . . . . . . . . . .
Mirror direction equation explained. . . . . . . . . . . . . .
Refraction. The direction of the refracted light is regulated by
Snell’s Law. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Solid angle. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Radiance incoming from the direction ωi (L(ωi )). Irradiance
(E) is the total radiance arriving from all the possible directions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xxi

156

157

158

160
162
163
164
165

166

168

169

173
175
175
176
177
179

180


xxii
6.8

6.9
6.10
6.11
6.12
6.13

6.14
6.15
6.16
6.17
6.18
6.19
6.20

6.21

6.22

6.23
6.24

7.1
7.2
7.3
7.4
7.5
7.6

7.7

List of Figures
Bidirectional Radiance Density Function (BRDF). θi and θr
are the inclination angles and φi and φr are the azimuthal angle. These angles define the incident and reflection direction.
Global illumination effects. Shadows, caustics and color bleeding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to compute vertex normals from the triangle mesh. . .
Using the known normal. . . . . . . . . . . . . . . . . . . . .

Crease angle and vertex duplication. . . . . . . . . . . . . .
How the normal must be transformed. . . . . . . . . . . . .
(Left) Lighting due to directional light source. (Right) Lighting due to point or positional light source. . . . . . . . . . .
Scene illuminated with directional light. . . . . . . . . . . .
Adding point light for the lamps. . . . . . . . . . . . . . . .
(Left) Lighting due to spot light source. (Right) Lighting due
to area light source. . . . . . . . . . . . . . . . . . . . . . . .
Adding headlights on the car. . . . . . . . . . . . . . . . . .
(Left) Specular component of the Phong illumination model.
(Right) The variant proposed by Blinn. . . . . . . . . . . . .
(Top-Left) Ambient component. (Top-Right) Diffuse component. (Bottom-Left) Specular component. (Bottom-Right)
The components summed up together (kA = (0.2, 0.2, 0.2),
kD = (0.0, 0.0, 0.6) , kS = (0.8, 0.8, 0.8) , ns = 1.2). . . . . .
Flat and Gouraud shading. As it can be seen, the flat shading emphasizes the perception of the faces that compose the
model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Gouraud shading vs Phong shading. (Left) Gouraud shading.
(Right) Phong shading. Note that some details result in a
better look with Phong shading (per-pixel) due to the nondense tessellation. . . . . . . . . . . . . . . . . . . . . . . .
Masking (left) and shadowing (right) effects. . . . . . . . . .
A car rendered with different reflection models. (Top-Left)
Phong. (Top-Right) Cook-Torrance. (Bottom-Left) OrenNayar. (Bottom-Right) Minnaert. . . . . . . . . . . . . . . .
A checkerboard can be modeled with 69 colored polygons or
with 6 polygons and an 8 × 8 texture. . . . . . . . . . . . . .
Common wrapping of texture coordinates: clamp and repeat.
Texturing in the rendering pipeline. . . . . . . . . . . . . . .
Magnification and minification. . . . . . . . . . . . . . . . .
Bilinear interpolation. Computation of the color at texture
coordinates (u , v ). . . . . . . . . . . . . . . . . . . . . . . .
The simplest mipmapping example: a pixel covers exactly four
texels, so we precompute a single texel texture and assign the

average color to it. . . . . . . . . . . . . . . . . . . . . . . .
Example of a mipmap pyramid. . . . . . . . . . . . . . . . .

182
186
187
188
189
190
192
197
200
201
204
207

208

209

210
212

213

218
219
220
221
221


222
223


List of Figures
7.8
7.9
7.10
7.11
7.12

7.13
7.14
7.15
7.16

7.17
7.18

7.19
7.20

7.21
7.22

7.23
7.24
7.25
7.26


7.27
7.28
7.29

Estimation of pixel size in texture space. . . . . . . . . . . .
Mipmapping at work. In this picture, false colors are used to
show the mipmap level used for each fragment. . . . . . . .
Perspective projection and linear interpolation lead to incorrect results for texturing. . . . . . . . . . . . . . . . . . . . .
Finding the perfect mapping. . . . . . . . . . . . . . . . . .
(Left) A tileable image on the left and an arrangment with
nine copies. (Right) A non-tileable image. Borders have been
highlighted to show the borders’ correspondence
(or lack of it). . . . . . . . . . . . . . . . . . . . . . . . . . .
Basic texturing. . . . . . . . . . . . . . . . . . . . . . . . . .
Scheme of how the rear mirror is obtained by mirroring the
view frame with respect to the plane where the mirror lies. .
Using render to texture for implementing the rear mirror. .
(a) An example of a sphere map. (b) The sphere map is created
by taking an orthogonal picture of a reflecting sphere. (c) How
reflection rays are mapped to texture space. . . . . . . . . .
A typical artifact produced by sphere mapping. . . . . . . .
(a) Six images are taken from the center of the cube. (b) The
cube map: the cube is unfolded as six square images on the
plane. (c) Mapping from a direction to texture coordinates.
Adding the reflection mapping. . . . . . . . . . . . . . . . .
A fine geometry is represented with a simpler base geometry
plus the geometric detail encoded in a texture as a
height field. . . . . . . . . . . . . . . . . . . . . . . . . . . .
With normal mapping, the texture encodes the normal. . .

Example of object space normal mapping. (Left) Original
mesh made up of 4 million triangles. (Center) A mesh of the
same object made of only 500 triangles. (Right) The low resolution mesh with normal mapping applied. . . . . . . . . .
An example of how a normal map may appear if opened with
an image viewer. . . . . . . . . . . . . . . . . . . . . . . . .
Deriving the tangential frame from texture coordinates. . .
A parametric plane. . . . . . . . . . . . . . . . . . . . . . . .
(Top) An extremely trivial way to unwrap a mesh: g is continuous only inside the triangle. (Bottom) Problems with filtering
due to discontinuities. . . . . . . . . . . . . . . . . . . . . .
A hemisphere may be mapped without seams. . . . . . . . .
The model of a car and relative parameterization, computed
with Graphite [14]. . . . . . . . . . . . . . . . . . . . . . . .
(Top) Distorted parameterization. (Bottom) Almost
isometric. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xxiii
224
224
225
226

227
231
232
234

235
236

237

242

243
244

245
246
248
249

250
251
252
253


×