You are previewing Computer Graphics: Principles and Practice, Third Edition.
O'Reilly logo
Computer Graphics: Principles and Practice, Third Edition

Book Description

Computer Graphics: Principles and Practice, Third Edition, remains the most authoritative introduction to the field. The first edition, the original “Foley and van Dam,” helped to define computer graphics and how it could be taught. The second edition became an even more comprehensive resource for practitioners and students alike. This third edition has been completely rewritten to provide detailed and up-to-date coverage of key concepts, algorithms, technologies, and applications.

The authors explain the principles, as well as the mathematics, underlying computer graphics–knowledge that is essential for successful work both now and in the future. Early chapters show how to create 2D and 3D pictures right away, supporting experimentation. Later chapters, covering a broad range of topics, demonstrate more sophisticated approaches. Sections on current computer graphics practice show how to apply given principles in common situations, such as how to approximate an ideal solution on available hardware, or how to represent a data structure more efficiently. Topics are reinforced by exercises, program­ming problems, and hands-on projects.

This revised edition features

  • New coverage of the rendering equation, GPU architecture considerations, and importance- sampling in physically based rendering

  • An emphasis on modern approaches, as in a new chapter on probability theory for use in Monte-Carlo rendering

  • Implementations of GPU shaders, software rendering, and graphics-intensive 3D interfaces

  • 3D real-time graphics platforms–their design goals and trade-offs–including new mobile and browser platforms

  • Programming and debugging approaches unique to graphics development 

