· Home
· Description
· Contents
· Reviews
· Authors
· Links
· Errata
· Screenshots
· Downloads
· FAQ
· Buy It!




Welcome to the Advanced Lighting and Materials With Shaders book's Website!

This is the web site for the Advanced Lighting and Materials With Shaders book written by Emmanuel Viale and Kelly Dempski.


Contents

Foreword by François Sillion

Acknowledgments

Introduction

Chapter 1 The Physics of Light
 Introduction
 1.1 The Duality of Light
 1.2 Light as Particles
 1.3 Light as Waves
 1.3.1 Wavelength and Color
 1.3.2 Phase and Interference
 1.4 Light as Energy
 Conclusion and Further Reading
 References


Chapter 2 Modeling Real-World Lights
 Introduction
 2.1 Ideal Point Lights
   2.1.1 Point Lights as Energy Sources
   2.1.2 Geometric Attenuation
   2.1.3 Attenuation through Matter
   2.1.4 Point Lights and Lighting Equations
 2.2 Directional Lights
   2.2.1 The Relationship between Point and Directional Lights
   2.2.2 Directional Lights and Lighting Equations
 2.3 Area Lights
   2.3.1 The Relationship between Point and Area Lights
   2.3.2 Attenuation and Area Lights
 2.4 Spotlights
   2.4.1 Spotlights as Physical Lights
   2.4.2 Spotlights and Lighting Equations
   2.4.3 Other Spotlight Models
 2.5 Global Illumination
   2.5.1 Global Illumination vs. Local Illumination
   2.5.2 Ambient Light
 Conclusion


Chapter 3 Raytracing and Related Techniques
 Introduction
 3.1 The Raytracing Algorithm
   3.1.1 Backward Raytracing
   3.1.2 Camera Models
   3.1.3 The Different Types of Rays
   3.1.4 Recursion
   3.1.5 Ray and Object Intersections
   3.1.6 Texturing and Shading
   3.1.7 Problems and Limitations
   3.1.8 Solutions and Workarounds
   3.1.9 The Algorithm
 3.2 Extending the Raytracing Algorithm
   3.2.1 Stochastic Sampling
   3.2.2 Path Tracing and Related Techniques
   3.2.3 Photon Mapping
 3.3 Real-time Raytracing
 3.4 Raytracing Concepts for Other Techniques
 Conclusion
 References
 Other Resources


Chapter 4 Objects and Materials
 Introduction
 4.1 Plastics
 4.2 Wood
   4.2.1 Trees
   4.2.2 Lumber
   4.2.3 Finished Wood
 4.3 Leaves and Vegetation
 4.4 Metals
 4.5 Concrete and Stone
   4.5.1 Concrete
   4.5.2 Brick
   4.5.3 Natural Stone
 4.6 Skin
 4.7 Hair and Fur
 4.8 Air and the Atmosphere
 4.9 Transparent Materials
   4.9.1 Glass
   4.9.2 Water
 4.10 Paint
 4.11 Worn Materials
 Conclusion


Chapter 5 Lighting and Reflectance Models
 Introduction
 5.1 The Rendering Equation
 5.2 Basic Illumination Definitions
   5.2.1 Irradiance and Illuminance
   5.2.2 Radiance and Luminance
 5.3 Lambert's Law for Illumination
 5.4 Bidirectional Reflectance Distribution Functions (BRDFs)
   5.4.1 Parameters to a BRDF
   5.4.2 Isotropic vs. Anisotropic Materials
   5.4.3 BRDFs vs. Shading Models
 5.5 Diffuse Materials
   5.5.1 A Simple Diffuse Shading Model
   5.5.2 Diffuse Materials and Conservation of Energy
   5.5.3 Purely Diffuse Materials
 5.6 Specular Materials
   5.6.1 Purely Specular Materials
   5.6.2 Specular and the Phong Model
   5.6.3 The Blinn-Phong Model
   5.6.4 Combining Diffuse and Specular Reflection
 5.7 Diffuse Reflection Models
   5.7.1 Oren-Nayar Diffuse Reflection
   5.7.2 Minnaert Reflection
 5.8 Specular and Metallic Reflection Models
   5.8.1 Ward Reflection Model
   5.8.2 Schlick Reflection Model
   5.8.3 Cook-Torrance Model
     5.8.3.1 The Geometric Term
     5.8.3.2 The Fresnel Term
     5.8.3.3 The Roughness Term
     5.8.3.4 The Complete Cook-Torrance Model
 Conclusion
 References


