<<

Global Illumination Compendium

September 29, 2003

Philip Dutré [email protected] , Department of Computer Science Katholieke Universiteit Leuven

http://www.cs.kuleuven.ac.be/~phil/GI/

This collection of formulas and equations is supposed to be useful for anyone who is active in the field of global illu- mination in computer graphics. I started this document as a helpful tool to my own research, since I was growing tired of having to look up equations and formulas in various books and papers. As a consequence, many concepts which are ‘trivial’ to me are not in this Global Illumination Compendium, unless someone specifically asked for them. There- fore, any further input and suggestions for more useful content are strongly appreciated.

If possible, adequate references are given to look up some of the equations in more detail, or to look up the deriva- tions. Also, an attempt has been made to mention the paper in which a particular idea or equation has been described first. However, over time, many ideas have become ‘common knowledge’ or have been modified to such extent that they no longer resemble the original formulation. In these cases, references are not given. As a rule of thumb, I include a reference if it really points to useful extra knowledge about the concept being described.

In a document like this, there is always a fair chance of errors. Please report any errors, such that future versions have the correct equations and formulas.

Thanks to the following people for providing me with suggestions and spotting errors: Neeharika Adabala, Martin Blais, Michael Chock, Chas Ehrlich, Piero Foscari, Neil Gatenby, Simon Green, Eric Haines, Paul Heckbert, Vladimir Koylazov, Vincent Ma, Ioannis (John) Pantazopoulos, Fabio Pellacini, Robert Porschka, Mahesh Ramasubramanian, Cyril Soler, Greg Ward, Steve Westin, Andrew Willmott.

This document can be distributed freely at a cost no higher than needed for reproduction. © Copyright, 1999, 2000, 2001, 2002, 2003; Philip Dutré This document produced at Program of Computer Graphics, Cornell University (1999-2001) and Department of Computer Science, Katholieke Universiteit Leuven (2001-2003)

Global Illumination Compendium 1 Table of Contents

I. General Mathematics 6 (1) Dirac-impulse (δ-function) ...... 6 (2) Kronecker δ...... 6 II. Probability 7 (3) Probability density function (pdf)...... 7 (4) Probability distribution function (a.k.a cumulative distribution function or cdf)...... 7 (5) Expected value of a random variable x with pdf p(x)...... 7 (6) Variance of a random variable x with pdf p(x)...... 7 (7) Generate random variable with given density , using inverse cdf ...... 7 (8) Generate random variable with given density , using rejection sampling ...... 8 III. Geometry 9 (9) Ray casting function...... 9 (10) Visibility function ...... 9 (11) Member function...... 10 (12) Intersection of ray with object ...... 10 A. Geometric Transformations 10 (13) Translation ...... 10 (14) Rotation...... 10 (15) Coordinate transforms...... 11 B. Triangles 11 (16) Surface area of a triangle ...... 11 (17) Barycentric coordinates (a.k.a. trilinear coordinates or homogeneous coordinates) ...... 12 (18) Generate random point in triangle with probability density ...... 12 C. Disks 12 (19) Generate random point on unit disk with probability density ...... 12 (19a) Polar map ...... 13 (19b) Concentric map...... 13 IV. Hemispherical Geometry 15 A. General 15 (20) Finite Solid angle ...... 15 (21) (Hemi-)Spherical coordinates: (ϕ, θ) parametrisation ...... 15 (22) Differential solid angle for (ϕ, θ) parametrisation...... 15 (23) (ϕ, c) parametrisation of hemisphere ...... 15 ξ ξ (24) ( 1, 2) parametrisation of hemisphere ...... 16 (25) Transformation between differential surface area and differential solid angle ...... 16 (26) Solid angle subtended by a surface...... 16 (27) Visible solid angle subtended by a surface ...... 16 (28) Solid angle subtended by a polygon ...... 16 (29) Tangent-sphere function ...... 17 (30) Useful integrals (cosine lobes) over the hemisphere (see also 33, 34, 35 and 36) ...... 17 (31) Useful integrals over spherical digons...... 17 (31a) (cosine lobe is non-zero on only)...... 17 (31b) (cosine lobe is non-zero on only) ...... 18 (32) Dirac-impulse on hemisphere (see also 1) ...... 18 B. Generating points and directions on the (hemi)sphere 18 (33) Generate random point on sphere with density ...... 19 (34) Generate random direction on unit hemisphere proportional to solid angle...... 19 (35) Generate random direction on unit hemisphere proportional to cosine-weighted solid angle...... 19 (36) Generate random direction on unit hemisphere proportional to cosine lobe around normal...... 20 (37) Generate uniform random direction on a spherical triangle ...... 21 (38) Generate random direction on spherical digon; density proportional to cosnα; α angle from off-normal axis ...... 21 V. Monte Carlo Integration, 22 (39) General Properties of Monte Carlo estimators...... 22

Table of Contents 2 (40) Basic MC integration ...... 22 (41) MC integration using importance sampling...... 22 (42) MC integration using stratified sampling...... 23 (43) Combined estimators...... 23 (44) Combined estimators: balance heuristic ...... 23 (45) Efficiency of a Monte Carlo estimator...... 24 (46) Quasi-random sequences...... 24 VI. Radiometry & Photometry 25 (47) Radiometric and Photometric units...... 25 (48) Flux: radiant energy flowing through a surface per unit time (Watt = Joule/sec) ...... 25 (49) Irradiance: incident flux per unit surface area (Watt/m2)...... 25 (50) Radiant Intensity: flux per solid angle (Watt/sr)...... 25 (51) Radiance: flux per solid angle per unit projected area (Watt/m2sr) ...... 26 (51a) Notations:...... 26 (51b) Wavelength Dependency:...... 26 (51c) Invariant along straight lines: ...... 26 (51d) Integration: specify integration domain if specific values are needed ...... 26 (52) Radiometric quantities → Photometric quantities ...... 27 VII. Optics 28 (53) Reflection at perfect mirror (incoming, outgoing direction, surface normal in same plane)...... 28 (54) Refraction at transition from vacuum to material (incoming, refracted direction, surface normal in same plane) ...... 28 (55) Refraction at transition from material to vacuum (incoming, refracted direction, surface normal in same plane) ...... 28 (56) Refraction at transition from material 1 to material 2 (incoming, refracted direction, surface normal in same plane) 28 (57) Total internal refraction (incoming, refracted direction, surface normal in same plane) ...... 29 (58) Fresnel Reflection - Conductors ...... 29 (60) Index of Refraction Data Values...... 30 VIII.Bidirectional Reflectance Distribution Functions (BRDFs) 31 A. General properties 31 (61) BRDF: ...... 31 (62) BRDF Reciprocity...... 31 (63) BRDF Energy conservation ...... 31 (64) Biconical Reflectance ...... 31 (65) Lambertian Diffuse Reflection...... 31 B. BRDF models 32 (66) Modified Phong-BRDF...... 32 (67) Modified Phong-BRDF - Blinn Variant...... 34 (68) Cook-Torrance-BRDF ...... 34 (69) Ward-BRDF ...... 35 (70) Lafortune-BRDF ...... 36 C. BRDF Measurements 36 (71) Cornell Measurements ...... 36 IX. and Global Illumination Formulations 37 A. Radiance Transport Formulations 37 (72) Rendering Equation (Radiance), integration over incoming hemisphere...... 37 (73) Rendering Equation (Radiance), integration over all surfaces in the scene...... 37 (74) Direct Illumination Equation (Radiance), integration over all light sources ...... 37 (74a) Integration over the area of all light sources: ...... 37 (74b) Integration over solid angles subtended by light sources:...... 38 (74c) Integration over visible solid angles subtended by light sources: ...... 38 (75) Continuous Radiosity Equation: diffuse reflection, diffuse light sources, integration over surfaces...... 38 (76) Participating medium ...... 38 (77) Participating medium, no scattering...... 39 B. Dual Transport Formulation 39 (78) Relationship between Flux, Radiance, Potential...... 39 X. Form Factors 41 A. General Expressions and Properties 41

Table of Contents 3 (79) Differential element to differential element Form Factor...... 41 (80) Differential element to element Form Factor...... 41 (81) Differential element to polygon Form Factor; full visibility ...... 41 (82) Element to element Form Factor...... 42 (83) Element to element Form Factor; full visibility; Stoke’s Theorem ...... 42 (84) Form Factor Algebra...... 42 (85) Nusselt’s Analog (projection on a disk)...... 42 (86) Projection on a sphere...... 43 B. Computing Form Factors using Monte Carlo Integration 43 (87) Uniform area sampling on both surfaces ...... 43 (88) Uniform area sampling + uniform solid angle sampling ...... 43 (89) Uniform area sampling + cosine-weighted solid angle sampling...... 44 (90) Uniform area sampling + cosine-weighted hemisphere sampling...... 44 (91) Global Lines...... 44 XI. Radiosity System & Algorithms 46 (92) System of radiosity equations, constant basis functions...... 46 (93) System of power equations, constant basis functions...... 46 (94) Discretizing the continuous radiosity equation...... 46 (94a) Point Collocation ...... 47 (94b) Galerkin ...... 47 (95) Basic Relaxation Algorithm...... 47 (96) Gauss-Seidel iteration ...... 48 XII. Radiosity Extensions 49 (97) Clustering - Equivalent extinction coefficient ...... 49 (98) Final Gathering ...... 49 XIII.Pixel-driven Algorithms 50 A. Direct illumination using shadow-rays 50 (99) Single light source, uniform sampling of light source area ...... 50 (100) Single light source, uniform sampling of solid angle subtended by light source ...... 50 (101) Multiple light sources, uniform random source selection, uniform sampling of light source area ...... 51 (102) Multiple light sources, uniform random source selection, uniform sampling of light source solid angle...... 51 (103) Multiple light sources, non-uniform random source selection, non-uniform sampling of light source area...... 52 (104) Various strategies for computing direct illumination due to multiple light sources...... 52 (105) Multiple light sources, uniform sampling of hemisphere ...... 53 (106) Multiple light sources, non-uniform sampling of hemisphere...... 54 (106a) Multiple light sources, uniform sampling of hemisphere: see 105...... 54 (106b) Multiple light sources, cosine-sampling of hemisphere ...... 54 (106c) Multiple light sources, BRDF-sampling of hemisphere ...... 54 (106d) Multiple light sources, BRDF.cosine-sampling of hemisphere...... 55 B. 55 (107) Stochastic ray tracing - general idea ...... 55 (108) Next event estimation (split in direct and indirect term) ...... 56 (108a) Uniform sampling of hemisphere ...... 56 (108b) Cosine-sampling of hemisphere ...... 56 (108c) BRDF-sampling of hemisphere ...... 56 (108d) Multiple light sources, BRDF.cosine-sampling of hemisphere...... 57 (109) End of recursion - Russian Roulette ...... 57 C. Light Tracing 58 D. Bidirectional Tracing 58 XIV.Multipass Algorithms 60 A. 60 XV. Test Scenes for Global Illumination 61 (110) Mother of all test scenes...... 61 (111) Analytic Solution - General Rendering Equation ...... 61 (112) Analytic Solution - Radiosity System...... 61 (113) Testing global illumination algorithms...... 61

Table of Contents 4 (114) Testing ray tracing performance ...... 61 (115) Testing animated ray tracing...... 61 XVI.Color & Display 62 (116) Spectrum to CIE XYZ...... 62 (117) xyY to XYZ ...... 62 (118) CIE XYZ to Spectrum ...... 62 (119) CIE XYZ to/from NTSC standard RGB based on standard CIE phospors and D6500 white point...... 63 (120) CIE XYZ to/from color space...... 63 (121) CIE XYZ to/from color space...... 64

Table of Contents 5 I. General Mathematics

(1) Dirac-impulse (δ-function)

δ()x = 0 if x ≠ 0

∫ δ()ax– fx()dx = fa() if a ∈ D D

δ()δ() Notation: ax– = a x

(2) Kronecker δ

δ ij ==1 if ij δ ≠ ij = 0 if i j

General Mathematics 6 II. Probability

(3) Probability density function (pdf)

Constraints: ∫ px()dx = 1 ∀x: px()≥ 0 D

b Probability that a random variable y belongs to interval []ab, : Prob[] a≤≤ y b = ∫px()dx a

(4) Probability distribution function (a.k.a cumulative distribution function or cdf)

Px() is the probability that a random variable y , generated using py() , has a value lower than or equal than x .

x Px()= ∫ px()dx –∞

0 ==P()–∞ ≤ Px()≤ P()∞ 1

(5) Expected value of a random variable x with pdf p(x)

∞ ∞ Ex[]= ∫ xp() x dx Efx[]() = ∫ fx()px()dx –∞ –∞

(6) Variance of a random variable x with pdf p(x)

2 2 σ []fx() = Efx[]()()– Efx[]() 2 2 2 σ []fx() = Efx[]() – Efx[]()

(7) Generate random variable with given density px() , using inverse cdf

–1 Generate uniform random number r, 0 ≤≤r 1 then compute xP= ()r .

For multidimensional sampling: use marginal or conditional probability distributions, and apply the inverse for each variable seperately. px() Px() Px() 1 1

r2 integration r1

x x –1()–1() x P r1 P r2

Probability 7 (8) Generate random variable with given density px() , using rejection sampling

Find M such that ∀x: px()≤ M ; generate uniform random tuplet ()x', y' ∈ D × []0, M . If px()' ≥ y' accept sample x' ; otherwise reject and try again. px() reject

M

x accept

More general: construct a pdf qx() such that ∀x: px()≤ Mq() x . Generate a random sample x' according to qx() . Generate a uniform random number r, 0 ≤≤r 1 . If rpx≤ ()' ⁄ Mq() x' accept sample x' , otherwise reject and try again.

Probability 8 III. Geometry

Notations: nx

dAx Differential surface area at surface point x Θ surface dAx nx Surface normal at point x x ΘΘDirection vector: (usually assumed to be normalized)

xy Direction vector from x to y : xy= y– x A Union of all surfaces in the scene, also used for total surface area of all surfaces in the scene. Collection of all surface patches in the scene Ap

(9) Ray casting function

Closest surface point visible from (any) point x in direction Θ :