The text and hundreds of figures are presented in full color throughout the book. Programs are written in C++, C#, WPF, or pseudocode–whichever language is most effective for a given example. Source code and figures from the book, testbed programs, and additional content will be available from the authors' website (cgpp.net) or the publisher's website  (informit.com/title/9780321399526). Instructor resources will be available from the publisher. The wealth of information in this book makes it the essential resource for anyone working in or studying any aspect of computer graphics.

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Contents at a Glance
  6. Contents
  7. Preface
    1. Historical Approaches
    2. Pedagogy
    3. Current Practice
    4. Principles
    5. Prerequisites
    6. Paths through This Book
    7. Differences from the Previous Edition
    8. Website
    9. Acknowledgments
    10. For the Student
    11. For the Teacher
  8. About the Authors
  9. Chapter 1. Introduction
    1. 1.1. An Introduction to Computer Graphics
    2. 1.2. A Brief History
    3. 1.3. An Illuminating Example
    4. 1.4. Goals, Resources, and Appropriate Abstractions
    5. 1.5. Some Numbers and Orders of Magnitude in Graphics
    6. 1.6. The Graphics Pipeline
    7. 1.7. Relationship of Graphics to Art, Design, and Perception
    8. 1.8. Basic Graphics Systems
    9. 1.9. Polygon Drawing As a Black Box
    10. 1.10. Interaction in Graphics Systems
    11. 1.11. Different Kinds of Graphics Applications
    12. 1.12. Different Kinds of Graphics Packages
    13. 1.13. Building Blocks for Realistic Rendering: A Brief Overview
    14. 1.14. Learning Computer Graphics
  10. Chapter 2. Introduction to 2D Graphics Using WPF
    1. 2.1. Introduction
    2. 2.2. Overview of the 2D Graphics Pipeline
    3. 2.3. The Evolution of 2D Graphics Platforms
    4. 2.4. Specifying a 2D Scene Using WPF
    5. 2.5. Dynamics in 2D Graphics Using WPF
    6. 2.6. Supporting a Variety of Form Factors
    7. 2.7. Discussion and Further Reading
  11. Chapter 3. An Ancient Renderer Made Modern
    1. 3.1. A Dürer Woodcut
    2. 3.2. Visibility
    3. 3.3. Implementation
    4. 3.4. The Program
    5. 3.5. Limitations
    6. 3.6. Discussion and Further Reading
    7. 3.7. Exercises
  12. Chapter 4. A 2D Graphics Test Bed
    1. 4.1. Introduction
    2. 4.2. Details of the Test Bed
    3. 4.3. The C# Code
    4. 4.4. Animation
    5. 4.5. Interaction
    6. 4.6. An Application of the Test Bed
    7. 4.7. Discussion
    8. 4.8. Exercises
  13. Chapter 5. An Introduction to Human Visual Perception
    1. 5.1. Introduction
    2. 5.2. The Visual System
    3. 5.3. The Eye
    4. 5.4. Constancy and Its Influences
    5. 5.5. Continuation
    6. 5.6. Shadows
    7. 5.7. Discussion and Further Reading
    8. 5.8. Exercises
  14. Chapter 6. Introduction to Fixed-Function 3D Graphics and Hierarchical Modeling
    1. 6.1. Introduction
    2. 6.2. Introducing Mesh and Lighting Specification
    3. 6.3. Curved-Surface Representation and Rendering
    4. 6.4. Surface Texture in WPF
    5. 6.5. The WPF Reflectance Model
    6. 6.6. Hierarchical Modeling Using a Scene Graph
    7. 6.7. Discussion
  15. Chapter 7. Essential Mathematics and the Geometry of 2-Space and 3-Space
    1. 7.1. Introduction
    2. 7.2. Notation
    3. 7.3. Sets
    4. 7.4. Functions
    5. 7.5. Coordinates
    6. 7.6. Operations on Coordinates
    7. 7.7. Intersections of Lines
    8. 7.8. Intersections, More Generally
    9. 7.9. Triangles
    10. 7.10. Polygons
    11. 7.11. Discussion
    12. 7.12. Exercises
  16. Chapter 8. A Simple Way to Describe Shape in 2D and 3D
    1. 8.1. Introduction
    2. 8.2. “Meshes” in 2D: Polylines
    3. 8.3. Meshes in 3D
    4. 8.4. Discussion and Further Reading
    5. 8.5. Exercises
  17. Chapter 9. Functions on Meshes
    1. 9.1. Introduction
    2. 9.2. Code for Barycentric Interpolation
    3. 9.3. Limitations of Piecewise Linear Extension
    4. 9.4. Smoother Extensions
    5. 9.5. Functions Multiply Defined at Vertices
    6. 9.6. Application: Texture Mapping
    7. 9.7. Discussion
    8. 9.8. Exercises
  18. Chapter 10. Transformations in Two Dimensions
    1. 10.1. Introduction
    2. 10.2. Five Examples
    3. 10.3. Important Facts about Transformations
    4. 10.4. Translation
    5. 10.5. Points and Vectors Again
    6. 10.6. Why Use 3 × 3 Matrices Instead of a Matrix and a Vector?
    7. 10.7. Windowing Transformations
    8. 10.8. Building 3D Transformations
    9. 10.9. Another Example of Building a 2D Transformation
    10. 10.10. Coordinate Frames
    11. 10.11. Application: Rendering from a Scene Graph
    12. 10.12. Transforming Vectors and Covectors
    13. 10.13. More General Transformations
    14. 10.14. Transformations versus Interpolation
    15. 10.15. Discussion and Further Reading
    16. 10.16. Exercises
  19. Chapter 11. Transformations in Three Dimensions
    1. 11.1. Introduction
    2. 11.2. Rotations
    3. 11.3. Comparing Representations
    4. 11.4. Rotations versus Rotation Specifications
    5. 11.5. Interpolating Matrix Transformations
    6. 11.6. Virtual Trackball and Arcball
    7. 11.7. Discussion and Further Reading
    8. 11.8. Exercises
  20. Chapter 12. A 2D and 3D Transformation Library for Graphics
    1. 12.1. Introduction
    2. 12.2. Points and Vectors
    3. 12.3. Transformations
    4. 12.4. Specification of Transformations
    5. 12.5. Implementation
    6. 12.6. Three Dimensions
    7. 12.7. Associated Transformations
    8. 12.8. Other Structures
    9. 12.9. Other Approaches
    10. 12.10. Discussion
    11. 12.11. Exercises
  21. Chapter 13. Camera Specifications and Transformations
    1. 13.1. Introduction
    2. 13.2. A 2D Example
    3. 13.3. Perspective Camera Specification
    4. 13.4. Building Transformations from a View Specification
    5. 13.5. Camera Transformations and the Rasterizing Renderer Pipeline
    6. 13.6. Perspective and z-values
    7. 13.7. Camera Transformations and the Modeling Hierarchy
    8. 13.8. Orthographic Cameras
    9. 13.9. Discussion and Further Reading
    10. 13.10. Exercises
  22. Chapter 14. Standard Approximations and Representations
    1. 14.1. Introduction
    2. 14.2. Evaluating Representations
    3. 14.3. Real Numbers
    4. 14.4. Building Blocks of Ray Optics
    5. 14.5. Large-Scale Object Geometry
    6. 14.6. Distant Objects
    7. 14.7. Volumetric Models
    8. 14.8. Scene Graphs
    9. 14.9. Material Models
    10. 14.10. Translucency and Blending
    11. 14.11. Luminaire Models
    12. 14.12. Discussion
    13. 14.13. Exercises
  23. Chapter 15. Ray Casting and Rasterization
    1. 15.1. Introduction
    2. 15.2. High-Level Design Overview
    3. 15.3. Implementation Platform
    4. 15.4. A Ray-Casting Renderer
    5. 15.5. Intermezzo
    6. 15.6. Rasterization
    7. 15.7. Rendering with a Rasterization API
    8. 15.8. Performance and Optimization
    9. 15.9. Discussion
    10. 15.10. Exercises
  24. Chapter 16. Survey of Real-Time 3D Graphics Platforms
    1. 16.1. Introduction
    2. 16.2. The Programmer’s Model: OpenGL Compatibility (Fixed-Function) Profile
    3. 16.3. The Programmer’s Model: OpenGL Programmable Pipeline
    4. 16.4. Architectures of Graphics Applications
    5. 16.5. 3D on Other Platforms
    6. 16.6. Discussion
  25. Chapter 17. Image Representation and Manipulation
    1. 17.1. Introduction
    2. 17.2. What Is an Image?
    3. 17.3. Image File Formats
    4. 17.4. Image Compositing
    5. 17.5. Other Image Types
    6. 17.6. MIP Maps
    7. 17.7. Discussion and Further Reading
    8. 17.8. Exercises
  26. Chapter 18. Images and Signal Processing
    1. 18.1. Introduction
    2. 18.2. Historical Motivation
    3. 18.3. Convolution
    4. 18.4. Properties of Convolution
    5. 18.5. Convolution-like Computations
    6. 18.6. Reconstruction
    7. 18.7. Function Classes
    8. 18.8. Sampling
    9. 18.9. Mathematical Considerations
    10. 18.10. The Fourier Transform: Definitions
    11. 18.11. The Fourier Transform of a Function on an Interval
    12. 18.12. Generalizations to Larger Intervals and All of R
    13. 18.13. Examples of Fourier Transforms
    14. 18.14. An Approximation of Sampling
    15. 18.15. Examples Involving Limits
    16. 18.16. The Inverse Fourier Transform
    17. 18.17. Properties of the Fourier Transform
    18. 18.18. Applications
    19. 18.19. Reconstruction and Band Limiting
    20. 18.20. Aliasing Revisited
    21. 18.21. Discussion and Further Reading
    22. 18.22. Exercises
  27. Chapter 19. Enlarging and Shrinking Images
    1. 19.1. Introduction
    2. 19.2. Enlarging an Image
    3. 19.3. Scaling Down an Image
    4. 19.4. Making the Algorithms Practical
    5. 19.5. Finite-Support Approximations
    6. 19.6. Other Image Operations and Efficiency
    7. 19.7. Discussion and Further Reading
    8. 19.8. Exercises
  28. Chapter 20. Textures and Texture Mapping
    1. 20.1. Introduction
    2. 20.2. Variations of Texturing
    3. 20.3. Building Tangent Vectors from a Parameterization
    4. 20.4. Codomains for Texture Maps
    5. 20.5. Assigning Texture Coordinates
    6. 20.6. Application Examples
    7. 20.7. Sampling, Aliasing, Filtering, and Reconstruction
    8. 20.8. Texture Synthesis
    9. 20.9. Data-Driven Texture Synthesis
    10. 20.10. Discussion and Further Reading
    11. 20.11. Exercises
  29. Chapter 21. Interaction Techniques
    1. 21.1. Introduction
    2. 21.2. User Interfaces and Computer Graphics
    3. 21.3. Multitouch Interaction for 2D Manipulation
    4. 21.4. Mouse-Based Object Manipulation in 3D
    5. 21.5. Mouse-Based Camera Manipulation: Unicam
    6. 21.6. Choosing the Best Interface
    7. 21.7. Some Interface Examples
    8. 21.8. Discussion and Further Reading
    9. 21.9. Exercises
  30. Chapter 22. Splines and Subdivision Curves
    1. 22.1. Introduction
    2. 22.2. Basic Polynomial Curves
    3. 22.3. Fitting a Curve Segment between Two Curves: The Hermite Curve
    4. 22.4. Gluing Together Curves and the Catmull-Rom Spline
    5. 22.5. Cubic B-splines
    6. 22.6. Subdivision Curves
    7. 22.7. Discussion and Further Reading
    8. 22.8. Exercises
  31. Chapter 23. Splines and Subdivision Surfaces
    1. 23.1. Introduction
    2. 23.2. Bézier Patches
    3. 23.3. Catmull-Clark Subdivision Surfaces
    4. 23.4. Modeling with Subdivision Surfaces
    5. 23.5. Discussion and Further Reading
  32. Chapter 24. Implicit Representations of Shape
    1. 24.1. Introduction
    2. 24.2. Implicit Curves
    3. 24.3. Implicit Surfaces
    4. 24.4. Representing Implicit Functions
    5. 24.5. Other Representations of Implicit Functions
    6. 24.6. Conversion to Polyhedral Meshes
    7. 24.7. Conversion from Polyhedral Meshes to Implicits
    8. 24.8. Texturing Implicit Models
    9. 24.9. Ray Tracing Implicit Surfaces
    10. 24.10. Implicit Shapes in Animation
    11. 24.11. Discussion and Further Reading
    12. 24.12. Exercises
  33. Chapter 25. Meshes
    1. 25.1. Introduction
    2. 25.2. Mesh Topology
    3. 25.3. Mesh Geometry
    4. 25.4. Level of Detail
    5. 25.5. Mesh Applications 1: Marching Cubes, Mesh Repair, and Mesh Improvement
    6. 25.6. Mesh Applications 2: Deformation Transfer and Triangle-Order Optimization
    7. 25.7. Discussion and Further Reading
    8. 25.8. Exercises
  34. Chapter 26. Light
    1. 26.1. Introduction
    2. 26.2. The Physics of Light
    3. 26.3. The Microscopic View
    4. 26.4. The Wave Nature of Light
    5. 26.5. Fresnel’s Law and Polarization
    6. 26.6. Modeling Light as a Continuous Flow
    7. 26.7. Measuring Light
    8. 26.8. Other Measurements
    9. 26.9. The Derivative Approach
    10. 26.10. Reflectance
    11. 26.11. Discussion and Further Reading
    12. 26.12. Exercises
  35. Chapter 27. Materials and Scattering
    1. 27.1. Introduction
    2. 27.2. Object-Level Scattering
    3. 27.3. Surface Scattering
    4. 27.4. Kinds of Scattering
    5. 27.5. Empirical and Phenomenological Models for Scattering
    6. 27.6. Measured Models
    7. 27.7. Physical Models for Specular and Diffuse Reflection
    8. 27.8. Physically Based Scattering Models
    9. 27.9. Representation Choices
    10. 27.10. Criteria for Evaluation
    11. 27.11. Variations across Surfaces
    12. 27.12. Suitability for Human Use
    13. 27.13. More Complex Scattering
    14. 27.14. Software Interface to Material Models
    15. 27.15. Discussion and Further Reading
    16. 27.16. Exercises
  36. Chapter 28. Color
    1. 28.1. Introduction
    2. 28.2. Spectral Distribution of Light
    3. 28.3. The Phenomenon of Color Perception and the Physiology of the Eye
    4. 28.4. The Perception of Color
    5. 28.5. Color Description
    6. 28.6. Conventional Color Wisdom
    7. 28.7. Color Perception Strengths and Weaknesses
    8. 28.8. Standard Description of Colors
    9. 28.9. Perceptual Color Spaces
    10. 28.10. Intermezzo
    11. 28.11. White
    12. 28.12. Encoding of Intensity, Exponents, and Gamma Correction
    13. 28.13. Describing Color
    14. 28.14. CMY and CMYK Color
    15. 28.15. The YIQ Color Model
    16. 28.16. Video Standards
    17. 28.17. HSV and HLS
    18. 28.18. Interpolating Color
    19. 28.19. Using Color in Computer Graphics
    20. 28.20. Discussion and Further Reading
    21. 28.21. Exercises
  37. Chapter 29. Light Transport
    1. 29.1. Introduction
    2. 29.2. Light Transport
    3. 29.3. A Peek Ahead
    4. 29.4. The Rendering Equation for General Scattering
    5. 29.5. Scattering, Revisited
    6. 29.6. A Worked Example
    7. 29.7. Solving the Rendering Equation
    8. 29.8. The Classification of Light-Transport Paths
    9. 29.9. Discussion
    10. 29.10. Exercise
  38. Chapter 30. Probability and Monte Carlo Integration
    1. 30.1. Introduction
    2. 30.2. Numerical Integration
    3. 30.3. Random Variables and Randomized Algorithms
    4. 30.4. Continuum Probability, Continued
    5. 30.5. Importance Sampling and Integration
    6. 30.6. Mixed Probabilities
    7. 30.7. Discussion and Further Reading
    8. 30.8. Exercises
  39. Chapter 31. Computing Solutions to the Rendering Equation: Theoretical Approaches
    1. 31.1. Introduction
    2. 31.2. Approximate Solutions of Equations
    3. 31.3. Method 1: Approximating the Equation
    4. 31.4. Method 2: Restricting the Domain
    5. 31.5. Method 3: Using Statistical Estimators
    6. 31.6. Method 4: Bisection
    7. 31.7. Other Approaches
    8. 31.8. The Rendering Equation, Revisited
    9. 31.9. What Do We Need to Compute?
    10. 31.10. The Discretization Approach: Radiosity
    11. 31.11. Separation of Transport Paths
    12. 31.12. Series Solution of the Rendering Equation
    13. 31.13. Alternative Formulations of Light Transport
    14. 31.14. Approximations of the Series Solution
    15. 31.15. Approximating Scattering: Spherical Harmonics
    16. 31.16. Introduction to Monte Carlo Approaches
    17. 31.17. Tracing Paths
    18. 31.18. Path Tracing and Markov Chains
    19. 31.19. Photon Mapping
    20. 31.20. Discussion and Further Reading
    21. 31.21. Exercises
  40. Chapter 32. Rendering in Practice
    1. 32.1. Introduction
    2. 32.2. Representations
    3. 32.3. Surface Representations and Representing BSDFs Locally
    4. 32.4. Representation of Light
    5. 32.5. A Basic Path Tracer
    6. 32.6. Photon Mapping
    7. 32.7. Generalizations
    8. 32.8. Rendering and Debugging
    9. 32.9. Discussion and Further Reading
    10. 32.10. Exercises
  41. Chapter 33. Shaders
    1. 33.1. Introduction
    2. 33.2. The Graphics Pipeline in Several Forms
    3. 33.3. Historical Development
    4. 33.4. A Simple Graphics Program with Shaders
    5. 33.5. A Phong Shader
    6. 33.6. Environment Mapping
    7. 33.7. Two Versions of Toon Shading
    8. 33.8. Basic XToon Shading
    9. 33.9. Discussion and Further Reading
    10. 33.10. Exercises
  42. Chapter 34. Expressive Rendering
    1. 34.1. Introduction
    2. 34.2. The Challenges of Expressive Rendering
    3. 34.3. Marks and Strokes
    4. 34.4. Perception and Salient Features
    5. 34.5. Geometric Curve Extraction
    6. 34.6. Abstraction
    7. 34.7. Discussion and Further Reading
  43. Chapter 35. Motion
    1. 35.1. Introduction
    2. 35.2. Motivating Examples
    3. 35.3. Considerations for Rendering
    4. 35.4. Representations
    5. 35.5. Pose Interpolation
    6. 35.6. Dynamics
    7. 35.7. Remarks on Stability in Dynamics
    8. 35.8. Discussion
  44. Chapter 36. Visibility Determination
    1. 36.1. Introduction
    2. 36.2. Ray Casting
    3. 36.3. The Depth Buffer
    4. 36.4. List-Priority Algorithms
    5. 36.5. Frustum Culling and Clipping
    6. 36.6. Backface Culling
    7. 36.7. Hierarchical Occlusion Culling
    8. 36.8. Sector-based Conservative Visibility
    9. 36.9. Partial Coverage
    10. 36.10. Discussion and Further Reading
    11. 36.11. Exercise
  45. Chapter 37. Spatial Data Structures
    1. 37.1. Introduction
    2. 37.2. Programmatic Interfaces
    3. 37.3. Characterizing Data Structures
    4. 37.4. Overview of k-dimensional Structures
    5. 37.5. List
    6. 37.6. Trees
    7. 37.7. Grid
    8. 37.8. Discussion and Further Reading
  46. Chapter 38. Modern Graphics Hardware
    1. 38.1. Introduction
    2. 38.2. NVIDIA GeForce 9800 GTX
    3. 38.3. Architecture and Implementation
    4. 38.4. Parallelism
    5. 38.5. Programmability
    6. 38.6. Texture, Memory, and Latency
    7. 38.7. Locality
    8. 38.8. Organizational Alternatives
    9. 38.9. GPUs as Compute Engines
    10. 38.10. Discussion and Further Reading
    11. 38.11. Exercises
  47. List of Principles
  48. Bibliography
  49. Index