Physically Based Rendering

From Theory to Implementation

  • Pat Hanrahan, Stanford University, California, U.S.A.
  • By
    • Matt Pharr, Lead graphics architect in the Advanced Rendering Technology group at Intel
    • Greg Humphreys, Assistant Professor of Computer Science, University of Virginia and Senior Scientist at Aggregate Knowledge, Inc.

    "Computer graphics, and rendering in particular, is full of beautiful theory. The theory covers physical concepts, such as light fields and the interaction of light with different materials, and mathematical concepts, such as integral equations and Monte Carlo integration. The great thing about computers is that they allow us to build rendering systems based on the best theory. This book turns the theory of image-making into a practical method for creating images." —from the foreword by Pat Hanrahan, Canon USA Professor, Stanford University
    From movies to video games, computer-rendered images are pervasive today. Physically Based Rendering introduces the concepts and theory of photorealistic rendering hand in hand with the source code for a sophisticated renderer. By coupling the discussion of rendering algorithms with their implementations, Matt Pharr and Greg Humphreys are able to reveal many of the details and subtleties of these algorithms. But this book goes further; it also describes the design strategies involved with building real systems—there is much more to writing a good renderer than stringing together a set of fast algorithms. For example, techniques for high-quality antialiasing must be considered from the start, as they have implications throughout the system. The rendering system described in this book is itself highly readable, written in a style called literate programming that mixes text describing the system with the code that implements it. Literate programming gives a gentle introduction to working with programs of this size. This lucid pairing of text and code offers the most complete and in-depth book available for understanding, designing, and building physically realistic rendering systems.

    Audience
    Professionals, students, and researchers in computer graphics and entertainment computing.

,

Published: August 2004

Imprint: Morgan Kaufmann

ISBN: 978-0-12-553180-1

Reviews

  • "One can buy dozens of books on ray-tracing and physically based rendering, but when you actually sit down to write rendering code yourself, you may suddenly realize those books are only telling you half the story. At every turn you will face design and engineering decisions about everything from data structures to sampling patterns, any one of which can impact system performance drastically. Most people who have worked in the innards of rendering systems have learned this esoterica by hearsay and a lot of trial and error. Matt Pharr and Greg Humphreys have decided to tell the rest of the story, by publishing and annotating the breadth and depth of a fully functional, physically based renderer, using the literate programming approach. Applying this approach—which interleaves source code and descriptive text—to the construction and documentation of even a simple computer program can be a daunting task, but it's application here is Herculean and quite possibly historic. In spite of their attention to engineering detail, the authors haven't skimped on their coverage of the theoretical underpinnings of physically based rendering. Their chapters on sampling theory and material models are among the best in print. However, the inclusion of a working artifact that implements the theory using corresponding notation and structure is an incomparable learning and teaching tool." —Dan Goldman, computer graphics supervisor for visual effects

    "We have been using early versions of this book and its accompanying source code in our graduate courses and in our research for the past two semesters, and we've been thrilled with them. The book has an excellent blend of the theoretical and practical information needed to build an efficient physically based renderer. Much of the information contained in the book is not available in any other reference book; an example is the description of practical methods for anisotropic filtering. The code that accompanies the book satisfies at least as great a need—it's well written, well commented, and strikes a good balance between performance and extensibility. As a result, we have already adopted the code as the software infrastructure for two different research projects within our group. I enthusiastically recommend that any researcher or practioner who works on rendering systems buy a copy of this book." —Bill Mark, Assistant Professor, University of Texas at Austin

    "This book is the only place to my knowledge where the implementation details of several advanced global illumination algorithms are actually shown. Not only details, but code! That is a tremendous benefit to the community and a major strength of the book." —Timothy Purcell, Stanford University / NVIDIA

    "Designing and implementing a production-quality ray tracer that is based on the physical principles of light transport is difficult. Writing a book that clearly explains the underlying principles and algorithms, from radiative transfer theory to Loop subdivision and photon mapping, is hard. Combining these explanations with source code using Knuth's literate programming methodology to produce a beautifully-designed, full-featured, and wonderfully extensible rendering system might seem NP-hard, but this book proves that it can be done. Whether you are a computer science student or computer graphics researcher, there is simply no better book on the topic." —Ian Ashdown, President, byHeart Consultants Limited

    "A good textbook should inspire, and inform the reader and allow him or her to go beyond the covers of the book. Matt and Greg have done a yeoman's job of creating a very comprehensive source of knowledge on the topics of global illumination and physically based rendering. The book certainly informs the reader. It does not simplify the material and that is a good thing. Rather, through careful exposition and very useful illustrations it provides several learning aids. There are several chapters on several fundamental topics replete with examples, figures and illustrations. Also, the treatment of various algorithms is simultaneously both comprehensive and in great depth. Most importantly, the book relies on a carefully developed programming environment that allows the reader to experiment. pbrt is easy to use and yet allows for rendition of complex scenes. As a result one can learn the material in a pedagogically sound way and also venture beyond the confines of the text. It is easy to be inspired by the effort. I have used a version of the book and software as a text for an advanced course in computer graphics. Both my students and I found the text very useful." —Raghu Machiraju, Associate Professor, Department of Computer Science and Engineering, The Ohio State University

    "This book is a great tool for anyone looking to get into advanced ray tracing techniques. It is the best guide to architecting a photorealistic renderer that I have seen." —Brian Budge, Ph.D. student, graphics and visualization research group, UC Davis