Chapter 6 Implementing Lights in Shaders
 Introduction
 6.1 Basic Lighting Math
   6.1.1 Color Modulation
   6.1.2 Object Space Light Vectors
   6.1.3 Putting the Basics Together
 6.2 Per-Vertex Warn Lights
   6.2.1 The Warn Shader
   6.2.2 The Warn Application
   6.2.3 The Results
 6.3 Per-Pixel Warn Lights
   6.3.1 PS2.0 Lighting
   6.3.2 The Results
   6.3.3 Lookup Textures
 Conclusion
 References
 Other Resources


Chapter 7 Implementing BRDFs in Shaders
 Introduction
 7.1 Basic Setup and Diffuse Materials
   7.1.1 Basic Application Code
   7.1.2 Basic Diffuse Material
 7.2 Specular Materials
   7.2.1 The Phong Shaders
   7.2.2 The Blinn-Phong Shaders
 7.3 Oren-Nayar Materials
 7.4 Minnaert Materials
 7.5 Ward Materials
   7.5.1 Isotropic Ward Materials
   7.5.2 Anisotropic Ward Materials
 7.6 Schlick Materials
 7.7 Cook-Torrance Materials
 Conclusion
 References


Chapter 8 Spherical Harmonic Lighting
 Introduction
 8.1 Understanding the Need for Spherical Harmonics
   8.1.1 Hemispheres of Light
   8.1.2 Representations of Light
   8.1.3 Compressing Data Signals
   8.1.4 Compressing Hemispheres of Light
 8.2 Spherical Harmonics Theory
   8.2.1 Definition
   8.2.2 Projection and Reconstruction
   8.2.3 Main Properties
   8.2.4 The Spherical Harmonic Lighting Technique
     8.2.4.1 The Rendering Equation
     8.2.4.2 SH Diffuse Lighting
     8.2.4.3 SH Diffuse Shadowed Lighting
     8.2.4.4 SH Diffuse Shadowed Inter-Reflected Lighting
 8.3 Sample Implementations in OpenGL
   8.3.1 Introduction
   8.3.2 Associated Legendre Polynomials 2D Display
     8.3.2.1 Design
     8.3.2.2 Implementation
     8.3.2.3 Command-line Parameters
     8.3.2.4 Results
   8.3.3 Spherical Harmonics 3D Display
     8.3.3.1 Design
     8.3.3.2 Implementation
     8.3.3.3 Command-line Parameters
     8.3.3.4 Keyboard Mapping and Mouse Usage
     8.3.3.5 Results
   8.3.4 Function Approximation and Reconstruction Using Spherical Harmonics
     8.3.4.1 Design
     8.3.4.2 Implementation
     8.3.4.3 Command-line Parameters
     8.3.4.4 Keyboard Mapping and Mouse Usage
     8.3.4.5 Results
   8.3.5 HDR Images Loading and Display
     8.3.5.1 Design
     8.3.5.2 Implementation
     8.3.5.3 Command-line Parameters
     8.3.5.4 Results
   8.3.6 Spherical Harmonic Lighting Program
     8.3.6.1 Design
     8.3.6.2 Implementation
     8.3.6.3 Command-line Parameters
     8.3.6.4 Keyboard Mapping and Mouse Usage
     8.3.6.5 Results
 Conclusion and Further Reading
 References


