內容簡介
本書是一本內容豐富、取材新穎的計算機圖形學著作,在前一版的基礎上進行了棄市擊全面擴充,增加了許多新的內容,覆蓋了近年來計算機圖形糠剃拔學的最新發展和成就。全書層次分明、重點突朽姜蒸出,並附有使用OpenGL編寫的大量程式及各種效果圖,是一本難得的優秀教材。全書共分為24章及3個附錄,全面系統地講解了計算機圖形學的基本概念和相關技術。作者首先對計算機圖形學進行綜述;然後講解二維圖形的對象表示、算法及套用,三維圖形的相關技術、建模和變換等;接著介紹光照模型、顏色模埋乃迎型和動畫技術。本書還新增了有關分層建求囑捉協模與動畫的介紹,OpenGL的全面介紹;最後戀騙囑戒的附錄給出了計算機圖形學中用辨汽到的基本數學概念、圖形檔案格式及OpenGL的相關內容等。
圖書目錄
Contents
1 A Survey of Computer Graphics 25
1-1 Graphs and Charts 26
1-2 Computer-Aided Design 26
1-3 Virtual-Reality Environments 28
1-4 Data Visualizations 28
1-5 Education and Training 29
1-6 Computer Art 29
1-7 Entertainment 30
1-8 Image Processing 31
1-9 Graphical User Interfaces 31
1-10 Summary 32
2 Computer Graphics Hardware 33
2-1 Video Display Devices 34
Refresh Cathode-Ray Tubes 34
Raster-Scan Displays 37
Random-Scan Displays 39
Color CRT Monitors 40
Flat-Panel Displays 42
Three-Dimensional Viewing Devices 44
Stereoscopic and Virtual-Reality Systems 45
2-2 Raster-Scan Systems 46
Video Controller 46
Raster-Scan Display Processor 48
2-3 GraphicsWorkstations and Viewing Systems 49
2-4 Input Devices 50
Keyboards, Button Boxes, and Dials 50
Mouse Devices 50
Trackballs and Spaceballs 51
Joysticks 51
Data Gloves 52
Digitizers 52
Image Scanners 53
Touch Panels 53
Light Pens 54
Voice Systems 54
2-5 Hard-Copy Devices 54
2-6 Graphics Networks 56
2-7 Graphics on the Internet 56
2-8 Summary 57
3 Computer Graphics Software 59
3-1 Coordinate Representations 60
3-2 Graphics Functions 61
3-3 Software Standards 62
3-4 Other Graphics Packages 63
3-5 Introduction to OpenGL 64
Basic OpenGL Syntax 64
Related Libraries 64
Header Files 65
Display-Window Management Using GLUT 66
A Complete OpenGL Program 67
Error Handling in OpenGL 71
3-6 Summary 72
4 Graphics Output Primitives 75
4-1 Coordinate Reference Frames 76
Screen Coordinates 76
Absolute and Relative Coordinate Specifications 77
4-2 Specifying A Two-DimensionalWorld-
Coordinate Reference Frame in OpenGL 78
4-3 OpenGL Point Functions 79
4-4 OpenGL Line Functions 81
4-5 OpenGL Curve Functions 82
4-6 Fill-Area Primitives 83
4-7 Polygon Fill Areas 84
Polygon Classifications 85
Identifying Concave Polygons 85
Splitting Concave Polygons 86
Splitting a Convex Polygon into a Set of Triangles 87
Inside-Outside Tests 87
Polygon Tables 90
Plane Equations 91
Front and Back Polygon Faces 92
4-8 OpenGL Polygon Fill-Area Functions 94
4-9 OpenGL Vertex Arrays 100
4-10 Pixel-Array Primitives 102
4-11 OpenGL Pixel-Array Functions 103
OpenGL Bitmap Function 103
OpenGL Pixmap Function 105
OpenGL Raster Operations 106
4-12 Character Primitives 107
4-13 OpenGL Character Functions 109
4-14 Picture Partitioning 110
4-15 OpenGL Display Lists 111
Creating and Naming an OpenGL Display List 111
Executing OpenGL Display Lists 112
Deleting OpenGL Display Lists 113
4-16 OpenGL Display-Window Reshape Function 113
4-17 Summary 116
5 Attributes of Graphics
Primitives 129
5-1 OpenGL State Variables 130
5-2 Color and Grayscale 130
RGB Color Components 130
Color Tables 131
Grayscale 132
Other Color Parameters 133
5-3 OpenGL Color Functions 133
The OpenGL RGB and RGBA Color Modes 133
OpenGL Color-Index Mode 134
OpenGL Color Blending 135
OpenGL Color Arrays 136
Other OpenGL Color Functions 138
5-4 Point Attributes 139
5-5 OpenGL Point-Attribute Functions 139
5-6 Line Attributes 139
Line Width 139
Line Style 140
Pen and Brush Options 140
5-7 OpenGL Line-Attribute Functions 141
OpenGL Line-Width Function 141
OpenGL Line-Style Function 141
Other OpenGL Line Effects 143
5-8 Curve Attributes 143
5-9 Fill-Area Attributes 144
Fill Styles 144
Color-Blended Fill Regions 145
5-10 OpenGL Fill-Area Attribute Functions 145
OpenGL Fill-Pattern Function 145
OpenGL Texture and Interpolation Patterns 146
OpenGL Wire-Frame Methods 147
OpenGL Front-Face Function 150
5-11 Character Attributes 150
5-12 OpenGL Character-Attribute Functions 153
5-13 OpenGL Antialiasing Functions 153
5-14 OpenGL Query Functions 154
5-15 OpenGL Attribute Groups 155
5-16 Summary 155
6 Implementation Algorithms for Graphics Primitives and Attributes 161
6-1 Line-Drawing Algorithms 162
Line Equations 162
DDA Algorithm 163
Bresenham’s Line Algorithm 164
Displaying Polylines 168
6-2 Parallel Line Algorithms 168
6-3 Setting Frame-Buffer Values 170
6-4 Circle-Generating Algorithms 171
Properties of Circles 171
Midpoint Circle Algorithm 173
6-5 Ellipse-Generating Algorithms 177
Properties of Ellipses 177
Midpoint Ellipse Algorithm 178
6-6 Other Curves 184
Conic Sections 185
Polynomials and Spline Curves 186
6-7 Parallel Curve Algorithms 187
6-8 Pixel Addressing and Object Geometry 187
Screen Grid Coordinates 188
Maintaining Geometric Properties of Displayed Objects 188
6-9 Attribute Implementations for Straight-Line Segments and Curves 190
Line Width 190
Line Style 192
Pen and Brush Options 193
Curve Attributes 194
6-10 General Scan-Line Polygon-Fill Algorithm 195
6-11 Scan-Line Fill of Convex Polygons 199
6-12 Scan-Line Fill for Regions with Curved Boundaries 200
6-13 Fill Methods for Areas with Irregular Boundaries 200
Boundary-Fill Algorithm 200
Flood-Fill Algorithm 204
6-14 Implementation Methods for Fill Styles 204
Fill Styles 205
Color-Blended Fill Regions 205
6-15 Implementation Methods for Antialiasing 207
Supersampling Straight-Line Segments 208
Subpixel Weighting Masks 210
Area Sampling Straight-Line Segments 210
Filtering Techniques 210
Pixel Phasing 210
Compensating for Line-Intensity Differences 211
Antialiasing Area Boundaries 212
6-16 Summary 214
7 Two-Dimensional Geometric Transformations 219
7-1 Basic Two-Dimensional Geometric Transformations 220
Two-Dimensional Translation 220
Two-Dimensional Rotation 222
Two-Dimensional Scaling 224
7-2 Matrix Representations and
Homogeneous Coordinates 225
Homogeneous Coordinates 226
Two-Dimensional Translation Matrix 227
Two-Dimensional Rotation Matrix 227
Two-Dimensional Scaling Matrix 227
7-3 Inverse Transformations 228
7-4 Two-Dimensional Composite Transformations 228
Composite Two-Dimensional Translations 229
Composite Two-Dimensional Rotations 229
Composite Two-Dimensional Scalings 229
General Two-Dimensional Pivot-Point Rotation 230
General Two-Dimensional Fixed-Point Scaling 230
General Two-Dimensional Scaling Directions 231
Matrix Concatenation Properties 232
General Two-Dimensional Composite Transformations and Computational
Efficiency 233
Two-Dimensional Rigid-Body Transformation 234
Constructing Two-Dimensional Rotation Matrices 235
Two-Dimensional Composite-Matrix Programming Example 235
7-5 Other Two-Dimensional Transformations 240
Reflection 240
Shear 242
7-6 Raster Methods for Geometric Transformations 244
7-7 OpenGL Raster Transformations 245
7-8 Transformations between Two-Dimensional Coordinate Systems 246
7-9 OpenGL Functions for Two-Dimensional Geometric Transformations 248
Basic OpenGL Geometric Transformations 248
OpenGL Matrix Operations 250
7-10 OpenGL Geometric-Transformation Programming Examples 252
7-11 Summary 253
8 Two-Dimensional Viewing 257
8-1 The Two-Dimensional Viewing Pipeline 258
8-2 The ClippingWindow 259
Viewing-Coordinate Clipping Window 260
World-Coordinate Clipping Window 260
8-3 Normalization and Viewport Transformations 261
Mapping the Clipping Window into a Normalized Viewport 261
Mapping the Clipping Window into a Normalized Square 263
Display of Character Strings 265
Split-Screen Effects and Multiple Output Devices 265
8-4 OpenGL Two-Dimensional Viewing Functions 265
OpenGL Projection Mode 265
GLU Clipping-Window Function 266
OpenGL Viewport Function 266
Creating a GLUT Display Window 267
Setting the GLUT Display-Window Mode and Color 268
GLUT Display-Window Identifier 268
Deleting a GLUT Display Window 268
Current GLUT Display Window 268
Relocating and Resizing a GLUT Display Window 269
Managing Multiple GLUT Display Windows 269
GLUT Subwindows 269
Selecting a Display-Window Screen-Cursor Shape 270
Viewing Graphics Objects in a GLUT Display Window 271
Executing the Application Program 271
Other GLUT Functions 272
OpenGL Two-Dimensional Viewing Program Example 272
8-5 Clipping Algorithms 274
8-6 Two-Dimensional Point Clipping 274
8-7 Two-Dimensional Line Clipping 275
Cohen-Sutherland Line Clipping 276
Liang-Barsky Line Clipping 281
Nicholl-Lee-Nicholl Line Clipping 284
Line Clipping Using Nonrectangular Polygon Clip Windows 286
Line Clipping Using Nonlinear Clipping-Window Boundaries 286
8-8 Polygon Fill-Area Clipping 287
Sutherland--Hodgman Polygon Clipping 289
Weiler-Atherton Polygon Clipping 293
Polygon Clipping Using Nonrectangular Polygon Clip Windows 295
Polygon Clipping Using Nonlinear Clipping-Window Boundaries 296
8-9 Curve Clipping 296
8-10 Text Clipping 297
8-11 Summary 298
9 Three-Dimensional Geometric Transformations 303
9-1 Three-Dimensional Translation 304
9-2 Three-Dimensional Rotation 305
Three-Dimensional Coordinate-Axis Rotations 306
General Three-Dimensional Rotations 308
Quaternion Methods for Three-Dimensional Rotations 313
9-3 Three-Dimensional Scaling 317
9-4 Composite Three-Dimensional Transformations 319
9-5 Other Three-Dimensional Transformations 322
Three-Dimensional Reflections 322
Three-Dimensional Shears 323
9-6 Transformations between Three-Dimensional Coordinate Systems 323
9-7 Affine Transformations 324
9-8 OpenGL Geometric-Transformation Functions 324
OpenGL Matrix Stacks 324
9-9 OpenGL Three-Dimensional Geometric-Transformation Programming Examples 326
9-10 Summary 327
10 Three-Dimensional Viewing 331
10-1 Overview of Three-Dimensional Viewing Concepts 332
Viewing a Three-Dimensional Scene 332
Projections 332
Depth Cueing 333
Identifying Visible Lines and Surfaces 333
Surface Rendering 333
Exploded and Cutaway Views 333
Three-Dimensional and Stereoscopic Viewing 334
10-2 The Three-Dimensional Viewing Pipeline 334
10-3 Three-Dimensional Viewing-Coordinate Parameters 336
The View-Plane Normal Vector 336
The View-Up Vector 337
The uvn Viewing-Coordinate Reference Frame 337
Generating Three-Dimensional Viewing Effects 338
10-4 Transformation fromWorld to Viewing Coordinates 338
10-5 Projection Transformations 340
10-6 Orthogonal Projections 340
Axonometric and Isometric Orthogonal Projections 341
Orthogonal Projection Coordinates 341
Clipping Window and Orthogonal-Projection View Volume 342
Normalization Transformation for an Orthogonal Projection 344
10-7 Oblique Parallel Projections 345
Oblique Parallel Projections in Drafting and Design 346
Cavalier and Cabinet Oblique Parallel Projections 347
Oblique Parallel-Projection Vector 348
Clipping Window and Oblique Parallel-Projection View Volume 349
Oblique Parallel-Projection Transformation Matrix 349
Normalization Transformation for an Oblique Parallel Projection 350
10-8 Perspective Projections 351
Perspective-Projection Transformation Coordinates 351
Perspective-Projection Equations: Special Cases 352
Vanishing Points for Perspective Projections 354
Perspective-Projection View Volume 355
Perspective-Projection Transformation Matrix 356
Symmetric Perspective-Projection Frustum 357
Oblique Perspective-Projection Frustum 359
Normalized Perspective-Projection Transformation Coordinates 362
10-9 The Viewport Transformation and Three-Dimensional Screen Coordinates 365
10-10 OpenGL Three-Dimensional Viewing Functions 365
OpenGL Viewing-Transformation Function 366
OpenGL Orthogonal-Projection Function 366
OpenGL Symmetric Perspective-Projection Function 368
OpenGL General Perspective-Projection Function 368
OpenGL Viewports and Display Windows 369
OpenGL Three-Dimensional Viewing Program Example 369
10-11 Three-Dimensional Clipping Algorithms 371
Clipping in Three-Dimensional Homogeneous Coordinates 372
Three-Dimensional Region Codes 373
Three-Dimensional Point and Line Clipping 374
Three-Dimensional Polygon Clipping 376
Three-Dimensional Curve Clipping 377
Arbitrary Clipping Planes 377
10-12 OpenGL Optional Clipping Planes 379
10-13 Summary 380
11 Hierarchical Modeling 383
11-1 Basic Modeling Concepts 384
System Representations 384
Symbol Hierarchies 385
11-2 Modeling Packages 387
11-3 General Hierarchical Modeling Methods 387
Local Coordinates 388
Modeling Transformations 388
Creating Hierarchical Structures 388
11-4 Hierarchical Modeling Using OpenGL Display Lists 390
11-5 Summary 391
12 Computer Animation 393
12-1 Raster Methods for Computer Animation 394
Double Buffering 394
Generating Animations Using Raster Operations 395
12-2 Design of Animation Sequences 396
12-3 Traditional Animation Techniques 397
12-4 General Computer-Animation Functions 398
12-5 Computer-Animation Languages 398
12-6 Key-Frame Systems 399
Morphing 399
Simulating Accelerations 401
12-7 Motion Specifications 404
Direct Motion Specification 404
Goal-Directed Systems 404
Kinematics and Dynamics 405
12-8 Character Animation 406
Articulated Figure Animation 406
Motion Capture 407
12-9 Periodic Motions 408
12-10 OpenGL Animation Procedures 409
12-11 Summary 412
13 Three-Dimensional Object Representations 417
13-1 Polyhedra 418
13-2 OpenGL Polyhedron Functions 418
OpenGL Polygon Fill-Area Functions 418
GLUT Regular Polyhedron Functions 418
Example GLUT Polyhedron Program 420
13-3 Curved Surfaces 421
13-4 Quadric Surfaces 422
Sphere 422
Ellipsoid 422
Torus 423
13-5 Superquadrics 424
Superellipse 424
Superellipsoid 425
13-6 OpenGL Quadric-Surface and Cubic-Surface Functions 425
GLUT Quadric-Surface Functions 425
GLUT Cubic-Surface Teapot Function 426
GLU Quadric-Surface Functions 427
Example Program Using GLUT and GLU Quadric-Surface Functions 429
13-7 Summary 431
14 Spline Representations 435
14-1 Interpolation and Approximation Splines 436
14-2 Parametric Continuity Conditions 437
14-3 Geometric Continuity Conditions 438
14-4 Spline Specifications 439
14-5 Spline Surfaces 440
14-6 Trimming Spline Surfaces 440
14-7 Cubic-Spline Interpolation Methods 441
Natural Cubic Splines 441
Hermite Interpolation 442
Cardinal Splines 443
Kochanek-Bartels Splines 447
14-8 Bézier Spline Curves 447
Bézier Curve Equations 448
Example Bézier Curve-Generating Program 449
Properties of Bézier Curves 452
Design Techniques Using Bézier Curves 453
Cubic Bézier Curves 454
14-9 Bézier Surfaces 455
14-10 B-Spline Curves 457
B-Spline Curve Equations 457
Uniform Periodic B-Spline Curves 458
Cubic Periodic B-Spline Curves 461
Open Uniform B-Spline Curves 463
Nonuniform B-Spline Curves 464
14-11 B-Spline Surfaces 466
14-12 Beta-Splines 466
Beta-Spline Continuity Conditions 466
Cubic Periodic Beta-Spline Matrix Representation 467
14-13 Rational Splines 467
14-14 Conversion Between Spline Representations 469
14-15 Displaying Spline Curves and Surfaces 470
Horner’s Rule 471
Forward-Difference Calculations 471
Subdivision Methods 472
14-16 OpenGL Approximation-Spline Functions 474
OpenGL Bézier-Spline Curve Functions 474
OpenGL Bézier-Spline Surface Functions 477
GLU B-Spline Curve Functions 479
GLU B-Spline Surface Functions 481
GLU Surface-Trimming Functions 483
14-17 Summary 485
15 Other Three-Dimensional Object Representations 491
15-1 Blobby Objects 492
15-2 Sweep Representations 493
15-3 Constructive Solid-Geometry Methods 494
15-4 Octrees 496
15-5 BSP Trees 498
15-6 Physically Based Modeling 499
15-7 Summary 500
16 Visible-Surface Detection Methods 503
16-1 Classification of Visible-Surface Detection Algorithms 504
16-2 Back-Face Detection 504
16-3 Depth-Buffer Method 505
16-4 A-Buffer Method 506
16-5 Scan-Line Method 510
16-6 Depth-Sorting Method 511
16-7 BSP-Tree Method 514
16-8 Area-Subdivision Method 515
16-9 Octree Methods 517
16-10 Ray-Casting Method 518
16-11 Comparison of Visibility-Detection Methods 519
16-12 Curved Surfaces 520
Curved-Surface Representations 520
Surface Contour Plots 520
16-13 Wire-Frame Visibility Methods 521
Wire-Frame Surface-Visibility Algorithms 521
Wire-Frame Depth-Cueing Algorithm 522
16-14 OpenGL Visibility-Detection Functions 523
OpenGL Polygon-Culling Functions 523
OpenGL Depth-Buffer Functions 523
OpenGL Wire-Frame Surface-Visibility Methods 525
OpenGL Depth-Cueing Function 525
16-15 Summary 526
17 Illumination Models and Surface-Rendering Methods 531
17-1 Light Sources 532
Point Light Sources 533
Infinitely Distant Light Sources 533
Radial Intensity Attenuation 533
Directional Light Sources and Spotlight Effects 534
Angular Intensity Attenuation 535
Extended Light Sources and the Warn Model 536
17-2 Surface Lighting Effects 536
17-3 Basic Illumination Models 537
Ambient Light 537
Diffuse Reflection 538
Specular Reflection and the Phong Model 540
Combined Diffuse and Specular Reflections 543
Diffuse and Specular Reflections from Multiple Light Sources 543
Surface Light Emissions 543
Basic Illumination Model with Intensity Attenuation and Spotlights 544
RGB Color Considerations 545
Other Color Representations 546
Luminance 546
17-4 Transparent Surfaces 546
Translucent Materials 547
Light Refraction 547
Basic Transparency Model 548
17-5 Atmospheric Effects 549
17-6 Shadows 550
17-7 Camera Parameters 550
17-8 Displaying Light Intensities 550
Distributing System Intensity Levels 551
Gamma Correction and Video Lookup Tables 552
Displaying Continuous-Tone Images 553
17-9 Halftone Patterns and Dithering Techniques 553
Halftone Approximations 555
Dithering Techniques 557
17-10 Polygon Rendering Methods 559
Constant-Intensity Surface Rendering 560
Gouraud Surface Rendering 560
Phong Surface Rendering 562
Fast Phong Surface Rendering 563
17-11 OpenGL Illumination and Surface-Rendering Functions 564
OpenGL Point Light-Source Function 564
Specifying an OpenGL Light-Source Position and Type 565
Specifying OpenGL Light-Source Colors 566
Specifying Radial-Intensity Attenuation Coefficients for an OpenGL Light Source 567
OpenGL Directional Light Sources (Spotlights) 567
OpenGL Global Lighting Parameters 568
OpenGL Surface-Property Function 569
OpenGL Illumination Model 570
OpenGL Atmospheric Effects 571
OpenGL Transparency Functions 572
OpenGL Surface-Rendering Functions 573
OpenGL Halftoning Operations 574
17-12 Summary 575
18 Texturing and Surface-Detail Methods 579
18-1 Modeling Surface Detail with Polygons 580
18-2 Texture Mapping 580
Linear Texture Patterns 581
Surface Texture Patterns 581
Volume Texture Patterns 584
Texture Reduction Patterns 585
Procedural Texturing Methods 585
18-3 Bump Mapping 585
18-4 Frame Mapping 586
18-5 OpenGL Texture Functions 587
OpenGL Line-Texture Functions 587
OpenGL Surface-Texture Functions 590
OpenGL Volume-Texture Functions 592
OpenGL Color Options for Texture Patterns 592
OpenGL Texture-Mapping Options 593
OpenGL Texture Wrapping 593
Copying OpenGL Texture Patterns from the Frame Buffer 594
OpenGL Texture-Coordinate Arrays 594
Naming OpenGL Texture Patterns 594
OpenGL Texture Subpatterns 596
OpenGL Texture Reduction Patterns 596
OpenGL Texture Borders 597
OpenGL Proxy Textures 597
Automatic Texturing of Quadric Surfaces 598
Homogeneous Texture Coordinates 598
Additional OpenGL Texture Options 599
18-6 Summary 599
19 Color Models and Color Applications 603
19-1 Properties of Light 604
The Electromagnetic Spectrum 604
Psychological Characteristics of Color 605
19-2 Color Models 606
Primary Colors 606
Intuitive Color Concepts 607
19-3 Standard Primaries and the Chromaticity Diagram 607
The XYZ Color Model 608
Normalized XYZ Values 608
The CIE Chromaticity Diagram 609
Color Gamuts 609
Complementary Colors 609
Dominant Wavelength 610
Purity 610
19-4 The RGB Color Model 610
19-5 The YIQ and Related Color Models 612
The YIQ Parameters 612
Transformations Between RGB and YIQ Color Spaces 612
The YUV and YCrCb Systems 613
19-6 The CMY and CMYK Color Models 613
The CMY Parameters 613
Transformations Between CMY and RGB Color Spaces 614
19-7 The HSV Color Model 614
The HSV Parameters 614
Selecting Shades, Tints, and Tones 615
Transformations Between HSV and RGB Color Spaces 616
19-8 The HLS Color Model 618
19-9 Color Selection and Applications 619
19-10 Summary 619
20 Interactive Input Methods and Graphical User Interfaces 623
20-1 Graphical Input Data 624
20-2 Logical Classification of Input Devices 624
Locator Devices 624
Stroke Devices 625
String Devices 625
Valuator Devices 625
Choice Devices 625
Pick Devices 626
20-3 Input Functions for Graphical Data 627
Input Modes 628
Echo Feedback 628
Callback Functions 628
20-4 Interactive Picture-Construction Techniques 629
Basic Positioning Methods 629
Dragging 629
Constraints 629
Grids 630
Rubber-Band Methods 630
Gravity Field 631
Interactive Painting and Drawing Methods 631
20-5 Virtual-Reality Environments 632
20-6 OpenGL Interactive Input-Device Functions 632
GLUT Mouse Functions 633
GLUT Keyboard Functions 637
GLUT Tablet Functions 641
GLUT Spaceball Functions 642
GLUT Button-Box Function 642
GLUT Dials Function 642
OpenGL Picking Operations 643
20-7 OpenGL Menu Functions 648
Creating a GLUT Menu 648
Creating and Managing Multiple GLUT Menus 650
Creating GLUT Submenus 651
Modifying GLUT Menus 653
20-8 Designing a Graphical User Interface 654
The User Dialogue 654
Windows and Icons 654
Accommodating Multiple Skill Levels 655
Consistency 655
Minimizing Memorization 655
Backup and Error Handling 656
Feedback 656
20-9 Summary 657
21 Global Illumination 663
21-1 Ray-Tracing Methods 664
Basic Ray-Tracing Algorithm 664
Ray–Surface Intersection Calculations 667
Ray–Sphere Intersections 668
Ray–Polyhedron Intersections 669
Reducing Object-Intersection Calculations 670
Space-Subdivision Methods 670
Simulating Camera Focusing Effects 672
Antialiased Ray Tracing 674
Distributed Ray Tracing 675
21-2 Radiosity Lighting Model 678
Radiant-Energy Terms 678
The Basic Radiosity Model 679
Progressive Refinement Radiosity Method 682
21-3 Environment Mapping 684
21-4 Photon Mapping 685
21-5 Summary 686
22 Programmable Shaders 689
22-1 A History of Shading Languages 690
Cook’s Shade Trees 690
Perlin’s Pixel Stream Editor 692
RenderMan 692
22-2 The OpenGL Pipeline 694
The Fixed-Function Pipeline 694
Changing the Pipeline Structure 695
Vertex Shaders 696
Fragment Shaders 696
Geometry Shaders 696
Tessellation Shaders 696
22-3 The OpenGL Shading Language 697
Shader Structure 697
Using Shaders in OpenGL 699
Basic Data Types 703
Vectors 703
Matrices 704
Structures and Arrays 704
Control Structures 705
GLSL Functions 705
Communicating with OpenGL 706
22-4 Shader Effects 707
A Phong Shader 708
Texture Mapping 711
Bump Mapping 713
22-5 Summary 717
23 Algorithmic Modeling 719
23-1 Fractal-Geometry Methods 720
Fractal Generation Procedures 721
Classification of Fractals 721
Fractal Dimension 722
Geometric Construction of Deterministic Self-Similar Fractals 724
Geometric Construction of Statistically Self-Similar Fractals 727
Affine Fractal-Construction Methods 728
Random Midpoint-Displacement Methods 728
Controlling Terrain Topography 730
Self-Squaring Fractals 732
Self-Inverse Fractals 741
23-2 Particle Systems 743
23-3 Grammar-Based Modeling Methods 744
23-4 Summary 746
24 Visualization of Data Sets 749
24-1 Visual Representations for Scalar Fields 750
24-2 Visual Representations for Vector Fields 752
24-3 Visual Representations for Tensor Fields 752
24-4 Visual Representations for Multivariate Data Fields 753
24-5 Summary 753
A Mathematics for Computer Graphics 755
A-1 Coordinate Reference Frames 755
Two-Dimensional Cartesian Screen Coordinates 755
Standard Two-Dimensional Cartesian Reference Frames 756
Polar Coordinates in the xy Plane 756
Standard Three-Dimensional Cartesian Reference Frames 757
Three-Dimensional Cartesian Screen Coordinates 757
Three-Dimensional Curvilinear-Coordinate Systems 758
Solid Angle 759
A-2 Points and Vectors 759
Point Properties 759
Vector Properties 760
Vector Addition and Scalar Multiplication 761
Scalar Product of Two Vectors 762
Vector Product of Two Vectors 762
A-3 Tensors 763
A-4 Basis Vectors and the Metric Tensor 763
Determining Basis Vectors for a Coordinate Space 764
Orthonormal Basis 764
Metric Tensor 765
A-5 Matrices 766
Scalar Multiplication and Matrix Addition 766
Matrix Multiplication 767
Matrix Transpose 768
Determinant of a Matrix 768
Matrix Inverse 768
A-6 Complex Numbers 769
Basic Complex Arithmetic 769
Imaginary Unit 770
Complex Conjugate and Modulus of a Complex Number 770
Complex Division 770
Polar-Coordinate Representation for a Complex Number 771
A-7 Quaternions 771
A-8 Nonparametric Representations 772
A-9 Parametric Representations 773
A-10 Rate-of-Change Operators 774
Gradient Operator 774
Directional Derivative 775
General Form of the Gradient Operator 775
Laplace Operator 775
Divergence Operator 776
Curl Operator 776
A-11 Rate-of-Change Integral Transformation Theorems 776
Stokes’s Theorem 777
Green’s Theorem for a Plane Surface 777
Divergence Theorem 778
Green’s Transformation Equations 779
A-12 Area and Centroid of a Polygon 779
Area of a Polygon 779
Centroid of a Polygon 780
A-13 Calculating Properties of Polyhedra 781
A-14 Numerical Methods 782
Solving Sets of Linear Equations 782
Finding Roots of Nonlinear Equations 784
Evaluating Integrals 785
Solving Ordinary Differential Equations 787
Solving Partial Differential Equations 788
Least-Squares Curve-Fitting Methods for Data Sets 789
B Graphics File Formats 793
B-1 Image-File Configurations 791
B-2 Color-Reduction Methods 792
Uniform Color Reduction 792
Popularity Color Reduction 792
Median-Cut Color Reduction 793
B-3 File-Compression Techniques 793
Run-Length Encoding 794
LZW Encoding 794
Other Pattern-Recognition Compression Methods 795
Huffman Encoding 795
Arithmetic Encoding 797
Discrete Cosine Transform 798
B-4 Composition of the Major File Formats 800
JPEG: Joint Photographic Experts Group 800
CGM: Computer-Graphics Metafile Format 802
TIFF: Tag Image-File Format 802
PNG: Portable Network-Graphics Format 803
XBM: X Window System Bitmap Format and XPM: X Window System Pixmap Format 803
Adobe Photoshop Format 803
MacPaint: Macintosh Paint Format 804
PICT: Picture Data Format 804
BMP: Bitmap Format 804
PCX: PC Paintbrush File Format 804
TGA: Truevision Graphics-Adapter Format 804
GIF: Graphics Interchange Format 805
B-5 Summary 805
C The World of OpenGL 807
C-1 The Evolution of OpenGL 807
The Early Years: OpenGL 1.x 808
OpenGL Goes Tiny: OpenGL ES 1.x 809
Under New Management: OpenGL and Khronos Group 810
Programmable Everything: OpenGL 2.x 810
Tiny Programs: OpenGL ES 2.x 811
Geometry and Vertex Processing Evolution: OpenGL 3.x 811
This Generation: OpenGL 4.x 813
The OpenGL Extension Mechanism 814
Where Next? 815
C-2 OpenGL beyond C and C++ 816
OpenGL for Java 816
Multithreading 819
Python and OpenGL 822
Conclusions and Directions 827
C-3 GPU Architecture, Past, Present, and Future 827
The Early Days 828
The Middle Ages 829
Modern GPUs 830
Parallelism 830
Getting the Most out of a Modern GPU 834
Balance the Workload 834
Always Move Forwards 835
Feed the Pipeline 835
Make Best Use of Your Resources 835
Bibliography 837
Index 849
OpenGL Function Index 861
Core Library Functions 861
GLSL Library Functions 862
GLU Library Functions 863
GLUT Library Functions 863