(), Θ ⋅ Θ rx = xt+ inf surface {}> ()⋅ Θ ∈ tinf = inf t 0: xt+ A rx(), Θ

Θ x if yrx= (), Θ and xA∈ surface ⇒ xry= (), –Θ or x = rrx()()Θ, Θ , – yrx= (), Θ

surface -Θ Θ

xry= (), –Θ

Θ Shorthand notation for rx(), Θ : x

(10) Visibility function

1 if x and y are mutually visible ∀xy, ∈ A: Vxy(), =  0 if x and y are not mutually visible

The visibility function is often used in various formulations of the rendering equations using area integrals (e.g. 73), or in the equations describing form factors (e.g. 79).

Geometry 9 (11) Member function

1 if x belongs to surface patch j ∀xAjA∈ , ∈ : Mxj(), =  p 0 if x does not belong to surface patch j

The member function is a handy shorthand notation when one wants to express whether a surface points belongs to a patch. E.g. computing form factors using Monte Carlo integration (87).

(12) Intersection of ray with object

A good overview of various ray-object intersection techniques can be found at: http://www.realtimerendering.com/int/

A. GEOMETRIC TRANSFORMATIONS

Tranformation in 3D graphics are usually represented by 4x4 matrices. The 4th homogeneous coordinate is needed for translations and perspective transforms. A basic overview can be found in any introductory book on computer graph- ics.

A right-handed coordinate system is assumed.

(13) Translation

Translate a point x by translation vector d : x' = Td()⋅ x

100dx 100–dx 010d –1 010–d T()d = y T ()d = y 001dz 001–dz 0001 0001

(14) Rotation

θ ()θ ⋅ Rotate point x around the X -axis by angle : x' = Rx x

1000 1000 ()θ 0 cosθ –sinθ 0 –1()θ 0 cosθ sinθ 0 Rx = Rx = 0 sinθ cosθ 0 0 –sinθ cosθ 0 0001 0001

θ ()θ ⋅ Rotate point x around the Y -axis by angle : x' = Ry x

cosθ 0 sinθ 0 cosθ 0 –sinθ 0 ()θ 0100 –1()θ 0100 Ry = Ry = –sinθ 0 cosθ 0 sinθ 0 cosθ 0 0001 0001

θ ()θ ⋅ Rotate point x around the Z -axis by angle : x' = Rz x

cosθ –sinθ 00 cosθ sinθ 0 0 ()θ sinθ cosθ 0 0 –1()θ –sinθ cosθ 0 0 Rz = Rz = 0010 0010 0001 0001

Geometry 10 Rotation such that basis vectors (x,y,z) become orthonormal vectors (u,v,w):

ux vx wx 0 ux uy uz 0 u v w 0 –1 v v v 0 R()uvw = y y y R ()uvw = x y z uz vz wz 0 wx wy wz 0 0001 0001

(15) Coordinate transforms

Summary: To transform the coordinates of a point, expressed in coordinate system 1, to coordinates expressed in coordinate system 2; apply the transformation that transforms the axes of coordinate system 2 into the axes coor- dinate system 1.

o– xyz : Canonical coordinate system puvw– : Coordinate system with origin in p , and orthonormal axes uvw (expressed in OXYZ).

qoxy– z : point q expressed in o– xyz

qpuv– w : point q expressed in puvw–

() qpuvw– = Mp– uvwqoxy– z

ux uy uz 0 100–px –1 –1 v v v 0 010–p M()puvw– ==R ()uvw T ()p x y z y wx wy wz 0 001–pz 0001 0001

–1() qoxyz– = M puvw– qpuv– w

100px ux vx wx 0 ux vx wx px –1 010p u v w 0 u v w p M ()puvw– ==Tp()Ruvw() y y y y =y y y y 001pz uz vz wz 0 uz vz wz pz 0001 0001 0001

B. TRIANGLES

(16) Surface area of a triangle

If abc,, are the vertices of a triangle:

ab× ++bc× ca× area = ------2

Geometry 11 (17) Barycentric coordinates (a.k.a. trilinear coordinates or homogeneous coordinates)

p()ααβγ,, = a ++βb γc ()αβγ++= 1 c

0 <<α 1 lb' p is inside triangle if and only if 0 <<β 1 Aa la' lb 0 <<γ 1 A b la p A l l ' a α a a a l ==------c A A lala' ++lblb' lclc' c lc' b A l l ' Also: β ==-----b------b b ---- A lala' ++lblb' lclc' A l l ' γ ==-----c------c c ---- A lala' ++lblb' lclc'

(A is total area of triangle)

(18) Generate random point in triangle with probability density px()= 1 ⁄ A

[], r1 and r2 are random numbers, uniformly generated over the interval 01

α = 1 – r1 β () = 1 – r2 r1 γ = r2 r1

with ()αβγ,, the barycentric coordinates (see 17) of the random point.

(method as described in R40)

C. DISKS

(19) Generate random point on unit disk with probability density px()= 1 ⁄ π ϕ In general, a disk is parametrized by: r ϕ ∈ []02, π r ∈ []01, ϕ = 0

(), ∈ϕ[], × [], (), Random numbers r1 r2 01 01 need to be mapped to r coor- dinates.

Geometry 12 (19a) Polar map

This map preserves fractional area, but is not bicontinuous and has severe distortions. r2 ϕ

r ϕ = 0

r1

[], r1 and r2 are random numbers, both uniformly generated over the interval 01

rr= 1 ϕ π = 2 r2

(19b) Concentric map

This map was first proposed by Shirley in the context of ray tracing and illumination computations (R31)1. This map preserves fractional area, is bicontinuous and has low distortion. See reference in footnote for an implemen- tation. r2 ϕ

r ϕ = 0 r1

r r2 ϕ ϕ = 0 r1

[], r1 and r2 are random numbers, both uniformly generated over the interval –1 1 (This can easily be trans- formed from random numbers in the interval []01, ).

> > 1st triangular region (r1 –r2 and r1 r2 ):

rr= 1 π r ϕ = --- ⋅ ----2 4 r1

1. Pictures in this section of the Compendium are based on the pictures in this book.

Geometry 13 < > 2nd triangular region (r1 r2 and r1 –r2 ):

rr= 2 π r ϕ ⋅ 1 = --- 2 – ---- 4 r2

< < 3rd triangular region (r1 –r2 and r1 r2 ):

rr= – 1 π r ϕ ⋅ 2 = --- 4 + ---- 4 r1

> < 4th triangular region (r1 r2 and r1 –r2 ):

rr= – 2 π r ϕ ⋅ 1 = --- 6 – ---- 4 r2

Geometry 14 IV. Hemispherical Geometry

A. GENERAL

(20) Finite Solid angle nx A Ω = ---- 2 r A Solid angles are dimensionless and expressed in steradians. The solid angle subtended by all space equals 4π . Ω

(21) (Hemi-)Spherical coordinates: (ϕ, θ) parametrisation x r

direction Θϕθ= (), Z ϕ ∈ [], π Θ 02 θ direction θ ∈ []0, π ⁄ 2 solid angle dωΘ

xr= cosϕθsin yr= sinϕθsin zr= cosθ x Y

2 2 2 rx= ++y z ϕ tanϕ = yx⁄ X 2 2 x + y tanθ = ------z

2 dxdydz= r sinθdrdθdϕ

Spherical coordinates: above formulas remain the same, except θ ∈ []0, π

(22) Differential solid angle for (ϕ, θ) parametrisation

dωΘ = sinθdθdϕ

2π π ⁄ 2

Integral over the hemisphere: ∫ f()Θ dωΘ = ∫ ∫ f()θϕθ, sin dθdϕ Ω 0 0

(23) (ϕ, c) parametrisation of hemisphere

2π π ⁄ 2 2π 1 ϕϕ= Apply coordinate transform: : ∫ f()Θ dωΘ ==∫ ∫ f()θϕθ, sin dθdϕ ∫ ∫f()ϕ, c dcdϕ c = 1 – cosθ Ω 0 0 0 0

Equally sized areas in ()ϕ, c space translate to equally sized solid angles.

Hemispherical Geometry 15 ξ ξ (24) ( 1, 2) parametrisation of hemisphere

ξ = sin2 θ 2π π ⁄ 2 1 1 1 f()ξ , ξ ()Θ ω ()θθϕ, θ ϕ 1 2 ξ ξ Apply coordinate transform: ϕ : ∫ f d Θ ==∫ ∫ f sin d d ∫∫------d 1d 2 ξ = ------ξ2 2 2π Ω 0 0 0 0 1 – 1

()ξ , ξ Equally sized areas in 1 2 space translate to equally sized, cosine-weighted solid angles.

(25) Transformation between differential surface n y y area and differential solid angle θ y θ dA cos ydAy y dωΘ = ------2 ω rxy rxy solid angle d Θ

Θ x direction (26) Solid angle subtended by a surface

cosθ Ω ()j = ∫ ------y-dA x 2 y y dA rxy ny y Aj θ y Ω () rxy j x j

x (27) Visible solid angle subtended by a surface

Parts of the surface j might not be visible to x . Therefore, visibility between x and all surface points y on j needs to be included explicitly.

θ vis cos Ω ()j = ------yVxy(), dA x ∫ 2 y rxy Aj

(28) Solid angle subtended by a polygon

Girard’s formula:

Ω α ()π x = ∑ i – n – 2 i

with: α i n : number of vertices of the polygon Ω α i : dihedral angles (angles between the planes formed by the edges of the polygon and the projection point x ) x This formula is valid for convex and concave polygons. An implementation is given in Graphics Gems (R27, R6).

Hemispherical Geometry 16 (29) Tangent-sphere function

In the context of global illumination, one is often interested in the cosine of the angle between a direction Θ on

the hemisphere and the normal vector nx at a surface point x , but only if the direction is located at the same side Θ of the surface of nx . If is ‘below’ the surface, the value is 0 . Some authors (R34) introduce the ‘tangent- sphere’ function for this purpose:

n ⋅ Θ if n ⋅ Θ ≥ 0 ()Θ x x Tn =  x 0 otherwise

()Θ, In this document, the notation cos nx is often used.

(30) Useful integrals (cosine lobes) over the hemisphere (see also 33, 34, 35 and 36)

2π π ⁄ 2

∫ dωΘ ==∫ dϕθ∫ sin dθ 2π Ω 0 0 2π π ⁄ 2 ()Θ, ω ϕθθθ π ∫ cos nx d Θ ==∫ d ∫ cos sin d Ω 0 0 2π π ⁄ 2 2π ∫ cosn ()Θ, n dω ==∫ dϕθ∫ cosn sinθdθ ------x Θ n + 1 Ω 0 0

Integrals of cosine lobes are useful because many BRDF models (e.g. Lafortune model, see 70) make use of these lobes, although usually not centered around the normal.

θ ∈ [], θ Limiting the integration area to the spherical cap bounded by 0 max nx

θ 2π m 2π ∫ cosn()Θ, n dω ==∫ dϕθ∫ cosn sinθdθ ------()1 – cosn + 1 θ x Θ n + 1 max Ω θ m 0 0 max

(31) Useful integrals over spherical digons nx n()Θ, ()Θ, ω Ω m (31a)∫ cos m cos nx d Θ (cosine lobe is non-zero on 2 only) Ω 2 Ω A method for computing this integral was presented by J. Arvo, as part of a Ω 2 general method for computing double-axis moments on the hemisphere (R2). 1 Pseudocode looks as follows:

F(nx, m, n) S = 0; d = m.nx; c = sqrt(1-d*d); T = if even(n) then π/2 else c; A = if even(n) then π/2 else π-acos(d); i = if even(n) then 0 else 1; while i <= n-2 do

Hemispherical Geometry 17 S = S+T; T = T*c*c*(i+1)/(i+2); i = i+2; endwhile return 2*(T + d*A + d*d*S)/(n+2) end

n()Θ, ω Ω (31b)∫ cos m d Θ (cosine lobe is non-zero on 2 only) Ω 2

An expression can be derived from the same paper (although this form is not explicitly mentioned):

2()θπθ– + cos []sinn – 1 θ F +++sinn – 3 θ F …θsin F n even: ∫ cosn()Θ, m dω = ------m m m n – 1 m n –------3 m 1--- Θ n + 1 Ω 2 πθ+ cos []sinn – 1 θ F +++sinn – 3θ F … F n odd: ∫ cosn ()Θ, m dω = ------m m n – 1 m n – 3 ------0 Θ n + 1 Ω 2

θ ()⋅ m = acos mnx where: n – 1 F = ------F F = π F = 2 n n n – 2 0 1

(32) Dirac-impulse on hemisphere (see also 1)

δΘ()δθΘ ()δϕθ ()ϕ 1 – = cos 1 – cos 1 – Θ ()θ , ϕ 1 = 1 1 Θθϕ= (),

such that:

2π π ⁄ 2 δΘ()Θ ()Θ ω ϕδ() ϕ ϕ ()δθθ ()θ ()ϕθ, ∫ 1 – f d Θ = ∫ d 1 – ∫ d cos cos 1 – cos f Ω 0 0 2π ϕδ() ϕ ϕ ()ϕθ, ()ϕ , θ ()Θ ===∫ d 1 – f 1 f 1 1 f 1 0

B. GENERATING POINTS AND DIRECTIONS ON THE (HEMI)SPHERE

Generating random directions over the hemisphere is a fundamental operations in most Monte Carlo-based rendering algorithms. The rendering equation (see section IX) is usually expressed as an integral over the hemisphere, so sam- pling the hemispherical domain requires generating directions over the hemisphere.

[], r1 and r2 are random numbers, uniformly generated over the interval 01 . Some of the formulas can be simplified by substituting a uniform random variable r with 1 – r or vice versa. Since both have the distribution, the resulting distribution of directions is not affected.

Hemispherical Geometry 18 1 (33) Generate random point on sphere ()c ,,,c c R with density p()Θ = ------x y z 2 4πR

xc= + 2Rcos()2πr r ()1 – r ϕ π x 1 2 2 = 2 r1 ()π () θ ()yc= y + 2Rsin 2 r1 r2 1 – r2 = acos 12– r2 () zc= z + R 12– r2

(34) Generate random direction on unit hemisphere proportional to solid angle

1 PDF: p()Θ = ------2π