Chapter 9 Spherical Harmonics in DirectX
 Introduction
 9.1 Per-Vertex SH Data Generation with D3DX
   9.1.1 The Main SH Simulator
   9.1.2 Parameters and Performance Implications
     9.1.2.1 Vertex Count
     9.1.2.2 Ray Count
     9.1.2.3 Bounce Count
     9.1.2.4 Order
   9.1.3 Compressed SH Coefficients
     9.1.3.1 Generating Compressed SH Coefficients
     9.1.3.2 Using Compressed SH Coefficients
 9.2 Rendering the Per-Vertex SH Solution
   9.2.1 Encoding Lights for SH Rendering
   9.2.2 The Basic SH Vertex Shader
 9.3 SH with Cube Maps
 9.4 DX SH with HDRI
 9.5 Multiple Meshes/Materials
 9.6 Subsurface Scattering
 9.7 Simple Specular Highlights
   9.7.1 The Basic Idea
   9.7.2 The Implementation
 Conclusion
 References


Chapter 10 Toward Real-Time Radiosity
 Introduction
 10.1 Radiosity Background and Theory
   10.1.1 What Radiosity Tries to Achieve
   10.1.2 Historical Background and Evolution
   10.1.3 Near Real-Time Radiosity
 10.2 Radiosity Theory and Methods
   10.2.1 Definitions
   10.2.2 The Radiosity Equation
   10.2.3 Form Factors
     10.2.3.1 Properties
     10.2.3.2 Determination
   10.2.4 The Classic Radiosity Method
   10.2.5 The Progressive Refinement Method
   10.2.6 Radiosity and Subdivision
 10.3 Sample Implementation in OpenGL
 Conclusion
 References
 Other Resources


Appendix A Building the Source Code
 Introduction
 A.1 DirectX/HLSL Programs
   A.1.1 Requirements
   A.1.2 Building the Programs
   A.1.3 Running and Testing the Programs and Shaders
 A.2 OpenGL/CG Programs
   A.2.1 Requirements
   A.2.2 Building the Programs
     A.2.2.1 Windows Platforms
     A.2.2.2 Linux Platforms
   A.2.3 Running and Testing the Programs and Shaders
 A.3 OpenGL/GLSL Programs
   A.3.1 Requirements
   A.3.2 Building the Programs
   A.3.3 Running and Testing the Programs and Shaders
 A.4 OpenGL Programs
   A.4.1 Platforms and Tools
   A.4.2 Installing the Libraries
     A.4.2.1 GLUT
     A.4.2.2 Lib3ds
   A.4.3 Building the Programs
     A.4.3.1 Unix Platforms
     A.4.3.2 Windows Platforms
 References
 Other Resources


Appendix B Sample Raytracer Implementation
 Introduction
 B.1 Design
   B.1.1 Introduction
   B.1.2 Data Types
   B.1.3 Main Functions and Program Flow
   B.1.4 Input File Format Specification
     B.1.4.1 Basic Data Types
     B.1.4.2 Primitives
 B.2 Implementation
   B.2.1 Scene Parser Overview
   B.2.2 Core Raytracing Function
   B.2.3 Ray/Primitive Intersection Functions
   B.2.4 File List and Auxiliary Functions
 B.3 The Raytracing Program
   B.3.1 Renderings
   B.3.2 Extending the Raytracer
 Conclusion
 References


Appendix C The Lighting and Shading Frameworks
 Introduction
 C.1 DirectX/HLSL Framework
   C.1.1 Requirements
   C.1.2 Design
     C.1.2.1 Introduction
     C.1.2.2 User Interface
     C.1.2.3 Data Structures and Instantiation
 C.2 OpenGL/Cg Framework
   C.2.1 Requirements
   C.2.2 Design
     C.2.2.1 Introduction
     C.2.2.2 User Interface
     C.2.2.3 Data Structures
     C.2.2.4 Functions and Files
     C.2.2.5 Program Flow
   C.2.3 Results
     C.2.3.1 OpenGL Shading
     C.2.3.2 Simple Shader
     C.2.3.3 Advanced Shader
 C.3 OpenGL/GLSL Framework
   C.3.1 Requirements
   C.3.2 Design
     C.3.2.1 Introduction
     C.3.2.2 User Interface
     C.3.2.3 Data Structures
     C.3.2.4 Functions and Files
     C.3.2.5 Program Flow
   C.3.3 Results
     C.3.3.1 OpenGL Shading
     C.3.3.2 Simple Shader
 References
 Other Resources


Index