Contents

    • Foreword by Pat Hanrahan
    • Preface
    • *indicates advanced topics
    • CHAPTER 01. INTRODUCTION
      • 1.1 Literate Programming
        • 1.1.1 Indexing and Cross-Referencing
      • 1.2 Photorealistic Rendering and the Ray-Tracing Algorithm
        • 1.2.1 Cameras
        • 1.2.2 Ray-Object Intersections
        • 1.2.3 Light Distribution
        • 1.2.4 Visibility
        • 1.2.5 Surface Scattering
        • 1.2.6 Recursive Ray Tracing
        • 1.2.7 Ray Propagation
      • 1.3 pbrt : System Overview
        • 1.3.1 Phases of Execution
        • 1.3.2 Scene Representation
        • 1.3.3 Main Rendering Loop
        • 1.3.4 SceneMethods
        • 1.3.5 An Integrator for Whitted-Style Ray Tracing
      • 1.4 How to Proceed through This Book
        • 1.4.1 The Exercises
      • 1.5 Using and Understanding the Code
        • 1.5.1 Pointer or Reference?
        • 1.5.2 Code Optimization
        • 1.5.3 The BookWeb site
        • 1.5.4 Bugs
      • Further Reading
      • Exercise
    • CHAPTER 02. GEOMETRY AND TRANSFORMATIONS
      • 2.1 Coordinate Systems
        • 2.1.1 Coordinate System Handedness
      • 2.2 Vectors
        • 2.2.1 Arithmetic
        • 2.2.2 Scaling
        • 2.2.3 Dot and Cross Product
        • 2.2.4 Normalization
        • 2.2.5 Coordinate System from a Vector
      • 2.3 Points
      • 2.4 Normals
      • 2.5 Rays
        • 2.5.1 Ray Differentials
      • 2.6 Three-Dimensional Bounding Boxes
      • 2.7 Transformations
        • 2.7.1 Homogeneous Coordinates
        • 2.7.2 Basic Operations
        • 2.7.3 Translations
        • 2.7.4 Scaling
        • 2.7.5 x, y, and z Axis Rotations
        • 2.7.6 Rotation around an Arbitrary Axis
        • 2.7.7 The Look-At Transformation
      • 2.8 Applying Transformations
        • 2.8.1 Points
        • 2.8.2 Vectors
        • 2.8.3 Normals
        • 2.8.4 Rays
        • 2.8.5 Bounding Boxes
        • 2.8.6 Composition of Transformations
        • 2.8.7 Transformations and Coordinate System Handedness
      • 2.9 Differential Geometry
      • Further Reading
      • Exercises
    • CHAPTER 03. SHAPES
      • 3.1 Basic Shape Interface
        • 3.1.1 Bounding
        • 3.1.2 Refinement
        • 3.1.3 Intersection
        • 3.1.4 Avoiding Incorrect Self-Intersections
        • 3.1.5 Shading Geometry
        • 3.1.6 Surface Area
        • 3.1.7 Sidedness
      • 3.2 Spheres
        • 3.2.1 Construction
        • 3.2.2 Bounding
        • 3.2.3 Intersection
        • 3.2.4 Partial Spheres
        • 3.2.5 Partial Derivatives of Normal Vectors
        • 3.2.6 DifferentialGeometry Initialization
        • 3.2.7 Surface Area
      • 3.3 Cylinders
        • 3.3.1 Construction
        • 3.3.2 Bounding
        • 3.3.3 Intersection
        • 3.3.4 Partial Cylinders
        • 3.3.5 Surface Area
      • 3.4 Disks
        • 3.4.1 Construction
        • 3.4.2 Bounding
        • 3.4.3 Intersection
        • 3.4.4 Surface Area
      • 3.5 Other Quadrics
        • 3.5.1 Cones
        • 3.5.2 Paraboloids
        • 3.5.3 Hyperboloids
      • 3.6 Triangles and Meshes
        • 3.6.1 Triangle
        • 3.6.2 Triangle Intersection
        • 3.6.3 Surface Area
        • 3.6.4 Shading Geometry
      • *3.7 Subdivision Surfaces
        • 3.7.1 Mesh Representation
        • 3.7.2 Bounds
        • 3.7.3 Subdivison
      • Further Reading
      • Exercises
    • CHAPTER 04. PRIMITIVES AND INTERSECTION ACCELERATION
      • 4.1 Primitive Interface and Geometric Primitives
        • 4.1.1 Geometric Primitives
        • 4.1.2 Object Instancing
      • 4.2 Aggregates
        • 4.2.1 Ray-Box Intersections
      • 4.3 Grid Accelerator
        • 4.3.1 Creation
        • 4.3.2 Traversal
      • 4.4 Kd-Tree Accelerator
        • 4.4.1 Tree Representation
        • 4.4.2 Tree Construction
        • 4.4.3 Traversal
      • Further Reading
      • Exercises
    • CHAPTER 05. COLOR AND RADIOMETRY
      • 5.1 Spectral Representation
        • 5.1.1 Spectrum Class
        • 5.1.2 XYZ Color
      • 5.2 Basic Radiometry
        • 5.2.1 Basic Quantities
        • 5.2.2 Incident and Exitant Radiance Functions
      • 5.3 Working with Radiometric Integrals
        • 5.3.1 Integrals over Projected Solid Angle
        • 5.3.2 Integrals over Spherical Coordinates
        • 5.3.3 Integrals over Area
      • 5.4 Surface Reflection and the BRDF
      • Further Reading
      • Exercises
    • CHAPTER 06. CAMERA MODELS
      • 6.1 Camera Model
        • 6.1.1 Camera Coordinate Spaces
      • 6.2 Projective Camera Models
        • 6.2.1 Orthographic Camera
        • 6.2.2 Perspective Camera
        • 6.2.3 Depth of Field
      • 6.3 Environment Camera
      • Further Reading
      • Exercises
    • CHAPTER 07. SAMPLING AND RECONSTRUCTION
      • 7.1 Sampling Theory
        • 7.1.1 The Frequency Domain and the Fourier Transform
        • 7.1.2 Ideal Sampling and Reconstruction
        • 7.1.3 Aliasing
        • 7.1.4 Antialiasing Techniques
        • 7.1.5 Application to Image Synthesis
        • 7.1.6 Sources of Aliasing in Rendering
        • 7.1.7 Understanding Pixels
      • 7.2 Image Sampling Interface
        • 7.2.1 Sample Representation and Allocation
      • 7.3 Stratified Sampling
      • *7.4 Low-Discrepancy Sampling
        • 7.4.1 Definition of Discrepancy
        • 7.4.2 Constructing Low-Discrepancy Sequences
        • 7.4.3 (0,2)-Sequences
        • 7.4.4 The Low-Discrepancy Sampler
      • *7.5 Best-Candidate Sampling Patterns
        • 7.5.1 Generating the Best-Candidate Pattern
        • 7.5.2 Using the Best-Candidate Pattern
      • 7.6 Image Reconstruction
        • 7.6.1 Filter Functions
      • Further Reading
      • Exercises
    • CHAPTER 08. FILM AND THE IMAGING PIPELINE
      • 8.1 Film Interface
      • 8.2 Image Film
        • 8.2.1 Image Output
      • 8.3 Image Pipeline
      • *8.4 Perceptual Issues and Tone Mapping
        • 8.4.1 Luminance and Photometry
        • 8.4.2 Bloom
        • 8.4.3 ToneMapping Interface
        • 8.4.4 Maximum toWhite
        • 8.4.5 Contrast-Based Scale Factor
        • 8.4.6 Varying Adaptation Luminance
        • 8.4.7 Spatially Varying Nonlinear Scale
      • 8.5 Final Imaging Pipeline Stages
      • Further Reading
      • Exercises
    • CHAPTER 09. REFLECTION MODELS
      • 9.1 Basic Interface
        • 9.1.1 Reflectance
        • 9.1.2 BRDF>BTDF Adapter
      • 9.2 Specular Reflection and Transmission
        • 9.2.1 Fresnel Reflectance
        • 9.2.2 Specular Reflection
        • 9.2.3 Specular Transmission
      • 9.3 Lambertian Reflection
      • 9.4 Microfacet Models
        • 9.4.1 Oren-Nayar Diffuse Reflection
        • 9.4.2 Torrance-Sparrow Model
        • 9.4.3 Blinn Microfacet Distribution
        • 9.4.4 Anisotropic Microfacet Model
      • 9.5 Lafortune Model
      • 9.6 Fresnel Incidence Effects
      • Further Reading
      • Exercises
    • CHAPTER 10. MATERIALS
      • 10.1 BSDFs
        • 10.1.1 BSDF Memory Management
      • 10.2 Material Interface and Implementations
        • 10.2.1 Matte
        • 10.2.2 Plastic
        • 10.2.3 Additional Materials
      • 10.3 Bump Mapping
      • Further Reading
      • Exercises
    • CHAPTER 11. TEXTURE
      • 11.1 Sampling and Antialiasing
        • 11.1.1 Finding the Texture Sampling Rate
        • 11.1.2 Filtering Texture Functions
        • *11.1.3 Ray Differentials for Specular Reflection and Transmission
      • 11.2 Texture Coordinate Generation
        • 11.2.1 2D (u, v) Mapping
        • 11.2.2 Spherical Mapping
        • 11.2.3 Cylindrical Mapping
        • 11.2.4 Planar Mapping
        • 11.2.5 3DMapping
      • 11.3 Texture Interface and Basic Textures
        • 11.3.1 Constant Texture
        • 11.3.2 Scale Texture
        • 11.3.3 Mix Textures
        • 11.3.4 Bilinear Interpolation
      • 11.4 Image Texture
        • 11.4.1 Texture Caching
        • 11.4.2 MIPMaps
        • 11.4.3 Isotropic Triangle Filter
        • 11.4.4 EllipticallyWeighted Average
      • 11.5 Solid and Procedural Texturing
        • 11.5.1 UV Texture
        • 11.5.2 Checkerboard
        • 11.5.3 Solid Checkerboard
      • 11.6 Noise
        • 11.6.1 Perlin Noise
        • 11.6.2 Random Polka Dots
        • 11.6.3 Noise Idioms and Spectral Synthesis
        • 11.6.4 Bumpy andWrinkled Textures
        • 11.6.5 WindyWaves
        • 11.6.6 Marble
      • Further Reading
      • Exercises
    • *CHAPTER 12. VOLUME SCATTERING
      • 12.1 Volume Scattering Processes
        • 12.1.1 Absorption
        • 12.1.2 Emission
        • 12.1.3 Out-Scattering and Extinction
        • 12.1.4 In-scattering
      • 12.2 Phase Functions
      • 12.3 Volume Interface and Homogeneous Media
        • 12.3.1 Homogeneous Volumes
      • 12.4 Varying-Density Volumes
        • 12.4.1 3D Grids
        • 12.4.2 Exponential Density
      • 12.5 Volume Aggregates
      • Further Reading
      • Exercises
    • CHAPTER 13. LIGHT SOURCES
      • 13.1 Light Interface
        • 13.1.1 Visibility Testing
      • 13.2 Point Lights
        • 13.2.1 Spotlights
        • 13.2.2 Texture Projection Lights
        • 13.2.3 Goniophotometric Diagram Lights
      • 13.3 Distant Lights
      • 13.4 Area Lights
      • 13.5 Infinite Area Lights
      • Further Reading
      • Exercises
    • CHAPTER 14. MONTE CARLO INTEGRATION I: BASIC CONCEPTS
      • 14.1 Background and Probability Review
        • 14.1.1 Continuous Random Variables
        • 14.1.2 Expected Values and Variance
      • 14.2 The Monte Carlo Estimator
      • 14.3 Sampling Random Variables
        • 14.3.1 The InversionMethod
        • 14.3.2 Example: Power Distribution
        • 14.3.3 Example: Exponential Distribution
        • 14.3.4 Example: Piecewise-Constant 1D Functions
        • 14.3.5 The RejectionMethod
        • 14.3.6 Example: Rejection Sampling a Unit Circle
      • 14.4 Transforming between Distributions
        • 14.4.1 Transformation in Multiple Dimensions
        • 14.4.2 Example: Polar Coordinates
        • 14.4.3 Example: Spherical Coordinates
      • 14.5 2D Sampling with Multidimensional Transformations
        • 14.5.1 Example: Uniformly Sampling a Hemisphere
        • 14.5.2 Example: Sampling a Unit Disk
        • 14.5.3 Example: Cosine-Weighted Hemisphere Sampling
        • 14.5.4 Example: Sampling a Triangle
      • Further Reading
      • Exercises
    • CHAPTER 15. MONTE CARLO INTEGRATION II: IMPROVING EFFICIENCY
      • 15.1 Russian Roulette and Splitting
        • 15.1.1 Splitting
      • 15.2 Careful Sample Placement
        • 15.2.1 Stratified Sampling
        • 15.2.2 Quasi Monte Carlo
        • 15.2.3 Warping Samples and Distortion
      • 15.3 Bias
      • 15.4 Importance Sampling
        • 15.4.1 Multiple Importance Sampling
      • 15.5 Sampling Reflection Functions
        • 15.5.1 Sampling the Blinn Microfacet Distribution
        • 15.5.2 Sampling the Anisotropic Microfacet Model
        • 15.5.3 Sampling FresnelBlend
        • 15.5.4 Specular Reflection and Transmission
        • 15.5.5 Application: Estimating Reflectance
        • 15.5.6 Sampling BSDFs
      • 15.6 Sampling Light Sources
        • 15.6.1 Basic Interface
        • 15.6.2 Lights with Singularities
        • 15.6.3 Area Lights
        • 15.6.4 ShapeSet Sampling
        • 15.6.5 Infinite Area Lights
      • *15.7 Volume Scattering
        • 15.7.1 Sampling Phase Functions
        • 15.7.2 Computing Optical Thickness
      • Further Reading
      • Exercises
    • CHAPTER 16. LIGHT TRANSPORT I: SURFACE REFLECTION
      • 16.1 Direct Lighting
        • 16.1.1 Estimating the Direct Lighting Integral
      • 16.2 The Light Transport Equation
        • 16.2.1 Basic Derivation
        • 16.2.2 Analytic Solutions to the LTE
        • 16.2.3 The Surface Form of the LTE
        • 16.2.4 Integral over Paths
        • 16.2.5 Delta Distributions in the Integrand
        • 16.2.6 Partitioning the Integrand
        • 16.2.7 TheMeasurement Equation and Importance
      • 16.3 Path Tracing
        • 16.3.1 Overview
        • 16.3.2 Path Sampling
        • 16.3.3 Incremental Path Construction
        • 16.3.4 Implementation
        • *16.3.5 Bidirectional Path Tracing
      • 16.4 Irradiance Caching
      • 16.5 Particle Tracing and Photon Mapping
        • *16.5.1 Theoretical Basis for Particle Tracing
        • 16.5.2 Photon Integrator
        • 16.5.3 Building the Photon Maps
        • 16.5.4 Using the Photon Map
        • 16.5.5 Photon Interpolation and Density Estimation
      • Further Reading
      • Exercises
    • *CHAPTER 17. LIGHT TRANSPORT II: VOLUME RENDERING
      • 17.1 The Equation of Transfer
      • 17.2 Volume Integrator Interface
      • 17.3 Emission-Only Integrator
      • 17.4 Single Scattering Integrator
      • Further Reading
      • Exercises
    • CHAPTER 18. SUMMARY AND CONCLUSION
      • 18.1 Design Retrospective
        • 18.1.1 Abstraction versus Efficiency
        • 18.1.2 Design Alternatives: Triangles Only
        • 18.1.3 Design Alternatives: Streaming Computation
      • 18.2 Major Projects
        • 18.2.1 Parallel Rendering
        • 18.2.2 Increased Scene Complexity
        • 18.2.3 Subsurface Scattering
        • 18.2.4 Precomputation for Interactive Rendering
      • 18.3 Conclusion
    • APPENDIXES
      • A UTILITIES
      • B SCENE DESCRIPTION INTERFACE
      • C INPUT FILE FORMAT
      • D INDEX OF FRAGMENTS
      • E INDEX OF CLASSES AND THEIR MEMBERS
      • F INDEX OF IDENTIFIERS
    • REFERENCES
    • INDEX
    • ABOUT THE CD-ROM
    • COLOPHON

Advertisement

advert image