2 x = cos()2πr 1 – r ϕ π 1 2 = 2 r1 2 θ () y = sin()2πr 1 – r = acos r2 1 2 zr= 2

θ ∈ [], θ ()Θ 1 nx With 0 max and p = ------π()θ --- : 2 1 – cos max

θ max

2 x = cos()2πr 11– ()– r ()1 – cosθ ϕ π 1 2 max = 2 r1 2 θ ()()θ y = sin()2πr 1– () 1 – r ()1 – cosθ = acos 1 – r2 1 – cos max 1 2 max ()θ z = 1 – r2 1 – cos max

Generating points uniformly on the disk (see 19), and then applying the following transformation, also produces a uniform distribution of points on the hemisphere:

()ϕ , Point on disk: d rd

2 x = cosϕ ⋅ r 2 – r ϕϕ d d d = d 2 Resulting point on hemisphere: or y = sinϕ ⋅ r 2 – r θ ()2 d d d = acos 1 – rd 2 z = 1 – rd

(35) Generate random direction on unit hemisphere proportional to cosine-weighted solid angle

θ ()Θ cos PDF: p = ------π----

Hemispherical Geometry 19 x = cos()2πr 1 – r ϕ π 1 2 = 2 r1 y = sin()2πr 1 – r θ () 1 2 = acos r2 zr= 2

cosθ With θ ∈ []0, θ and p()Θ = ------max πθ2 sin max

x = cos()θ2πr sin r ϕ π 1 max 2 = 2 r1 ()π θ y = sin 2 r1 sin max r2 θ ()2 θ = acos 1 – r2 sin max 2 θ z = 1 – r2 sin max

Generating points uniformly on the disk (see 19), and then projecting them on the hemisphere, also gives a cosine-weighted distribution of points on the hemisphere.

()ϕ , A Point on disk: d rd

ϕ xr= d cos d ϕϕ = d ϕ Resulting point on hemisphere: or y = rd sin d θ = asin()r d 2 z = 1 – rd

(36) Generate random direction on unit hemisphere proportional to cosine lobe around normal

n + 1 PDF: p()Θ = ------cosn θ 2π

2 ------()π n + 1 ϕ π x = cos 2 r1 1 – r2 = 2 r1 1 2 ------n + 1 ()π n + 1 θ = acosr y = sin2 r1 1 – r2 2 1 ------n + 1 zr= 2

()θn + 1 cosn With θ ∈ []0, θ and p()Θ = ------max π()n + 1θ 2 1 – cos max

2 ------()π ()()n + 1 θ n + 1 ϕ π x = cos 2 r1 11– – r2 1 – cos max = 2 r1 1 2 ------n + 1 ()π ()()n + 1 θ n + 1 θ = acos()1 – r ()1 – cosn + 1θ y = sin2 r1 1– 1 – r2 1 – cos max 2 max 1 ------()()n + 1 θ n + 1 z = 1 – r2 1 – cos max

n = 0 produces (34); n = 1 produces (35).

Hemispherical Geometry 20 (37) Generate uniform random direction on a spherical triangle

See the paper published by J. Arvo in SIGGRAPH 95 for a complete formula and algorithm (R1).

(38) Generate random direction on spherical digon; density proportional to cosnα; α angle from off-normal axis

1. Generate direction on unit hemisphere proportional to cosn θ using (36). 2. Transform direction by transforming normal to off-normal axis. 3. If transformed direction has angle greater then π/2 with normal, reject direction and try again. 4. Compute correct pdf-value by normalizing cosn α using (31b).

Hemispherical Geometry 21 V. Monte Carlo Integration1,2

(39) General Properties of Monte Carlo estimators

Let FN() be a stochastic estimator for quantity Q , using N samples.

Error: FN()– Q

Bias: β()FN()= EFN[]()– Q . If bias is zero for all N , then estimator is unbiased.

 Estimator is consistent if: Problim F() N = Q = 1 . A sufficient condition for an estimator to be unbiased N → ∞

2 is: lim β()FN()==limσ []FN() 0 N → ∞ N → ∞

(40) Basic MC integration

I = ∫ fx()dx D []αα …β × []……β ×α× []…β ()α ,ℜβ ∈ D = 1 1 2 2 d d i i

d –1 (),,,, ()() β α Generate a sequence of samples x1 x2 x3 ... xN using a uniform pdf p x = ∏ i – i  i = 1

N d 1  〈〉I = ---- ∑ fx()⋅ ∏ ()β – α EI[]〈〉 = ∫ fx()dx (unbiased estimator) N i i i  i = 1 i = 1 D

2 1 2 1 2 2 σ []〈〉I ==------∫ ()fx()– I dx ------∫ fx()dx – I d d  ⋅ ()β α D ⋅ ()β α D N ∏ i – i N ∏ i – i i = 1 i = 1

(41) MC integration using importance sampling

(),,,, () Generate a sequence of samples x1 x2 x3 ... xN using pdf px

N fx() 〈〉 1 i []〈〉 () I = ---- ∑ ------()- EI = ∫ fxdx N pxi i = 1 D

2 2 1 fx() 2 1 fx() 2 σ []〈〉I ==---- ∫ ------– I px()dx ----∫ ------dx – I N px() Npx() D D

1. For an introduction on Monte Carlo integration: (R18, R37, R21, R14) 2. An excellent text covering Monte Carlo methods for global Illumination is the Ph.D. thesis of Eric Veach (R44).

Monte Carlo Integration, 22 Optimal pdf for importance sampling, giving minimum variance:

fx() px()= ------∫ fx()dx D

For the estimator to be unbiased, px() must be non-zero wherever fx() is non-zero.

(42) MC integration using stratified sampling

α α α 1 1 2 m – 1 1 ∫fx()dx = ∫ fx()dx ++++∫ fx()dx ... ∫ fx()dx ∫ fx()dx α α α 0 0 1 m – 2 m – 1

If each stratum j receives nj samples, distributed uniformly within each stratum:

2 m αj m αj ()α α 2 j – j 2 1  σ = ∑ ------– 1 ∫ fx()dx – ∑ ---- ∫ fx()dx nj nj α α j = 1 j – 1 j = 1 j – 1

If all strata have equal size, and each stratum contains one sample:

α 2 1 N j 2 1 2  σ = ----∫fx()dx – ∑ ∫ fx()dx N  α 0 j = 1 j – 1

(43) Combined estimators

n Nj fx() 〈〉 1 ()ij, I = ∑ ----- ∑ wj xij, ------()--- Nj pj xij, j = 1 i = 1

th () with xij, the i sample, from a total of Nj , taken from pdf pj x . n () 〈〉 If ∑ wj x = 1 for all x, then I is unbiased. j = 1 (see R43)

(44) Combined estimators: balance heuristic

c p ()x () j j Balance Heuristic: wj x = ------with Nj = cjN , with N total number of samples. c p ()x ∑j j j

〈〉 〈〉 () If I bh is obtained by the balance heuristic, and I by any other set of wj x , then:

 σ2[]σ〈〉 ≤ 2[]〈〉 1 1 () I bh I + ------– ------∫ fxdx minjNj N ∑j j D

Monte Carlo Integration, 23 One sample model (N = 1 ): if pj is cosen with probability cj , then the balance heuristic gives the lowest variance.

(45) Efficiency of a Monte Carlo estimator

1 2 ε = ------where T is the time to take 1 sample, and σ is the variance for 1 sample. 2 Tσ

(see R21, pp. 91-92)

(46) Quasi-random sequences

∞ ∞ j ⇒ Φ () – j – 1 Radical inverse function: ia= ∑ jb b i = ∑ ajb j = 0 j = 0

a. Van der Corput sequence

Φ () xi = b i

b. Halton sequence (s dimensions)

x = ()Φ ()Φi , ()Φi , ()Φi , ()…Φi , , ()i with b ,,,,b b … b relative primes. i b1 b2 b3 b4 bs 1 2 3 s

c. Hammersley sequence (s dimensions, length N )

i x = ----, Φ ()Φi , ()Φi , ()Φi , ()…Φi , , ()i with b ,,,,b b … b relative primes. i N b1 b2 b3 b4 bs – 1 1 2 3 s – 1

Monte Carlo Integration, 24 VI. Radiometry & Photometry

• A general overview of units and measurements can be found at the “How many?” website (http://www.unc.edu/~rowlett/units/index.html). • Another overview of light measurements and units is compiled in the Light Measurement Hanbook: http://www.intl-light.com/handbook/registered.html

(47) Radiometric and Photometric units

Radiometry Photometry Joule Radiant Energy Q → Luminous Energy Talbot Watt Radiant Power → Luminous Power Lumen (lm) Watt/m2 Radiosity (Radiant exitance) → Luminosity Lux (lm/m2) Irradiance Illuminance Watt/sr Radiant Intensity → Luminous Intensity Candelaa (cd or lm/sr) Watt/m2sr Radiance → Luminance Nit (cd/m2 or lm/m2sr)

a. From the “How Many” website: Candela: the fundamental SI unit for measuring the intensity of light. Candela is the Latin word for "candle." The unit has a long and complicated history. Originally, it represented the intensity of an actual candle, assumed to be burning whale tallow at a specified rate in grains per hour. Later this definition was replaced with a definition in terms of the light produced by the filament of an incandescent light bulb. Still later a standard was adopted which defined the candela as the intensity of 1/600 000 square meter of a "black body" (a per- fect radiator of energy) at the temperature of freezing platinum (2042 K) and a pressure of 1 atmosphere. This defini- tion has also been discarded, and the candela is now defined to be the luminous intensity of a light source producing single-frequency light at a frequency of 540 terahertz (THz) with a power of 1/683 watt per steradian, or 18.3988 milliwatts over a complete sphere centered at the light source. The frequency of 540 THz corresponds to a wave length of approximately 555.17 nanometers (nm). Light of this frequency has a yellow-green color and roughly the same visual brightness as ordinary daylight. In addition, normal human eyes are more sensitive to this wavelength than to any other. In order to produce 1 candela of single-frequency light of wavelength l, a lamp would have to radi- ate 1/(683V(l)) watts per steradian, where V(l) is the relative sensitivity of the eye at wavelength l. Values of V(l) are defined by the International Commission on Illumination (CIE).

(48) Flux: radiant energy flowing through a surface per unit time (Watt = Joule/sec)

dQ Φ ==P ------dt

(49) Irradiance: incident flux per unit surface area (Watt/m2)

dΦ E = ------dA

Radiant exitance (a.k.a Radiosity): departing flux per unit surface area (Watt/m2)

dΦ M ==B ------dA

(50) Radiant Intensity: flux per solid angle (Watt/sr)

dΦ I = ------dω

Radiometry & Photometry 25 (51) Radiance: flux per solid angle per unit projected area (Watt/m2sr)

2 2 dE d Φ d Φ L ==------ω------⊥- =------ω ---θ- d dωdA d dAcos

(51a) Notations:

Lx()→ Θ : radiance leaving point x in direction Θ Lx()← Θ : radiance arriving at point x from direction Θ Lx()→ y : radiance leaving point x, arriving at point y Lx()← y : radiance arriving at point x, coming from point y

(51b) Wavelength Dependency:

780nm Lx()→ Θ = ∫ Lx()λ→ Θλ, d 380nm

Wavelength dependency is usually assumed in radiometric eqautions.

(51c) Invariant along straight lines:

Radiance remains invariant along a straight path in vacuum:

Lx()→ y = Ly()← x if x and y are mutually visible Lx()→ Θ = Lrx()(), Θ ← – Θ

2Φ 2Φ Proof: consider power exchange d between 2 differential surfaces dAx and dAy . Power d arriving at

dAy from dAx must equal power leaving dAx in the direction of dAy (full proof see R13 p.24).

(51d) Integration: specify integration domain if specific values are needed

Φ ()θ→ Θ ω () ()Θ ω ===∫∫Lx cos d ΘdAx ∫ExdAx ∫I d Θ

Ex()= ∫Lx()θ← Θ cos dωΘ

Bx()= ∫Lx()θ→ Θ cos dωΘ

()Θ ()θ→ Θ I = ∫Lx cos dAx

For a diffuse emitter (Lx()→ Θ = L ) with surface area A and hemispherical solid angle (2π sr):

Φ = LAπ Ex()= Lπ Bx()= Lπ I()Θ = LAcosθ

Radiometry & Photometry 26 (52) Radiometric quantities → Photometric quantities

Integrate radiometric quantity R()λ weighted by the spectral luminous efficiency curve V()λ . This curve is the same as the color matching function y()λ in the CIE XYZ color system (see 116) V()λ 1

0.8

0.6

0.4

0.2

0 380 430 480 530 580 630 680 730 780 λ()nm

770nm ()λ ()λλ PK= m ∫ V R d Km = 680lumen/watt 380nm

Tabular data for the spectral luminous efficiency curve can be found in R16, p. 1170.

Radiometry & Photometry 27 VII. Optics

(53) Reflection at perfect mirror (incoming, outgoing direction, surface normal in same plane)

θ θ r = i (incident angle = reflected angle)

Ψ Ψ Ψ ()Ψ⋅ Ψ Vector computation (incident direction i , normal nx , reflection vector r ): r = 2 nx i – i ()⋅ Ψ 2 nx i Ψ – i nx

Ψ Ψ i r

x

(54) Refraction at transition from vacuum to material (incoming, refracted direction, surface normal in same plane) θ sinθ i i θ 1 ------θ- = n sin g = --- sin r n π 0 <<θ --- 0 <<θ θ i 2 r g θ θ r i for small angles: θ----- = n (Kepler’s formula) r θ g (55) Refraction at transition from material to vacuum (incoming, refracted direction, surface normal in same plane) θ sinθ r <<θ θ i 1 if 0 i g ------θ- = --- sin r n

θ 1 for small angles: -----i = --- θ n r θ i θ g (56) Refraction at transition from material 1 to material 2 (incoming, refracted direction, surface normal in same plane) θ θ i sin i n2 ------θ- ==----- n12→ n sin r n1 1 n2

θ r

Optics 28 (57) Total internal refraction (incoming, refracted direction, surface normal in same plane) n1 π n θ <<θ θ θ 2 if g i --- t = i θ 2 θ t g θ (58) Fresnel Reflection - Conductors i n Material 1 to material 2; relative index of refraction -----2 = η + jκ ; θ is angle of incidence. The Fresnel n1 coefficients express the directional-hemispherical spectral specular reflectivity.

2 2 a + b – 2acosθ + cos2 θ F = ------s 2 2 a ++b 2acosθ +cos2 θ 2 2 a + b – 2asinθtanθ + sin2 θθtan2 F = F ------p s 2 2 a ++b 2asinθtanθ +sin2θθtan2

where a and b are given by:

2 2 2 2 2 2 2 2 2a = ()η – κ – sin2 θ + 4η κ + ()η – κ – sin2 θ

2 2 2 2 2 2 2 2 2b = ()η – κ – sin2 θ + 4η κ – ()η – κ – sin2θ

Polarized light: reflectance Fr = sFs + pFp with sp+ = 1

F + F Unpolarized light: F = ------s ---p- r 2

1 Fs and Fp are also written as F⊥ and F// in various textbooks .

(59) Fresnel Reflection - Dielectrics

n 2 η θ θ Material 1 to material 2; relative index of refraction ----- = ; i is angle of incidence, r is angle of refraction n1 (given by 56). The Fresnel coefficients express the directional-hemispherical spectral specular reflectivity.

θ ⁄ θ ⁄ η 2 2 ()θ θ cos r cos i – 1 sin i – r F ==------s cosθ ⁄ cosθ + 1 ⁄ η 2()θ θ r i sin i + r θ ⁄ θ ⁄ η 2 2 ()θ θ cos i cos r – 1 tan – F ==------i r--- p cosθ ⁄ cosθ + 1 ⁄ η 2 ()θ θ i r tan i + r

(Fs and Fp are also written as F⊥ and F// in various textbooks)

2()θ θ 2 ()θ θ F + F 1 sin i – r cos + Unpolarized light: F ==------s p- --- ⋅⋅------1 + ------i r r 2 2 2 ()θ θ 2()θ θ sin i + r cos i – r

1.s stands for ‘senkrecht’, German for perpendicular.

Optics 29 η – 1 2 If θ = 0 , and thus θ = 0 : F ===F F ------(also sometimes written as F ) i r r s p η + 1 0

(60) Index of Refraction Data Values

A website listing all sort of possible data is at http://www.luxpop.com/

Optics 30 VIII. Bidirectional Reflectance Distribution Functions (BRDFs)

A. GENERAL PROPERTIES

dLx()→ Θ dLx()→ Θ (61) BRDF: f ()x, Θ → Θ ==------r ------r --- r i r dE() x ← Θ Lx()θ← Θ cos dω i i i Θi

nx Θ i

θ i Θ dLx()→ Θ θ r r r ()← Θ dE x i

x

BRDF is dimensionless but is expressed as 1/sr

BTDF = Bidirectional Transmittance Function: similar as BRDF but defined for transmittance BSDF = combination of 2 BRDFs and 2 BTDFs (one pair for each side of the surface)

(62) BRDF Reciprocity

(), Θ → Θ (), Θ → Θ (), Θ ↔ Θ fr x i r ==fr x r i fr x i r

(63) BRDF Energy conservation

∀Θ (),ΨΘ ↔ (), Ψ ω ≤ : ∫ fr x cos nx d Ψ 1

Ωx

(64) Biconical Reflectance

∫ ∫ f ()θΘ ↔ Θ cos cosθ dω dω r in out out in Θin Θout Ω Ω ρΘ()→ Θ out in in out = ------∫ cosθ dω in Θin

Ωin Ω Ω in and out can be a single direction, a solid angle, or the hemisphere. Combine the words ‘directional’, ‘coni- cal’ and ‘hemispherical’ to obtain the right adjective for the reflectance. E.g. Biconical reflectance; directional- hemispherical reflectance etc. (definitions from R7, p. 32).

(65) Lambertian Diffuse Reflection

(), Θ ↔ Θ fr x i r ==frd, constant

Outgoing radiance due to incoming radiance field:

Lx()→ Θ ==f ∫ Lx()θ← θ cos dω f E rd, in in Θin rd,

Ωin

Bidirectional Reflectance Distribution Functions (BRDFs) 31 B Bihemispherical reflectance: ρ = f π and ρ = --- d rd, d E

(B is the hemispherical radiosity and E is the hemispherical irradiance, see VI)

B. BRDF MODELS

General notations for BRDF models:

Θ r Outgoing direction of light. Θ i Incoming direction of light Θ Θ s Perfect specular direction w.r.t. i Θ Θ Θ h Halfway vector between r and i

nx Normal vector at surface point x where BRDF is evaluated

()ϕ , θ Spherical coordinates for each direction are using the same index. E.g. for the outgoing direction r r (),, Cartesian coordinates are also using the same index. E.g. for the outgoing direction xr yr zr . Normally, these will assumed to be normalized.

In general, negative values for cosine-lobes are ignored and set to zero.

(66) Modified Phong-BRDF1

()Θ ↔ Θ n ()Θ , Θ fr i r = kd + ks cos r s

or also:

ρ () ρ n + 2 2π f ()Θ ↔ Θ = -----d + ------s cosn ()Θ , Θ with ρ = πk and ρ = ------k r i r π 2π r s d d s n + 2 s

ρ ρ ≤ρ ρ Θ Energy conservation: d + s 1 . d and s are the maximum energy (i = nx ) reflected through the diffuse part and specular part respectively. In other words:

ρ (), Ψ ω ρ n + 1(), Ψ ω d = ∫ kd cos nx d Ψ s = ∫ ks cos nx d Ψ (to compute, see 30) Ω Ω x x

Θ The energy reflected through the specular lobe, given a direction i :

ρ n ()Θ , Θ (), Ψ ω ρ ≤ ρ s' = ∫ ks cos r s cos nx d Ψ s' s (to compute, see 31) Ω x

Proportional sampling: There are various ways to sample according to the modified Phong-BRDF, using a com- bination of 34, 35, 36 and 38. In a global illumination context, one is often interested in computing an integral of the following type (see 72), using Monte Carlo integration:

()Θ ()Ψ ()ΨΘ↔ (), Ψ ω I = ∫ L fr cos nx d Ψ Ω x

1. The modified Phong-BRDF is very similar to the function and was introduced as a BRDF in R26. See also R23.

Bidirectional Reflectance Distribution Functions (BRDFs) 32 Since the modified Phong-BRDF is often used in global illumination algorithms, there are various strategies for sampling proportional to the modified Phong-BRDF.

()Ψ ()Ψ a. The integral can be split in two parts, compute each part independently using PDFs p1 and p2 .

()Ψ (), Ψ ω ()Ψ n ()ΨΘ, (), Ψ ω I ==∫ L kd cos nx d Ψ + ∫ L ks cos s cos nx d Ψ I1 + I2 Ω Ω x x 〈〉 〈〉 〈〉 I = I1 + I2 N N 1 ()Ψ (), Ψ 2 ()Ψ n ()Ψ , Θ (), Ψ 1 L i kd cos nx i 1 L i ks cos i s cos nx i = ------∑ ------()Ψ - + ------∑ ------()Ψ ---- N1 p1 i N2 p2 i i = 1 i = 1 ()Ψ Some interesting choices for p1 :

N1 2ρ ()Ψ 1 〈〉 d ()Ψ (), Ψ p1 = ------π (see 34): I1 = ------∑ L i cos nx i 2 N1 i = 1

N1 cos()n , Ψ ρ ()Ψ x 〈〉 d ()Ψ p1 = ------π --- (see 35): I1 = ------∑ L i N1 i = 1

()Ψ Some interesting choices for p2 :

N π 2 1 2 ks ()Ψ 〈〉 ------()Ψ n () Ψ, Θ (), Ψ Uniform over hemisphere (see 34): p2 = ------π ; I2 = ∑ L i cos i s cos nx i 2 N2 i = 1

N2 cos()n , Ψ πk ()Ψ x 〈〉 s ()Ψ n() Ψ, Θ Cosine -weighted (see 35): p2 = ------π --- ; I2 = ------∑ L i cos i s N2 i = 1 cosn ()ΨΘ, ()Ψ s Proportional to specular lobe of BRDF (see 38): p2 = ------; n ()ΨΘ, ω ∫ cos s d Ψ Ω x

N2 k  〈〉I = ------s ∫ cosn ()ΨΘ, dω ∑ L()Ψ cos()n , Ψ 2 N s Ψ i x i 2 Ω x i = 1

b. Integral is split in two parts, use discrete probabilistic selection of what term to evaluate. (),, Ψ Select random event based on discrete PDF q1 q2 q3 with q1 ++q2 q3 = 1 . Then generate i using ()Ψ ()Ψ either p1 or p2 . L()Ψ k cos()n , Ψ if event 1:eval()Ψ = ------i d x ---i- i q p ()Ψ 1 1 i L()Ψ k cosn ()Ψ , Θ cos()n , Ψ if event 2:eval()Ψ = ------i s i s x ---i- i q p ()Ψ 2 2 i ()Ψ ()Ψ if event 3:eval i = 0 (If L contains recursive evaluations, this can be used to stop recursion).

Bidirectional Reflectance Distribution Functions (BRDFs) 33 N 1 Total estimator: 〈〉I = ---- ∑ eval()Ψ N i i = 1 ()Ψ ()Ψ Interesting choices for p1 , p2 : see above. (),, Interesting choices for q1 q2 q3 :

ρ ρ ρ ρ An obvious choice is to pick q1 = d , q2 = s' , q3 = 1 – d – s' (proportional to energy reflected in ρ Θ different modes). However, this requires the evaluation of s' for every value of . Another choice is to ρ ρ ρ ρ use the following values: q1 = d , q2 = s , q3 = 1 – d – s . There will be some more samples drawn in the specular lobe relative to the reflected energy in the lobe, but this can be countered by NOT resam- pling any directions that are located in the part of the lobe below the surface. These samples then give a contribution = 0 .

Total PDF is combination of discrete and continuous sampling. Generate samples as above, then the total PDF of all samples generated is: ()Ψ ()Ψ ()Ψ p = q1p1 + q2p2 ()q1 + q2 = 1 ρ ρ ()n + 2 N ()Ψ d s n ()Ψ , Θ (), Ψ L i -----π + ------π cos i s cos nx i 〈〉 1 2 I = ---- ∑ ------()Ψ ()Ψ --- N q1p1 i + q2p2 i i = 1 Interesting choices: 1 p ()Ψ = ------; 1 2π n + 1 p ()Ψ = ------cosn ()ΨΘ, (no resampling of directions under surface, so full lobe) 2 2π s ()n + 2 ρ ------ρ 2 ()n + 1 q = ------d --- ; q = ------s --- 1 ()n + 2 2 ()n + 2 2ρ + ------ρ 2ρ + ------ρ d ()n + 1 s d ()n + 1 s

()n + 2 2ρ + ------ρ N d ()n + 1 s then the above estimator is written as: 〈〉I = ------∑ L()Ψ cos()n , Ψ N i x i i = 1

(directions under the surface in the specular lobe evaluate to 0).

(67) Modified Phong-BRDF - Blinn Variant

(see notations page 32)

()Θ ↔ Θ n θ fr i r = kd + ks cos h

(68) Cook-Torrance-BRDF

(see notations page 32)

()β D()θ G ()Θ ↔ Θ F ⋅ h fr i r = ------π ------θ θ---- cos i cos r

Bidirectional Reflectance Distribution Functions (BRDFs) 34 βΘΘ Θ Θ : angle between i and h (equal to angle between r and h ) F()β : Fresnel Reflectance (see 58) ()θ D h : Facet distribution G : Geometric masking term

tanθ 2 – ------1 m D()θ = ------e (m is material-parameter) 2 m cos4 θ

2cosθ cosθ 2cosθ cosθ G = min1,,------h -i ------h r cosβ cosβ

The Cook-Torrance model is described in more detail in R8.

(69) Ward-BRDF

(see notations page 32)

()2 θ ⁄ α2 ρ 1 exp –tan a. Isotropic Gaussian Model: f ()Θ ↔ Θ = -----d + ρ ⋅⋅------h --- r i r π s θ θ 2 cos i cos r 4πα

α is standard deviation (RMS) of the surface slope. ρ ρ ≤ Energy conservation: d + s 1 2 Normalization 14⁄απα is accurate as long is not much greater than 0.2 (surface is then mostly diffuse).

Proportional sampling of specular part (is already normalized as a pdf):

θ ()α () h = atan –log r1 ϕ π = 2 r2

b. Anisotropic Elliptical Gaussian Model: ()2 θ ()2 ϕ ⁄ϕα2 2 ⁄ α2 ρ 1 exp –tan cos + sin f ()Θ ↔ Θ = -----d + ρ ⋅⋅------h h x h y --- r i r π s θ θ 4πα α cos i cos r x y

α α x and y are are the standard deviation of the surface slope in the x and y direction at the tangent plane. ρ ρ ≤α2 α2 Energy conservation: d + s 1 and x « 1 and y « 1

Proportional sampling of specular part (is already normalized as a pdf):

–log()r θ 1 h = atan ------2 ϕ ⁄ϕα2 2 ⁄ α2 cos x + sin y α ϕ x ()π = atanα------tan 2 r2 y

See R46 for a more complete description of the Ward BRDF.

Bidirectional Reflectance Distribution Functions (BRDFs) 35 (70) Lafortune-BRDF

()Θ ↔ Θ ()nk fr i r = ∑ Cxk, xixr ++Cyk, yiyr Czk, zizr k

which can also be written as:

()Θ ↔ Θ ()ΘΘ ()⋅ Θ nk fr i r = ∑Ck i a r k

where:

()C x ,,C y C z Θ xk, i yk, i zk, i a = ------2 2 2 2 2 2 Cxk, xi ++Cyk, yi Czk, zi n ----k ()Θ ()2 2 2 2 2 2 2 Ck i = Cxk, xi ++Cyk, yi Czk, zi

Θ Therefore, the BRDF is a combination of cosine-lobes, each centered around a different axis a

Proportional sampling:

1. Integrate different cosine-lobes over spherical digons using (31b) 2. Select cosine-lobe proportional to the above computed values. 3. Generate direction according to this cosine-lobe (38)

See R25 for a complete description.

C. BRDF MEASUREMENTS

(71) Cornell Measurements

The Program of Computer Graphics, Cornell University, has a number of measurements online:

http://www.graphics.cornell.edu/online/measurements/

Bidirectional Reflectance Distribution Functions (BRDFs) 36 IX. Rendering Equation and Global Illumination Formulations

A. RADIANCE TRANSPORT FORMULATIONS

All formulations in this section take radiance as the main transport quantity. For the sake of clarity, the wavelength dependency of radiance values is implicitly assumed in all equations.

(72) Rendering Equation (Radiance), integration over incoming hemisphere

()→ Θ ()→ Θ ()← Ψ (), ΨΘ↔ (), Ψ ω L x = Le x + ∫ Lx fr x cos nx d Ψ Ω x

()→ Θ ()(), Ψ → Ψ(), ΨΘ↔ (), Ψ ω Direct illumination only: L x = ∫ Le rx – fr x cos nx d Ψ Ω x

(73) Rendering Equation (Radiance), integration over all surfaces in the scene

()→ Θ ()→ Θ ()→ (), Θ ↔ (), (), L x = Le x + ∫ Lz zxfr x zx GxzVxzdAz A cos()n , Θ cos()n , –Θ Gxz(), = ------x z 2 xz–

(many authors include Vxz(), in the definition of Gxz(), , but in this document they are kept separate for clarity).

Direct illumination only: see 74.

(74) Direct Illumination Equation (Radiance), integration over all light sources

(computing direct illumination using various sampling techniques for shadow rays: page 50)

()… Li : all light sources i = 1 NL in the scene. Li A : area of light source L . (), Ψ y Li i rx Ω () x Li : solid angle subtended by light source Li w.r.t. x . Ω ()L Ωvis() x i x Li : visible solid angle subtended by light source Li w.r.t. x . Ψ (), Ψ Θ y : intersection of ray x and light source Li

NL : number of light sources in the scene x (74a) Integration over the area of all light sources:

NL ()→ Θ ()→ Θ ()→ (), Θ ↔ (), (), L x = Le x + ∑ ∫ Le yyxfr x xy GxyVxydAy A i = 1 Li

Rendering Equation and Global Illumination Formulations 37 (74b) Integration over solid angles subtended by light sources:

NL ()→ Θ ()→ Θ ()→ Ψ (), ΨΘ↔ (), Ψ (), ω Lx = Le x + ∑ ∫ Le y – fr x cos nx Vxyd Ψ Ω () i = 1 x Li

(74c) Integration over visible solid angles subtended by light sources:

(in this case yrx≡ (), Ψ )

NL ()→ Θ ()→ Θ ()→ Ψ (), ΨΘ↔ (), Ψ ω Lx = Le x + ∑ ∫ Le y – fr x cos nx d Ψ Ω vis() i = 1 x Li

(75) Continuous Radiosity Equation: diffuse reflection, diffuse light sources, integration over surfaces

If all surfaces are diffuse reflectors and light sources are diffuse emitters, radiance values are independent of direction and can be expressed by the hemispherical radiometric quantities:

Bx()= πLx() () π () Be x = Le x ρ() π () x = fr x

() (), (), () () ρ()BzGxzVxz Bx = Be x + x ∫ ------π -dAz A

(76) Participating medium

See also descriptions in (R7, p. 325) and (R33, p. 174). There are 4 phenomena that affect the radiance along a path in a medium:

absorption: the medium absorbs light emission: the medium emits light in-scattering: light scatters into the direction of travel absorption in-scattering out-scattering: light scatters away from the direction of travel

Change in radiance along a path: dL() s ------= –κ Ls()++ κL ()s κ∫ L ()Θ f()Θ dω ds t a e s i Θ Ω emission out-scattering emission in-scattering

absorption + out-scattering

with:

κ () a s : absorption coefficient (dimension: 1/meter), fraction by which radiance is reduced per unit length due to absorption in the medium. κ () s s : scattering coefficient (dimension: 1/meter), fraction by which radiance is reduced per unit length due to out-scattering. κ () κ() κ() t s = a s + s s : extinction coefficient.

Rendering Equation and Global Illumination Formulations 38 f()Θ : phase function, describing fraction of radiance arriving from direction Θ that is in-scattered along the 1 path. If the medium is isotropic: f = ------isotropic 4π

Solving the above differential equation:

s () ()τ()τ, (), ()κ() Ls = L 0 0 s + ∫ s' s Js' t s' ds' 0

with:

s2 τ(),  κ() κ () s1 s2 = exp–∫ t s ds : transmittance function. If the medium is isotropic, t s is constant and thus  s1 κ s s τ(), – t 1 – 2 s1 s2 = e

Js(): source function, describing in-scattering and emission.

() ()() () () ()Θ ()Θ ω Js = 1 – Rs Le s + Rs∫ Li f d Θ Ω

κ ()s κ ()s () s s Rs ==------κ () κ------() κ()--- : scattering albedo of the medium t s a s + s s

(77) Participating medium, no scattering

κ () κ () κ() Equations in 76 apply, with s s = 0 and a s = t s

s () ()τ(), ()τ()κ, () Ls = L 0 0 s + ∫Le s' s' s t s' ds' 0

κ () () and if t s and Le s constant: κ κ () ()– t s ()– t s Ls = L 0 e + Le 1 – e (can be used as a simple fog-model)

B. DUAL TRANSPORT FORMULATION

Light transport can also be formulated by using the adjoint equations. The adjoint transport quantity is called impor- tance or potential function by various authors, and an often used notation is W . An intuitive way of thinking about the potential function is to consider it an incident function in combination with radiance as an exitant function.

(78) Relationship between Flux, Radiance, Potential

See R12 for a more complete description.

× Ω ⊂ × Ω Consider a set S of surface points and associated directions SA= s x A . The exitant flux for S can be written as:

Rendering Equation and Global Illumination Formulations 39 Φ() ()→ Θ ()Θ← Θ (), ω S = ∫ ∫ Lx We x cos nx dAΘd x A Ω

()← Θ with We x the initial potential, defined as:

1 if ()x, Θ ∈ S W ()x ← Θ =  e 0 if ()x, Θ ∉ S

Φ() 〈〉, The above integral can also be formally defined as an inner product: S = LWe .

Using the dual formulation, Φ()S can also be written as an integral over all light sources, or formally:

Φ() ()→ Θ ()Θ← Θ (), ω 〈〉, S ==∫ ∫ Le x Wx cos nx dAΘd x Le W A Ω

with

()← Θ ()← Θ ()()Ψ, Θ ← ()()ΨΘ, Θ , ↔ (), Ψ ω W x = We x + ∫ Wrx fr rx cos nrx(), Θ d Ψ Ω rx(), Θ

Wx()← Θ is dimensionless and has the same transport properties as radiance (invariant along straight lines).

Rendering Equation and Global Illumination Formulations 40 X. Form Factors

Form Factor: the fraction of uniform diffuse radiant energy leaving one surface that is incident upon a second sur- face.

Form Factor Algebra: mathematical relations between form factors

Notation: The ‘sender’ surface is written as the first index, the ‘receiver’ surface as the second. An arrow indicates the ‘energy flow’. This notation is consistent with other notations in literature, where the arrow usually is not used.

Form Factors are usually treated very extensively in books dealing with thermal radiation heat transfer (R32).

A good on-line resource for analytical avaluations of form factors: “A Catalog of Radiation Heat Transfer Configura- tion Factors” by John R. Howell: http://www.me.utexas.edu/~howell/

Global illumination context: computing form factors is one of the main elements of radiosity algorithms. Radiosity algorithms based on some variant of particle tracing often implicitly compute form factors without storing them. Direct illumination computations in ray tracing using shadow-rays also often implicitly computes a point-to-area form factor. A. GENERAL EXPRESSIONS AND PROPERTIES

(79) Differential element to differential element Form Factor dAy θ θ ny y cos x cos y Gxy(), θ dF → ==------dA ------dA y dAx dAy 2 y π y πr xy nx θ r With visibility term: x xy

θ θ dA cos x cos y Gxy(), Vxy(), x x dF → ==------Vxy(), dA ------dA dAx dAy π 2 y π y rxy

(80) Differential element to element Form Factor

θ θ cos x cos y Gxy(), Vxy(), F → ==∫ ------Vxy(), dA ∫ ------dA dAx j 2 y π y πr Aj xy Aj

(81) Differential element to polygon Form Factor; full visibility Vi E 1 F → = ------∑ n ⋅ Γ (E = number of edges or vertices of the polygon) dAx j 2π x i i = 1 Vi + 1 n γ Γ ⊗ Γ γ x i where i = Vi Vi + 1 and magnitude of i = i .

See also R3.

dAx

Form Factors 41 (82) Element to element Form Factor

θ θ 1 cos x cos y 1 Gxy(), F ==------Vxy(), dA dA ------Vxy(), dA dA ij→ ∫ ∫ 2 y x ∫ ∫ π y x Ai πr Ai Ai Aj xy Ai Aj

Ω () x j is subtended solid angle covering surface j as seen from x (see 26 and 27; also 9):

cosθ 1 x ()Θ, ω Fij→ = ----- ∫ ∫ ------π -Mx j d ΘdAx Ai Ai Ωx ()j

cosθ 1 x ω Fij→ = ----- ∫ ∫ ------π -d ΘdAx Ai A Ωvis() i x j

(83) Element to element Form Factor; full visibility; Stoke’s Theorem

1 () Fij→ = ------π - °∫ °∫ lnrdxidxj ++lnrdyidyj lnrdzidzj 2 Ai Ci Cj

An analytic solution for this integral, given any two polygons, was derived by Schröder and Hanrahan (R29).

(84) Form Factor Algebra

a. AiFij→ = AjFj → i

b. In a closed environment: ∑Fij→ = 1 j

(85) Nusselt’s Analog (projection on a disk)

Aproj F → = ------dAx j π 2 n r x Aj

dAx Aproj r x

Form Factors 42 (86) Projection on a sphere n Aproj x F → = ------dAx j π 2 4 r Aj See also R39. r

Aproj x dAx

1 B. COMPUTING FORM FACTORS USING MONTE CARLO INTEGRATION

(87) Uniform area sampling on both surfaces

MC integration applied to (82 - 1st equation):

(), 1 pxy = ------⋅ Ai Aj N 1 A Gx(), y Vx(), y 〈〉F = ---- ∑ ------j k k k k- ij→ N π k = 1 2 2 2 1 Aj G ()xy, V ()xy, 2 σ []〈〉F = ----------dA dA –F ij→ ∫ ∫ 2 y x ij→ NAi π Ai Aj

(88) Uniform area sampling + uniform solid angle sampling

MC integration applied to (82 - 2nd equation)

(), Θ 1 px = ------⋅ Ω () Ai x j Θ N cosθ Ω ()j Mx()k, j 1 xk x k 〈〉F = ---- ∑ ------k ij→ N π k = 1 Θ 2 θ Ω () 2(), 2 1 cos x x j M x j 2 σ []〈〉F = ---- ∫ ∫ ------dω dA – F ij→ N2 Θ x ij→ Ω () A π Ai x j i

Ωvis() By using visibility culling or rejection sampling, sampling and integration can be limited to x j .

1. Extensive coverage of computing form factors using MC integration can be found in the Ph.D. thesis of Ph. Bekaert (R5). This section is partly based on that text.

Form Factors 43 (89) Uniform area sampling + cosine-weighted solid angle sampling

MC integration applied to (82 - 2nd equation)

θ 1 cos x px(), Θ = ----- ⋅ ------Ai θ ω ∫ cos xd Θ

Ωx()j Θ ()k, θω N Mxk j ∫ cos xd Θ 1 Ω () 〈〉F = ---- ∑ ------x j ij→ N π k = 1 2 Θ cosθ M ()x , j cos θdω x ∫ x Θ 2 Ω () 2 σ []〈〉1 x j ω Fij→ = ----∫ ∫ ------d ΘdAx – Fij→ N π2 A Ω ()j Ai i x

Ωvis() By using visibility culling or rejection sampling, sampling and integration can be limited to x j .

(90) Uniform area sampling + cosine-weighted hemisphere sampling

Ω Directions are sampled over the entire hemisphere x and do not need to point to surface element j . Just count

the number of rays arriving at j to get an estimate for Fi → j .

cosθ (), Θ 1 ⋅ x px = ------π - Ai N Θ 1 k 〈〉F = ---- ∑ Mx(), j ij→ N k k = 1 2 1 σ []〈〉F = ----F ()1 – F ij→ N ij→ ij→

This sampling procedure can be used to compute all Fi → j simultaneously for a given i using the same set of (), Θ rays xk k :

for all patches j: Fi→j = 0; for k = 1,...,N do generate a uniformly distributed random point x on patch i generate a cosine distributed direction Θ j = patch hit by the ray (x, Θ) Fi→j += 1/N

(91) Global Lines

Global lines methods compute all form factors in the scene without explicitly sampling points on the surface patches1. Various techniques can be used to compute the global lines:

a. Construct a bounding sphere for the scene. Generate each global line by connecting 2 uniform random points on the surface of the sphere.

1. An overview of global lines in the context of radiosity can be found in the Ph.D. Thesis of Mateu Sbert (R28):

Form Factors 44 b. Generate a random direction ΘΘ on the unit sphere. Project the scene on a plane perpendicular to . Generate a uniformly distributed random surface point x in the projection. ()x, Θ is a global line.

All global lines are intersected with all surfaces in the scene, resulting in several spans on each line. The proba- bility that a line intersects a surface is proportional to the area of that surface.

⁄ Fi → j is estimated by Nij Ni , with Nij the number of spans connecting surface patches i and j , and Ni the number of spans starting from surface patch i .

Form Factors 45 XI. Radiosity System & Algorithms

The term ‘Radiosity’ is used in various ways in photorealistic image synthesis: as the radiometric quantity describing incident energy integrated over the hemisphere; but also to indicate a specific class of algorithms that compute an energy distribution in the scene. Although there is no formal definition of what a ‘radiosity algorithm’ actually is, it is usually assumed that one means a finite-element solution, computing diffuse light interaction only.

Most radiosity literature uses Galerkin Radiosity, a projection method to transform the continuous radiosity equations (75) into a set of linear equations. Unless otherwise indicated, Galerkin radiosity is used in this section.

Notations:

2 Bi : constant radiosity of patch i (see 49, 51) - expressed in Watt/m 2 Bei : self-emitted constant radiosity of patch i - expressed in Watt/m ρ i : diffuse bihemispherical reflectance of patch i (see 65) - dimensionless

Fij→ : form factor between patch i and j (see 82) - dimensionless

Pi : power of patch i - expressed in Watt Pi = AiBi 2 Ai : surface area of patch i - expressed in m

(92) System of radiosity equations, constant basis functions

∀ ρ patches i: Bi = Bei + i∑Fij→ Bj j ρ ρ …ρ 1 – 1F11→ – 1F12→ – 1F1 → n B1 Be1 –ρ F 1 – ρ F …ρ– F B B 2 21→ 2 22→ 2 2 → n 2 = e2 …………… … ρ ρ … ρ – nFn → 1 – nFn → 2 1 – nFnn→ Bn Ben

(93) System of power equations, constant basis functions

∀ ρ patches i: Pi = Pei + i∑Fji→ Pj j ρ ρ …ρ 1 – 1F11→ – 1F21→ – 1Fn → 1 P1 Pe1 –ρ F 1 – ρ F …ρ– F P P 2 12→ 2 22→ 2 n → 2 2 = e2 …………… … ρ ρ … ρ – nF1 → n – nF2 → n 1 – nFnn→ Pn Pen

(94) Discretizing the continuous radiosity equation1

() (), (), () () ρ()BzGxzVxz Continuous radiosity equation (see 75): Bx = Be x + x ∫ ------π -dAz A

1. Based on chapter 3 of R7.

Radiosity System & Algorithms 46 N () ()≈ ˆ () () Approximation of Bx : B x B x = ∑ BiNi x i = 1

ˆ () (), (), ˆ () () ˆ () () ρ()B z GxzVxz Residual (substitute B x in continuous equation): r x = B x – Be x – x ∫ ------π -dAz A

N () () 〈〉(), () General approach: pick N weighting functions Wi x . The norm of residual: rx = ∑ rx Wi x . i = 1 〈〉(), () () () Each of the terms rx Wi x = ∫ rxWi x dAx can now be set to be zero, resulting in a linear equation for A () each Wi x .

(94a) Point Collocation

() δ() Wi x = xx– i (residual is zero for selected number of points xi ) N ρ()x ∀ () () i () (), (), then: i: ∑ KijBj – Be xi = 0 with Kij = Nj xi – ------π ∫ Nj z Gxi z Vxi z dAz j = 1 A

(94b) Galerkin

() () Wi x = Ni x N ∀ () () then: i: ∑ KijBj – ∫ Be x Ni x dAx = 0 j = 1 A (), (), () () ρ() () ()GxzVxz with Kij = ∫ Ni x Nj x dAx – ∫∫ x Ni x Nj z ------π dAzdAx A A A

1 if x belongs to surface element i Choosing N ()x =  results in the classic radiosity formulation (92 or 93). i 0 otherwise

(95) Basic Relaxation Algorithm1

Most radiosity algorithms are relaxation methods, that solve the radiosity system through a series of iterations. This item describes the basic principle of all relaxation algorithms.

… a11 a1n x1 e1 Linear system to solve: Ax= e or ……… … = … … an1 ann xn en ()0 ()1 ()2 Subsequent iterations: x ,,,x x …

1. A very good overview of different relaxation techniques for solving the radiosity system can be found in the Ph.D. thesis of Philippe Bekaert (R5).

Radiosity System & Algorithms 47 ()k ()k + 1 ()k ()k Correction vectors ∆x : x = x + ∆x ()k ()k ()k ()k + 1 ()k ()k Residu vectors r (measure for error): r = eAx– , and therefore r = r – A∆x

Basic relaxation algorithm:

Choose initial x(0); r(0) = b - A.x(0); for k = 0, 1, ... until convergence do compute ∆x(k) (based on x(k), r(k), other information) x(k+1) = x(k) + ∆x(k); r(k+1) = r(k) - A.∆x(k);

(96) Gauss-Seidel iteration

 Each component of the solution is updated in turn: x ← e – ∑ a x ⁄ a s s sj j ss js≠ Correction vector: ∆x ← δ r ⁄ a (all components 0 except s ). i is s ss Residu vector: r ← r – a r ⁄ a (component s equals 0). i i is s ss

Applied to (93) (ass = 1 if Fss→ = 1 ):

← ρ Ps Pes + s ∑ Fjs→ Pj js≠

Algorithm:

for all patches j: Pj = Pej; cycle through patches until convergence (selected patch = s) Ps = Pes; for all patches j Ps += ρs.Fj→s.Pj;

Incremental Gauss-Seidel: compute residu vector explicitly and increment solution vector instead of replacing previous solution.

Radiosity System & Algorithms 48 XII. Radiosity Extensions

(97) Clustering - Equivalent extinction coefficient

When clustering objects, an equivalent isotropic extinction coefficient can be computed for the cluster (R35), in an analogy with a participating medium (76).

A κ = ------t 4V

where A is the total surface area of objects in the cluster and V is the volume of the cluster.

Directional extinction (R34):

⊥ A ()Θ κ ()Θ = ------t V

⊥ where A ()Θ is the total projected area in direction Θ .

(98) Final Gathering

A final gathering step is used to make a high-quality rendering of a radiosity solution, using a per-pixel radi- ance computation. It usually involves computing a radiance value for the visible surface point through each pixel, using the radiosity values stored on the surface patches.

Suppose L is the pre-computed (diffuse) radiosity solution, then the radiance for surface point x in direction Θ can be approximated as (see section IX for basic rendering equation):

()→ Θ ()→ Θ ()← Ψ (), ΨΘ↔ (), Ψ ω L x = Le x + ∫ Lx fr x cos nx d Ψ (hemisphere integration) Ω x or: ()→ Θ ()→ Θ ()→ (), Θ ↔ (), (), L x = Le x + ∫ Lz zxfr x zx GxzVxzdAz (surface integration) A

The integral in either of the two above formulations can be approximated by an appropriate sampling technique, thereby ‘gathering’ radiance from the other surfaces. Many different variants are possible, depending on how much information was stored with the radiosity solution.

Variants: Uniform hemisphere sampling; cosine-weighted hemisphere sampling; uniform area sampling; area sampling proportional to solid angle; area sampling proportional to cosine weighted angle; area sampling pro- portional to L ; area sampling sampling proportional to stored (linked) form factors. See (R41, R4) for an over- view.

Radiosity Extensions 49 XIII. Pixel-driven Path Tracing Algorithms

Many rendering algorithms use (random) paths in object space to compute illumination values. If these paths are directly used to compute the illumination of the pixels, one has a specific class of algorithms, of which classic ray tracing is the best-known. Other algorithms include stochastic ray tracing; light tracing (also called backward ray trac- ing or particle tracing); and bidirectional ray tracing.

See also: Ray-object intersections: chapter on Geometry (chapter III) A. DIRECT ILLUMINATION USING SHADOW-RAYS

Most algorithms that compute direct illumination using shadow rays apply a specific numerical integration scheme directly derived from the equations described in 74.

When there are multiple light sources in the scene, the complete sampling procedure can usually be divided in two parts: a discrete selection of one of the light sources, followed by the generation of a shadow-ray for the selected light source. Various choices for each of these sampling procedures produce different estimators. The obvious alternative is to split the direct illumination integral in seperate integrals, one for each light source, and compute the illumination due to each light source seperately.

A good general overview for direct lighting calculations using Monte Carlo techniques can be found in R30.

(99) Single light source, uniform sampling of light source area

Apply Monte Carlo integration to integral 74a:

() ⁄ py = 1 AL N A 〈〉Lx()→ Θ = ------L ∑ L ()y → y x f ()xxy, ↔ Θ Gxy(), Vxy(), N e k k r k k k k = 1

Graphical representation: 1. generate point on light source, evaluate Le

yk 2. evaluate V, G

? Θ

3. evaluate fr x

(100) Single light source, uniform sampling of solid angle subtended by light source

Apply Monte Carlo integration to integral 74b:

()Ψ ⁄ Ω () p = 1 x L N Ω ()L 〈〉Lx()→ Θ = ------x ∑ L ()y → –Ψ f ()x, Ψ ↔ Θ cos()n , Ψ Vxy(), N e k k r k x k k k = 1

(), Ψ with yk = intersection of ray x k and light source L

Pixel-driven Path Tracing Algorithms 50 Graphical representation 3. evaluate Le

y 2. evaluate V k

1. generate direction in solid angle ? Θ Ψ k 3. evaluate cosine, fr x

Solid angle sampling of the light source usually yields lower variance as opposed to area sampling (99), due to the abscence of a cosine and inverse distance factor in the estimator.

(101) Multiple light sources, uniform random source selection, uniform sampling of light source area

Apply 2 sampling steps for Monte Carlo evaluation of integral 74a: () ⁄ 1. Select a light source i using a discrete pdf pL i = 1 NL 2. Select a surface point y on light source i using a uniform pdf py()= 1 ⁄ A Li

N N 〈〉Lx()→ Θ = ------L ∑ A L ()y → y x f ()xxy, ↔ Θ Gxy(), Vxy(), N Lk e k k r k k k k = 1

Graphical representation: 1. pick random light source

yk

3. evaluate visibility, G

? 2. generate point on Θ light source, evaluate Le

4. evaluate fr x

(102) Multiple light sources, uniform random source selection, uniform sampling of light source solid angle

Apply 2 sampling steps Monte Carlo evaluation of integral 74b: () ⁄ 1. Select a light source i using a discrete pdf pL i = 1 NL Ψ ()Ψ ⁄ Ω () 2. Select a random direction within solid angle subtended by light source i using pdf p = 1 x L

N N 〈〉Lx()→ Θ = ------L ∑ Ω ()L L ()y → –Ψ f ()x, Ψ ↔ Θ cos()n , Ψ Vxy(), N x i e k k r k x k k k = 1

(), Ψ with yk = intersection of ray x k and light source Li

Pixel-driven Path Tracing Algorithms 51 Graphical representation 1. pick random light source

4. evaluate Le

y 3. evaluate visibility k

2. generate direction in solid angle ? Θ Ψ k 5. evaluate cosine, fr x

Solid angle sampling of the light source usually yields lower variance as opposed to area sampling (101), due to the absence of a cosine and inverse distance factor in the estimator.

(103) Multiple light sources, non-uniform random source selection, non-uniform sampling of light source area

Apply 2 sampling steps during the Monte Carlo evaluation of 74a: () 1. Select a light source i using a discrete pdf pL i 2. Select a surface point y on light source i using a pdf py()

N L ()y → y x f ()xxy, ↔ Θ Gxy(), Vxy(), 〈〉()→ Θ 1 e k k r k k k Lx = ---- ∑ ------() () ---- N pL i pyk k = 1

Some interesting choices:

() pL i can be chosen proportional to the power emitted by each light source (bright light sources get sampled Φ π () Φ⁄ Φ Φ more often). E.g. for diffuse light sources: i = LeiAi and thus pL i = i tot where tot is the total emitted power of all light sources.

N Φ f ()xxy, ↔ Θ Gxy(), Vxy(), 〈〉()→ Θ tot r k k k In this case: Lx = ------π ∑ ------() --- N Aipyk k = 1

N Φ and if py()= 1 ⁄ A : 〈〉Lx()→ Θ = ------tot ∑ f ()xxy, ↔ Θ Gxy(), Vxy(), i πN r k k k k = 1

(104) Various strategies for computing direct illumination due to multiple light sources

Various schemes for speeding up the computation of direct illumination due to multiple light sources have been () proposed by several authors. These usually involve a smart choice for the pdf pL i in 103, taking into account light source brightness, visibility, etc.

G. Ward (R45) proposes to rank all light sources according to their potential illumination contribution to the point to be shaded (that is, without taking into account visibility). Then, the illumination of the light source ranked first is computed first (e.g. using 99), followed by the light source ranked second, and so on; until the potential contribution of the remaining light sources falls below a certain threshold. The illumination due to the remaining light sources is then computed using e.g. 101 or 103. Alternatively, one can estimate the contribution of the remaining light sources by multiplying their potential contribution by the average hit ratio of shadow rays

Pixel-driven Path Tracing Algorithms 52 send to these light sources so far (e.g. when computing previous points). The accuracy goal can be relaxed by a user-specified parameter.

In (R30), an approach is presented where the scene is divided in octree cells. Each cell maintains a list of ‘impor- tant’ light sources for the points in that cell, based on intensity of the light source, distance, and reflectivity. When selecting a light source, the important light sources are sampled proportional to their potential contribu- tion (not taking into account visibility), and all remaining light sources are selected with equal probability. The number of samples used for the important and unimportant light sources can vary. In (R48), an extension using the visibility function to classify light sources is presented.

The same authors also describe the following technique: instead of using two different sampling steps (pick the light source first, then sample within the light source), a single procedure can be used that only uses 2 random α ξ [], numbers. Suppose we want to pick light source i with probability i . Generate 1 uniform over 01 . Choose light source i if: i – 1 i α <<ξ α ∑ j 1 ∑ j j = 1 j = 1

i – 1 ()ξξ , ξ ξ α ⁄ α To sample the light source, use the pair 1' 2 with 1' = 1 – ∑ j i . j = 1 Graphically, this means all light sources are mapped into the []01, × []01, domain: light source 1 light source 3 ξ light source 2 light source 4 2

1

α α α α 1 2 3 4

ξ 0 1 0 1

ξ 1' 0 1

Advantage: one less random variable, so stratified sampling becomes more effective; less variance.

(105) Multiple light sources, uniform sampling of hemisphere

The main difference with the previous methods is that shadow rays are not targeted towards light sources, but are generated over the entire hemisphere. Apply Monte Carlo evaluation to direct illumination equation of 72.

p()Ψ = 12⁄ π (uniform sampling of hemisphere, see 34)

N 2π 〈〉Lx()→ Θ = ------∑ L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ cos()n , Ψ N e k k r k x k k = 1

Pixel-driven Path Tracing Algorithms 53 (106) Multiple light sources, non-uniform sampling of hemisphere

The main difference with the previous methods is that shadow rays are not targeted towards light sources, but are generated over the entire hemisphere. Apply Monte Carlo evaluation to direct illumination equation of 72.

Choose a pdf for generating random directions: p()Ψ

N L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ cos()n , Ψ 〈〉()→ Θ 1 e k k r k x k Lx = ---- ∑ ------()Ψ ---- N p k k = 1

Graphical representation:

2. find nearest intersection point; (), Ψ if on light source, evaluate L rx k e

1. pick random direction Ψ Θ k

3. evaluate fr.cos x

Some interesting choices: uniform sampling, cosine-sampling, brdf sampling, brdf.cosine sampling.

(106a) Multiple light sources, uniform sampling of hemisphere: see 105

(106b) Multiple light sources, cosine-sampling of hemisphere

()Ψ (), Ψ ⁄ π p = cos nx (cosine sampling of hemisphere, see 35)

N π 〈〉Lx()→ Θ = ---- ∑ L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ N e k k r k k = 1

(106c) Multiple light sources, BRDF-sampling of hemisphere

f ()x, ΨΘ↔ p()Ψ = ------r --- (), ΨΘ↔ ω ∫ fr x d Ψ Ω x

(), ΨΘ↔ ω ∫ fr x d Ψ N Ω 〈〉Lx()→ Θ = ------x ∑ L ()rx()Ψ, Ψ → – cos()n , Ψ N e k k x k k = 1

For a general BRDF, the appropriate sampling function might be very difficult to construct. Rejection sampling can be used (see 8), but might yield very high variance, especially when the BRDF has a narrow peak.

Pixel-driven Path Tracing Algorithms 54 (106d) Multiple light sources, BRDF.cosine-sampling of hemisphere

f ()x, ΨΘ↔ cos()n , Ψ p()Ψ = ------r x ---- (), ΨΘ↔ (), Ψ ω ∫ fr x cos nx d Ψ Ω x

(), ΨΘ↔ (), Ψ ω ∫ fr x cos nx d Ψ N Ω 〈〉Lx()→ Θ = ------x - ∑ L ()rx()Ψ, Ψ → – N e k k k = 1

For a general BRDF, the appropriate sampling function might be very difficult to construct. Rejection sampling can be used (see 8), but might yield very high variance, especially when the BRDF has a narrow peak.

B. RAY TRACING

The term ‘ray tracing’ has been used for different algorithms over the years. In the context of global illumination, ‘ray tracing’ usually implies ‘stochastic ray tracing’, where one can compute a full solution to the rendering equation. The traditional ray tracing algorithm (R47) is then often referred to as ‘classic ray tracing’ or ‘Whitted-style ray tracing’.

Stochastic ray tracing computes the radiance value for a given surface point in a given direction. These points are usu- ally points visible through a pixel, and by averaging such radiance values using an appropriate filter, one can compute the illumination value of a pixel in the image.

(107) Stochastic ray tracing - general idea

()→ Θ ()→ Θ ()← Ψ (), ΨΘ↔ (), Ψ ω Rendering equation (72): L x = Le x + ∫ Lx fr x cos nx d Ψ Ω x

Monte Carlo integration using pdf p()Ψ , and invariance property of radiance ()← Ψ ()()Ψ, Ψ → ():Lx i = Lrx i – i

N 1 Lrx()()Ψ, Ψ → – f ()x, Ψ ↔ Θ cos()n , Ψ 〈〉()→ Θ ()→ Θ ---- i i r i x i Lx = Le x + ∑ ------()Ψ ---- N p i i = 1

()()Ψ, Ψ → Lrx i – i is evaluated recursively using the same procedure. (), Ψ rx i

()()Ψ, Ψ → Lrx i – i

Lx()→ Θ x

Pixel-driven Path Tracing Algorithms 55 (108) Next event estimation (split in direct and indirect term)

Rewrite rendering equation (72,74) as integral over area of all light sources and hemispherical integral of all indirect light (not directly from light sources).

()→ Θ ()→ Θ ()→ Θ Lx = Le x + Lr x ()→ Θ ()← Ψ (), ΨΘ↔ (), Ψ ω Lr x = ∫ Lx fr x cos nx d Ψ Ω x ()→ (), Θ ↔ (), (), ()← Ψ (), ΨΘ↔ (), Ψ ω = ∫ Le yyxfr x xy GxyVxydAy + ∫ Li x fr x cos nx d Ψ Ω AL x ()→ Θ ()→ Θ = Ldirect x + Lindirect x

()← Ψ ()()Ψ, Ψ → and Li x = Lr rx i – i .

()→ Θ ()→ Θ Ldirect x is evaluated using any of the techniques for direct illumination (99 - 106). Lindirect x is evaluated with Monte Carlo integration:

N 1 L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ cos()n , Ψ 〈〉()→ Θ ---- r i i r i x i Lindirect x = ∑ ------()Ψ ---- N p i i = 1

()()Ψ, Ψ → Lr rx i – i is evaluated recursively.

Some interesting choices for p()Ψ : uniform sampling, cosine-sampling, brdf sampling, brdf.cosine sampling.

(108a) Uniform sampling of hemisphere

1 p()Ψ = ------2π N 2π 〈〉L ()x → Θ = ------∑ L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ cos()n , Ψ indirect N r i i r i x i i = 1

(108b) Cosine-sampling of hemisphere

()Ψ (), Ψ ⁄ π p = cos nx (cosine sampling of hemisphere, see 35)

N π 〈〉L ()x → Θ = ---- ∑ L ()rx()Ψ, Ψ → – f ()x, Ψ ↔ Θ indirect N r i i r i i = 1

(108c) BRDF-sampling of hemisphere

f ()x, ΨΘ↔ p()Ψ = ------r --- (), ΨΘ↔ ω ∫ fr x d Ψ Ω x

Pixel-driven Path Tracing Algorithms 56 (), ΨΘ↔ ω ∫ fr x d Ψ N Ω 〈〉L ()x → Θ = ------x ∑ L ()rx()Ψ, Ψ → – cos()n , Ψ indirect N r i i x i i = 1

For a general BRDF, the appropriate sampling function might be very difficult to construct. Rejection sampling can be used (see 8), but might yield very high variance, especially when the BRDF has a narrow peak.

(108d) Multiple light sources, BRDF.cosine-sampling of hemisphere

f ()x, ΨΘ↔ cos()n , Ψ p()Ψ = ------r x ---- (), ΨΘ↔ (), Ψ ω ∫ fr x cos nx d Ψ Ω x

(), ΨΘ↔ (), Ψ ω ∫ fr x cos nx d Ψ N Ω 〈〉L ()x → Θ = ------x - ∑ L ()rx()Ψ, Ψ → – indirect N r i i i = 1

For a general BRDF, the appropriate sampling function might be very difficult to construct. Rejection sampling can be used (see 8), but might yield very high variance, especially when the BRDF has a narrow peak.

(109) End of recursion - Russian Roulette

Russian Roulette is a technique that can be used to ends recursive evaluation, but still keeps the final result unbi- ased. For any (recursive) expression A to be evaluated, use the following procedure:

Pick value α ∈ []01, , and generate uniform random number r ∈ []01, :

≤ α 〈〉 A if r : A = α--- if r > α: 〈〉A = 0

[]α〈〉 ⋅ A ()α ⋅ Expected value: E A ==α--- + 1 – 0 A

Global illumination context: when recursively tracing rays, Russian Roulette can be used to stop the recursion. Any value for α can be used, but a popular choice is the directional-hemispherical reflectance (64) of the sur- face point where the reflection is being considered.

Another variant of looking at RR is by rescaling the function to be integrated, such that part of the integration domain yields 0 , and thereby effectively stopping any further evaluations. E.g. computation of the one-dimensional integral

1 α () 1 x I ==∫fxdx ∫ α--- fα--- dx 0 0

Using pdf px() :

Pixel-driven Path Tracing Algorithms 57 fx()⁄ α ≤ α 〈〉 i if xi : I = ------α ⋅ ()--- pxi > α 〈〉 if xi : I = 0

Graphical representation: fx()⁄ α fx() ------α -

=

x x 0 1 0 α 1

C. LIGHT TRACING

Light tracing is the dual algorithm of ray tracing. Instead of shooting rays from the eye through a pixel, and working towards the light source, light tracing shoots rays from the light sources, and works towards the pixels.

References: R9, R10, R11, R12 Principle:

light source

light particle random walk

contributions to pixels

Variants:

a. If the eye is a surface, one could just let the light particles bounce around the scene till they hit the eye surface. A contribution to the relevant pixel is then recorded. This would be the dual of stochastic ray tracing without shadow rays.

b. All hit points of all light particles can be stored in the scene. When the camera moves, the hit points can be reprojected to new camera view. This requires a re-evaluation of the BRDF at the reprojected hit points. This could be combined with any visibility determination scheme used in reprojection algorithms, or even using the original geometry.

D. BIDIRECTIONAL TRACING

Bidirectional ray tracing constructs paths from the light sources and the eye simultaneously, and employs a meet-in- the-middle strategy for the paths generated. Ray tracing and light tracing can be considered to be special cases of bidi- rectional tracing.

Pixel-driven Path Tracing Algorithms 58 References: R22, R24, R42 Principle:

light source

light path (random walk)

possible contributions

eye path (random walk)

If the light paths are of length 0 (only a random point on the light source is generated), bidirectional tracing behaves as stochastic ray tracing. If the eye path is of length 0, bidirectional tracing becomes identical to light tracing.

Pixel-driven Path Tracing Algorithms 59 XIV. Multipass Algorithms

Multipass algorithms denote a class of algorithms that combine several global illumination passes into a single solu- tion. Different passes are selected to compute subsets of all light paths. Clever combinations of different passes have been the subject of many global illumination papers. Often, one or more passes are used to store partial illumination information in the scene, which is then read out by a subsequent pass.

To classify the different types of lightpaths, regular expressions can be used based on Heckbert’s notation (R19). See also (R38).

, , DDr Dt : diffuse reflection, transmission , , GGr Gt : glossy reflection, transmission ,, SSr St : specular reflection, transmission X : ()DSG E : the eye L : a light source * : zero or more occurences + : one or more occurences | : “or” A. PHOTON MAPPING

Photon mapping traces light particles or photons through the scenes, and stores all possible hits of the random walks. During a subsequent stochastic ray tracing pass, information from the stored photons is used to compute several light- ing illumination components.

References: R20

Multipass Algorithms 60 XV. Test Scenes for Global Illumination

(110) Mother of all test scenes

Data for the original Cornell Box can be found at:

http://www.graphics.cornell.edu/online/box/

(111) Analytic Solution - General Rendering Equation

∀(), Θ ()→ Θ ω (), ΨΘ↔ (), Ψ If x : Le x + ∫ d Ψfr x cos nx = 1 and if the environment is closed, then: Ω x

()→ Θ ≡ ()→ Θ ()→ Θ ω ()← Ψ (), ΨΘ↔ (), Ψ Lx 1 is the solution for L x = Le x + ∫ d ΨLx fr x cos nx (72). Ω x

∀(), Θ ()ρ→ Θ For diffuse surfaces: x : Le x + d = 1

In other words, every surface point emits exactly the amount of energy that is absorbed at the point.

(112) Analytic Solution - Radiosity System

∀ ρ if patches i: Pei + i = 1 and if the environment is closed, then:

∀ ρ i: Pi = 1 is the solution for the linear system Pi = Pei + i∑Fji→ Pj (93). j

(113) Testing global illumination algorithms

Brian Smits and Henrik Jensen have proposed a number of simple and elegant scenes to test light transport modes (R36), available at the following URL: http://www.cs.utah.edu/~bes/papers/scenes/.

A number of scenes, designed to test performance and overall image appearance, made available by Greg Ward Larson and Peter Shirley are available from the RADIANCE website: http://radsite.lbl.gov/mgf/.

Andrew Willmott and Paul Heckbert have designed parametrized test scenes for diffuse global illumination (radiosity), so that algorithms' sensitivity to various parameters, such as reflectance or scene complexity, can be tested. They also described a scheme for making comparisons that normalizes for differences in error and time. All information can be found at the following URL: http://www.cs.cmu.edu/~radiosity/.

(114) Testing ray tracing performance

The classic Standard Procedural Database (R17), designed by Eric Haines to test the performance of classic ray tracers, is available from: http://www.acm.org/tog/resources/SPD/overview.html.

(115) Testing animated ray tracing

Jonas Lext, Ulf Assarsson, and Tomas Möller have designed a number of scenes to test animated ray tracing. http://www.ce.chalmers.se/BART/.

Test Scenes for Global Illumination 61 XVI. Color & Display1

(116) Spectrum C()λ to CIE XYZ

Color matching functions x()λ , y()λ , z()λ 2 1.8 z()λ 1.6

1.4

1.2 ()λ y()λ x 1

0.8

0.6

0.4

0.2

0 380 430 480 530 580 630 680 730 780 λ

780nm 780nm 780nm X = ∫ C()λ x()λλ d YC= ∫ ()λ y()λλ d ZC= ∫ ()λ z()λλ d 380nm 380nm 380nm

X Y Z x = ------y = ------z = ------XYZ++ XYZ++ XY++Z

(117) xyY to XYZ

x ()1 – x – y X = Y-- YY= ZY= ------y y

(118) CIE XYZ to Spectrum C()λ

()λ ()λ ()λ Choose 3 linearly independent functions F1 , F2 and F3 . ()λ ()λ ()λ ()λ C can be writtten as aF1 ++bF2 cF3 with a , b , c determined by:

()λ ()λλ ()λ ()λλ ()λ ()λλ ∫F1 x d ∫F2 x d ∫F3 x d X a = ()λ ()λλ ()λ ()λλ ()λ ()λλ Y ∫F1 y d ∫F2 y d ∫F3 y d b Z c ()λ ()λλ ()λ ()λλ ()λ ()λλ ∫F1 z d ∫F2 z d ∫F3 z d

See also R15.

1. A good source for color data: http://cvision.ucsd.edu/basicindex.htm 2. Tabular data for the color matching curves can be found in R16, p. 1170.

Color & Display 62 λ λ λ E.g. 1: Dirac-impulse functions at wavelengths u , v and w .

()λ ()λ ()λ X x u x v x w a ()λ ()λ ()λ Y = y u y v y w b Z ()λ ()λ ()λ c z u z v z w

[]λ , λ [], E.g. 2: First three Fourier basis functions defined on interval min max = 380 780 ()λ F1 = 1.0 1λ – 380 F ()λ = --- 12+ sin π------2 2400 1λ – 380 F ()λ = --- 12+ cos π------3 2400

(119) CIE XYZ to/from NTSC standard RGB based on standard CIE phospors and D6500 white point.

Scaling is such that RGB=[1,1,1] produces the chromaticity values of the white point with Y=1.0 (R16, p.104).

xy r 0.670 0.330 g 0.210 0.710 b 0.140 0.080 w 0.313 0.329

X 0.5893 0.1789 0.1831 R Y = 0.2904 0.6051 0.1045 G Z 0.0000 0.0684 1.0202 B

R 1.967– 0.548 –0.297 X G = –0.955 1.938– 0.027 Y B 0.064– 0.130 0.982 Z

* * * (120) CIE XYZ to/from L u v color space

(),, Defined w.r.t. white point Xn Yn Zn , usually scaled such that Yn = 100 .

4X u' = ------X ++Y Z 13⁄ 15 3 YY⁄ ≥ ()YY⁄ – * n 0.008856 116 n 16 9Y L =  v' = ------ ⁄ ≤ ()⁄ YYn 0.008856 903.3 YYn X ++15Y 3Z where 4X * *() n u = 13L u' – u'n u'n = ------Xn ++15Yn 3Zn * * v = 13L ()v' – v' n 9Yn v'n = ------Xn ++15Yn 3Zn

Color & Display 63 * A u X = –--- + 3Z Q = ------+ u' R * n 13L * 3 L + 16 * Y = Y ------where v n116 R = ------+ v' * n ()Q – 4 A – 15QRY 13L Z = ------12R A = 3Y()5R – 3

* * * (121) CIE XYZ to/from L a b color space

(),, Defined w.r.t. white point Xn Yn Zn , usually scaled such that Yn = 100 .

⁄ ≥ ()⁄ 13⁄ * YY 0.008856 116 YY – 16 L =  n n YY⁄ ≤ 0.008856 903.3()YY⁄ 13⁄ n n r ≥ 0.008856 r where f()r =  * *()()⁄ ()⁄  ≤ ⁄ a = 500L fX Xn – fY Yn r 0.008856 7.787r + 16 116 * *()()⁄ ()⁄ b = 200L fY Yn – fZ Zn

* 3 Y 13⁄ a X = X ----- + ------n  * Yn 500L * 3 L + 16 Y = Y ------n116 * 3 Y 13⁄ b Z = Z ----- + ------n  * Yn 200L

Color & Display 64 Index

B dielectrics...... 29 barycentric coordinates...... 12 bidirectional tracing...... 58 G BRDF...... 31 Gauss-Seidel iteration...... 48 biconical reflectance...... 31 geometric transformations ...... 10 Cook-Torrance...... 34 energy conservation...... 31 Lafortune model ...... 36 H lambertian diffuse reflection...... 31 measurements ...... 36 Halton sequence...... 24 Phong - Blinn model...... 34 Hammersley sequence ...... 24 Phong model...... 32 hemisphere reciprocity...... 31 random direction in spherical triangle ...... 21 Ward model ...... 35 random direction proportional to cosine lobe...... 20 random direction proportional to cosine-weighted solid angle 19 C random direction proportional to off-normal cosine lobe.. 21 random direction proportional to solid angle...... 19 CDF see probability distribution function color and display ...... 62 I color conversion CIE XYZ to spectrum...... 62 importance function...... 39 CIE XYZ to/from Lab ...... 64 irradiance ...... 25 CIE XYZ to/from Luv...... 63 CIE XYZ to/from NTSC ...... 63 spectrum to CIE XYZ...... 62 K xyY to XYZ...... 62 kronecker d ...... 6 coordinate transformations...... 11 Cornell box...... 61 cosine lobes L integrate over hemisphere...... 17 light tracing...... 58 integrate over spherical digons...... 17 M D member function...... 10 diffuse emitter...... 26 monte carlo dirac-impulse...... 6 combined estimators ...... 23 hemisphere...... 18 combined estimators, balance heuristic ...... 23 direct illumination estimator ...... 22 multiple light sources ...... 51 estimator efficiency...... 24 rendering equation...... 37 importance sampling...... 22 shadow rays ...... 50 integration...... 22 single light source...... 50 stratified sampling ...... 23 disk multipass algorithms...... 60 concentric map ...... 13 polar map...... 13 random point...... 12 N dual light transport...... 39 next event estimation ...... 56

E P extinction coefficient participating medium...... 38 clustering ...... 49 no scattering...... 39 PDF see probability density function F photometric units ...... 25 final gather step ...... 49 photon mapping ...... 60 flux...... 25 potential function...... 39 form factor...... 41 probability density function...... 7 fresnel reflection probability distribution function ...... 7 conductors ...... 29

Index 65 Q global illumination...... 61 ray tracing performance...... 61 quasi-random sampling sequences ...... 24 total internal refraction ...... 29 triangle barycentric coordinates...... 12 R random point...... 12 radiance ...... 26 surface area ...... 11 invariant along straight lines...... 26 radiant energy ...... 25 radiant intensity ...... 25 V radiometric units...... 25 Van der Corput sequence ...... 24 convert to photometric units...... 27 visibility radiosity member function...... 10 algorithms...... 46 ray casting function...... 9 clustering ...... 49 visibility function...... 9 continuous transport equation ...... 38 visibility function...... 9 final gather step ...... 49 radiosity equation discretizing ...... 46 random point disk ...... 12 sphere...... 19 triangle...... 12 random variable expected value ...... 7 generate using inverse CDF...... 7 generate using rejection sampling ...... 8 variance...... 7 ray casting function ...... 9 ray tracing...... 55 next event estimation...... 56 russian roulette ...... 57 stochastic ...... 55 ray-object intersection ...... 10 reflection at perfect mirror ...... 28 vector computation...... 28 refraction ...... 28 refraction data...... 30 relaxation algorithm ...... 47 rendering equation...... 37 area integration...... 37 direct illumination ...... 37 hemisphere integration ...... 37 participating medium...... 38 russian roulette ...... 57

S solid angle...... 15 differential ...... 15 subtended by polygon...... 16 subtended by surface ...... 16 transformation to surface...... 16 visible subtended by surface...... 16 spectral luminous efficiency curve ...... 27 sphere random point...... 19 spherical coordinates ...... 15 stochastic ray tracing...... 55

T tangent-sphere function ...... 17 test scenes...... 61 analytic solutions...... 61 animated ray tracing ...... 61 Cornell box...... 61

Index 66 References

Abbreviations:

SIGGRAPH xx: Proceedings of SIGGRAPH conference held in 19xx EGWR xx: Proceedings of the Eurographics Workshop on Rendering held in 19xx EG xx: Proceedings of the Eurographics conference held in 19xx

[1] Arvo J.; Stratified Sampling of Spherical Triangles; SIGGRAPH 95 [2] Arvo J.; Applications of Irradiance Tensors to the Simulation of Non-Lambertian Phenomena; SIGGRAPH 95 [3] Baum D., Rushmeier H., Winget J.; Improving Radiosity Solutions Through the Use of Analytically Determined Form-Fac- tors; SIGGRAPH 89 [4] Bekaert Ph., Dutré Ph., Willems Y.; Final Radiosity Gather Step using a Monte Carlo Technique with Optimal Importance Sampling; Report CW275, January 1996, Dept. of Computer Science, Katholieke Universiteit Leuven. [5] Bekaert Ph.; Hierarchical and Stochastic Algorithms for Radiosity; Ph.D. Thesis, Katholieke Universiteit Leuven, 1999 http://www.cs.kuleuven.ac.be/cwis/research/graphics/CGRG.PUBLICATIONS/PHBPHD/ [6] Carvalho, P., Cavalcanti, P.; Point in Polyhedron Testing Using Spherical Polygons; Graphics Gems V, p. 42-49 [7] Cohen M., Wallace J.; Radiosity and Realistic Image Synthesis; Academic Press [8] Cook R.L., Torrance K.E.; A reflectance model for computer graphics; Computer Graphics, Vol. 15, No. 3, 1981, pp. 307- 316 (SIGGRAPH 81) [9] Dutré Ph., Lafortune E., Willems Y.; Monte Carlo Light Tracing with Direct Computation of Pixel Intensities; Proceedings of CompuGraphics, pp. 128-137, Alvor, Portugal, December 1993 [10] Dutré Ph., Willems Y.; Importance-driven Light Tracing; EGWR 94 [11] Dutré Ph., Willems Y.; Potential-driven Monte Carlo Particle Tracing for Diffuse Environments with Adaptive Probability Functions; EGWR 95 [12] Dutré Ph.; Mathematical Frameworks and Monte Carlo Algorithms for Global Illumination in Computer Graphics; Ph.D. Thesis, Katholieke Universiteit Leuven, 1996. http://www.cs.kuleuven.ac.be/~graphics/CGRG.PUBLICATIONS/PHDPHD/ [13] Dutré Ph., Bekaert Ph., Bala K.; Advanced Global Illumination; A K Peters 2003 http://www.advancedglobalillumination.com/ [14] Fishman G.S.; Monte Carlo: Concepts, Algorithms and Applications; Springer-Verlag, 1996 [15] Glassner A.; How to Derive a Spectrum from an RGB Triplet; IEEE CG&A, 9(4):95-99, July 1989 [16] Glassner A.; Principles of Digital Image Synthesis; Morgan Kaufmann [17] Haines, E. A Proposal for Standard Graphics Environments; IEEE Computer Graphics and Applications, vol. 7, no. 11, November 1987, pp. 3-5 [18] Hammersley J.M., Handscomb D.C.; Monte Carlo Methods; Chapman and Hall, London, 1964 [19] Heckbert P.; Adaptive radiosity textures for bidirectional ray tracing, SIGGRAPH 90. [20] Jensen H.W.; Realistic Image Synthesis using Photon Mapping; AK Peters, 2001 [21] Kalos M.H., Whitlock P.A.; Monte Carlo Methods; Wiley-Interscience, New York, 1986 [22] Lafortune E.P., Willems Y.D.; Bi-directional Path Tracing; Proceedings of CompuGraphics, pp. 145-153, Alvor, Portugal, December 1993 [23] Lafortune E.P., Willems Y.D.; Using the Modified Phong Reflectance Model for Physically Based Rendering; Report CW 197, November 1994, Department of Computer Science, Katholieke Universiteit Leuven. [24] Lafortune E.; Mathematical Models and Monte Carlo Algorithms for Physically Based Rendering; Ph.D. Thesis, Katho- lieke Universiteit Leuven, 1996. [25] Lafortune E., Foo S., Torrance K., Greenberg D.; Non-Linear Approximation of Reflectance Functions; SIGGRAPH 97 [26] Lewis R.; Making Shaders More Physically Plausible; Computer Graphics Forum, 13 (2), 1994 (also in EGWR 93) [27] Miller, Robert D.; Computing the Area of a Spherical Polygon; Graphics Gems IV, p. 132-137

67 [28] Sbert M.; The use of global random directions to compute radiosity - Global Monte Carlo techniques. Universitat Politèc- nica de Catalunya, Barcelona, Spain, 1997. http://ima.udg.es/~mateu/ [29] Schröder P., Hanrahan P.; On the Form Factor between Two Polygons; SIGGRAPH 93 [30] Shirley P., Wang C., Zimmerman K.; Monte Carlo Techniques for Direct Lighting Calculations; ACM Transactions on Graphics, Vol. 15,1, January 1996. [31] Shirley P.; Realistic Ray Tracing; A.K.Peters 2000 [32] Siegel R., Howell J.R.; Thermal Radiation Heat Transfer; Hemisphere Publishing Corporation [33] Sillion F. and Puech C.; Radiosity & Global Illumination; Morgan-Kaufmann [34] Sillion F., Drettakis G., Soler C.; A Clustering Algorithm for Radiance Calculation in General Environments; EGWR 95 [35] Sillion F.; A Unified Hierarchical Algorithm for Global Illumination with Scattering Volumes and Object Clusters; IEEE Transactions on Vizualizations and Computer Graphics, 1(3), September 1995 (also in EGWR 94) [36] Smits, B. and Jensen, H. W.; Global Illumination Test Scenes; Tech. Rep. UUCS-00-013, Computer Science Department, University of Utah, June 2000 [37] Spanier J., Gelbard E.M.; Monte Carlo Principles and Neutron Transport Problems; Addison-Wesley, 1969 [38] Suykens F., Willems Y.; Weighted Multipass Methods for Global Illumination; EG 99. [39] Tobler R., Neumann L., Sbert M., Purgathofer W.; A New Form Factor Analogy and its Application to Stochastic Global Illumination Algorithms, EGWR 98 [40] Turk G.; Generating Random Points in Triangles; Graphics Gems I, p.24 [41] Ureña C., Torres J.; Improved Irradiance Computation by Importance Sampling; EGWR 97 [42] Veach E., Guibas L.; Bidirectional Estimators for Light Transport; EGWR 95 [43] Veach E., L. Guibas L.; Optimally Combining Sampling Techniques for Monte Carlo Rendering; SIGGRAPH 95 [44] Veach E.; Robust Monte Carlo Methods for Light Transport Simulation; Ph.D. Dissertation, Stanford University, December 1997. [45] Ward G.; Adaptive Shadow Testing for Ray Tracing; Photorealistic Rendering in Computer Graphics. P. Brunet and F.W. Jansen, eds. Springer-Verlag (EGWR 91) [46] Ward G.; Measuring and Modeling Anisotropic Reflection; SIGGRAPH 92 [47] Whitted T.; An improved illumination model for shaded display; Communications of the ACM, 23(6):343-349, June 1980 [48] Zimmerman K., Shirley P.; A Two-pass Solution to the Rendering Equation with a Source Visibility Preprocess; EGWR 95

68