Professional Documents
Culture Documents
Gi Total Compendium
Gi Total Compendium
This collection of formulas and equations is supposed to be useful for anyone who is active in the field of global illumination 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. Therefore, 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 derivations. 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
Table of Contents
I.
General Mathematics
II.
Probability
III. Geometry
A. Geometric Transformations
10
B. Triangles
11
C. Disks
12
(19) Generate random point on unit disk with probability density ...................................................................................... 12
(19a) Polar map .................................................................................................................................................................. 13
(19b) Concentric map......................................................................................................................................................... 13
15
15
18
V.
22
25
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
31
31
B. BRDF models
32
C. BRDF Measurements
36
37
37
39
X.
Form Factors
A. General Expressions and Properties
Table of Contents
41
41
3
43
46
49
50
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. Ray Tracing
55
C. Light Tracing
D. Bidirectional Tracing
58
58
60
60
61
62
Table of Contents
I. General Mathematics
(1)
Dirac-impulse (-function)
( x ) = 0 if x 0
( a x )f ( x ) dx = f ( a ) if a D
Notation: ( a x ) = a ( x )
(2)
Kronecker
ij = 1 if i = j
ij = 0 if i j
General Mathematics
II. Probability
(3)
p ( x ) dx
x: p ( x ) 0
= 1
D
b
p ( x ) dx
a
(4)
P(x) =
p ( x ) dx
0 = P ( ) P ( x ) P ( ) = 1
(5)
E[x] =
xp ( x ) dx
E[f(x )] =
(6)
f ( x )p ( x ) dx
[ f( x )] = E[ (f (x ) E[ f( x) ] ) ]
2
[ f( x )] = E[f (x ) ] E[ f( x )]
(7)
x
Probability
r1
P ( r1 ) P ( r2 )
x
7
(8)
x
accept
More general:
construct a pdf q ( x ) such that x: p ( x ) Mq ( x ) .
Generate a random sample x' according to q ( x ) .
Generate a uniform random number r, 0 r 1 .
If r p ( x' ) Mq ( x' ) accept sample x' , otherwise reject and try again.
Probability
III. Geometry
Notations:
nx
dA x
nx
xy
Union of all surfaces in the scene, also used for total surface area of all
surfaces in the scene.
Ap
(9)
surface
x
dAx
surface
r ( x, )
x
if y = r ( x, ) and x A
x = r ( y, ) or x = r ( r ( x, ), )
surface
y = r ( x, )
surface
x = r ( y, )
Visibility function
1
x, y A : V ( x, y ) =
0
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
(11)
Member function
1
x A, j A p : M ( x, j ) =
0
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)
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 graphics.
A right-handed coordinate system is assumed.
(13)
Translation
Translate a point x by translation vector d : x' = T ( d ) x
1
0 dx
0 dy
0 0 1 dz
1 dz
0 0 0 1
1 0 0 dx
T( d ) =
(14)
0 1 0 dy
T (d) =
Rotation
Rotate point x around the X -axis by angle : x' = R x ( ) x
Rx ( ) =
1
0
0
0
0
0
cos sin
sin cos
0
0
0
0
0
1
1
Rx ( )
1
0
0
0
0
0
cos sin
sin cos
0
0
0
0
0
1
sin
0
cos
0
0
0
0
1
0
0
1
0
0
0
0
1
0
1
0
0
sin
0
cos
0
0
0
0
1
1
Ry ( )
cos
0
sin
0
0
1
0
0
Rz ( ) =
Geometry
cos sin
sin cos
0
0
0
0
0
0
1
0
0
0
0
1
1
Rz ( )
cos sin
sin cos
=
0
0
0
0
10
Rotation such that basis vectors (x,y,z) become orthonormal vectors (u,v,w):
u x vx wx 0
R ( uvw ) =
(15)
u x uy u z 0
u y vy wy 0
R ( uvw ) =
vx vy vz 0
uz vz wz 0
w x wy w z 0
0 0 0 1
0 0 0 1
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 coordinate system 1.
o xyz : Canonical coordinate system
p uvw : Coordinate system with origin in p , and orthonormal axes uvw (expressed in OXYZ).
q o xyz : point q expressed in o xyz
q p uvw : point q expressed in p uvw
q p uvw = M ( p uvw )q o xyz
M ( p uvw ) = R ( uvw )T ( p ) =
ux uy uz 0
0 px
vx vy vz 0
0 py
wx wy wz 0
1 p z
0 0 0 1
M ( p uvw ) = T ( p )R ( uvw ) =
0 1 0 py uy v y w y 0
ux vx w x p x
=
uy vy w y p y
0 0 1 p z u z vz wz 0
uz vz wz pz
0 0 0 1
0 0 0 1
0 0 0 1
B. TRIANGLES
(16)
Geometry
11
(17)
0<<1
p is inside triangle if and only if 0 < < 1
l b'
0<<1
Aa
l a l a'
= ------ = -----------------------------------------A
l a l a ' + l b l b ' + l c l c'
Ab
Aa
lb
la
p
Ab
l b l b'
Also: = ------ = -----------------------------------------A
l a l a ' + l b l b ' + l c l c'
l a'
lc
l c'
Ac
l c l c'
Ac
= ------ = -----------------------------------------l a l a' + l b l b' + l c l c'
A
( A is total area of triangle)
(18)
C. DISKS
(19)
r
= 0
Geometry
12
= 0
r1
r 1 and r 2 are random numbers, both uniformly generated over the interval [ 0, 1 ]
r =
r1
= 2r 2
(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 implementation.
r2
= 0
r1
r2
r1
= 0
r 1 and r 2 are random numbers, both uniformly generated over the interval [ 1, 1 ] (This can easily be transformed from random numbers in the interval [ 0, 1 ] ).
1st triangular region ( r 1 > r 2 and r 1 > r 2 ):
r = r1
r2
= --- ---4 r1
1. Pictures in this section of the Compendium are based on the pictures in this book.
Geometry
13
= --- 2 ----
4
r 2
3rd triangular region ( r 1 < r 2 and r 1 < r 2 ):
r = r 1
r2
= --- 4 + ----
4
r 1
4th triangular region ( r 1 > r 2 and r 1 < r 2 ):
r = r 2
r1
= --- 6 ----
4
r 2
Geometry
14
nx
A
= ---2
r
direction = ( , )
[ 0, 2 ]
direction
solid angle d
[ 0, 2 ]
x = r cos sin
y = r sin sin
z = r cos
r =
x
2
x +y +z
tan = y x
2
X
2
x +y
tan = --------------------z
2
f ( )d
(23)
f ( , ) sin dd
(, c) parametrisation of hemisphere
=
Apply coordinate transform:
:
c = 1 cos
2 2
f ( )d
2 1
f ( , ) sin dd =
f ( , c )dcd
0 0
Hemispherical Geometry
15
(24)
1 = sin2
Apply coordinate transform:
2 = -----2
f ( )d
11
f ( , ) sin dd =
f ( 1, 2 )
--------------------2- d 1 d 2
00
1 1
Equally sized areas in ( 1, 2 ) space translate to equally sized, cosine-weighted solid angles.
(25)
ny
dAy
rxy
solid angle d
direction
x
(26)
cos y
- dA y
------------r2
Aj
y dAy
ny
xy
y
rxy
x ( j )
x
(27)
x ( j ) =
cos y
- V ( x, y )dA y
------------r2
Aj
(28)
xy
i ( n 2 )
i
with:
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 n x at a surface point x , but only if the direction is located at the same side
of the surface of n x . If is below the surface, the value is 0 . Some authors (R34) introduce the tangentsphere function for this purpose:
nx
Tnx ( ) =
0
if n x 0
otherwise
Useful integrals (cosine lobes) over the hemisphere (see also 33, 34, 35 and 36)
2
d
0
sin d = 2
0
2
cos ( , nx )d
d
0
2
cosn ( , nx ) d
cos sin d =
0
2
d
0
2
cosn sin d = -----------n+1
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 ]
2
cosn ( ,
n x ) d =
(31)
(31a)
d cosn sin d
0
nx
2
= ------------ ( 1 cosn + 1 max )
n+1
max
cosn ( , m ) cos ( , nx )d
nx
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
cosn ( , m ) d
(31b)
An expression can be derived from the same paper (although this form is not explicitly mentioned):
n even:
cosn ( , m ) d
n odd:
m = acos ( m n x )
where:
(32)
n1
F n = ------------ F
n n2
F0 =
F1 = 2
( 1 )f ( )d
d ( 1 )
0
2
d ( 1 )f ( , 1 )
= f ( 1, 1 ) = f ( 1 )
18
(33)
1
Generate random point on sphere ( c x, c y, c z, R ) with density p ( ) = ------------2
4R
x = c x + 2R cos ( 2r 1 ) r 2 ( 1 r 2 )
= 2r 1
y = c y + 2R sin ( 2r 1 ) r 2 ( 1 r 2 )
= acos ( 1 2r 2 )
(34)
z = c z + R ( 1 2r 2 )
= 2r 1
= acos ( r 2 )
x = cos ( 2r 1 ) 1 r 2
2
y = sin ( 2r 1 ) 1 r 2
z = r2
nx
1
With [ 0, max ] and p ( ) = ----------------------------------------- :
2 ( 1 cos max )
max
= 2r 1
= acos ( 1 r 2 ( 1 cos max ) )
z = 1 r 2 ( 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, r d )
2
x = cos d r d 2 r d
= d
Resulting point on hemisphere:
= acos ( 1 r d )
or y = sin r 2 r 2
d d
d
2
z = 1 rd
(35)
Hemispherical Geometry
19
x = cos ( 2r 1 ) 1 r 2
= 2r 1
= acos ( r 2 )
y = sin ( 2r 1 ) 1 r 2
z =
r2
cos
With [ 0, max ] and p ( ) = ------------------------- sin2 max
x = cos ( 2r 1 ) sin max r 2
= 2r 1
1 r 2 sin2 max
z =
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.
Point on disk: ( d, r d )
= d
= asin ( r d )
x = r d cos d
or y = r d sin d
z =
(36)
1 rd
Generate random direction on unit hemisphere proportional to cosine lobe around normal
n+1
PDF: p ( ) = ------------ cosn
2
= 2r 1
x = cos ( 2r 1 ) 1
2
-----------n+1
r2
y = sin ( 2r 1 ) 1
2
-----------n+1
r2
----------n + 1
= acos r 2
z =
1
-----------n+1
r2
( n + 1 ) cosn
With [ 0, max ] and p ( ) = --------------------------------------------------2 ( 1 cosn + 1 max )
= 2r 1
x = cos ( 2r 1 ) 1 ( 1 r 2 ( 1
cosn + 1
y = sin ( 2r 1 ) 1 ( 1 r 2 ( 1
cosn + 1
max ) )
------------
n+1
= acos ( 1 r 2 ( 1 cosn + 1 max ) )
z = ( 1 r2 ( 1
cosn + 1
max ) )
max ) )
2
-----------n+1
2
-----------n+1
1
-----------n+1
Hemispherical Geometry
20
(37)
(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
Estimator is consistent if: Prob lim F ( N ) = Q = 1 . A sufficient condition for an estimator to be unbiased
N
(40)
Basic MC integration
I =
f ( x ) dx
D
D = [ 1 1 ] [ 2 2 ] [ d d ]
( i, i )
i = 1
1
I = ---- f ( xi )
N
i=1
( i i )
i = 1
E [ I ] =
f ( x ) dx (unbiased estimator)
D
1
1
2
2
2
2
- ( f ( x ) I ) dx = -------------------------------------- f ( x ) dx I
[ I ] = -------------------------------------d
d
D
D
N ( i i )
N ( i i )
i=1
(41)
i=1
1
I = ---N
f ( xi )
----------p (xi )
i=1
E [ I ] =
f ( x ) dx
D
2
2
2
2
1 f(x)
1 f(x)
[ I ] = ---- ---------- I p ( x ) dx = ---- ------------ dx I
N p(x )
N p( x)
22
f ( x ) dx
m 1
f ( x ) dx + f ( x ) dx + ... +
f ( x ) dx +
m 2
f ( x ) dx
m 1
j=1
( j j 1 )
---------------------------nj
2
1
f ( x ) dx ---n-j f ( x ) dx
j = 1 j 1
j 1
If all strata have equal size, and each stratum contains one sample:
2
2
2
1
= ---- f ( x ) dx f ( x ) dx
N
j = 1 j 1
0
(43)
Combined estimators
Nj
I =
j=1
1
----Nj
f ( x i, j )
wj ( xi, j ) ---------------p j ( x i, j )
i=1
If
wj( x )
j=1
(see R43)
(44)
j j
N j D
j
23
One sample model ( N = 1 ): if p j is cosen with probability c j , then the balance heuristic gives the lowest
variance.
(45)
Quasi-random sequences
aj b
j=0
aj b
b ( i ) =
j1
j=0
24
Photometry
Joule
Radiant Energy Q
Luminous Energy
Talbot
Watt
Radiant Power
Luminous Power
Lumen (lm)
Watt/m2
Luminosity
Illuminance
Lux (lm/m2)
Watt/sr
Radiant Intensity
Luminous Intensity
Watt/m2sr
Radiance
Luminance
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 perfect radiator of energy) at the temperature of freezing platinum (2042 K) and a pressure of 1 atmosphere. This definition 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 radiate 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)
(50)
25
(51)
Radiance: flux per solid angle per unit projected area (Watt/m2sr)
2
dE
d
d
L = ------- = ------------------ = --------------------------
d
ddA cos
ddA
(51a) Notations:
L ( x ) : radiance leaving point x in direction
L ( x ) : radiance arriving at point x from direction
L ( x y ) : radiance leaving point x, arriving at point y
L ( x y ) : radiance arriving at point x, coming from point y
(51b) Wavelength Dependency:
780nm
L( x ) =
L ( x , ) d
380nm
Proof: consider power exchange d between 2 differential surfaces dA x and dAy . Power d arriving at
dAy from dAx must equal power leaving dA x in the direction of dAy (full proof see R13 p.24).
(51d) Integration: specify integration domain if specific values are needed
=
L ( x ) cos d dAx
E(x ) =
L ( x ) cos d
B(x ) =
L ( x ) cos d
I( ) =
L ( x ) cos dAx
E ( x )dAx
I ( )d
For a diffuse emitter ( L ( x ) = L ) with surface area A and hemispherical solid angle ( 2 sr):
= LA
E ( x ) = L
B ( x ) = L
I ( ) = LA cos
Radiometry & Photometry
26
(52)
0.6
0.4
0.2
0
380
430
480
530
580
630
680
730
780
( nm )
770nm
P = Km
V ( )R ( ) d
K m = 680lumen/watt
380nm
Tabular data for the spectral luminous efficiency curve can be found in R16, p. 1170.
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 n x , reflection vector r ): r = 2 ( n x i ) i
2 ( nx i )
nx
i
r
i
x
(54)
1
sin g = --n
0 < r < g
i
for small angles: ----- = n (Keplers formula)
r
(55)
sin i
1
------------- = --sin r
n
i
1
for small angles: ----- = --r
n
i
g
(56)
i
n1
n2
r
Optics
28
(57)
(58)
n1
t = i
n2
n2
Material 1 to material 2; relative index of refraction ----- = + j ; is angle of incidence. The Fresnel
n1
coefficients express the directional-hemispherical spectral specular reflectivity.
2
a + b 2a cos + cos2
F s = --------------------------------------------------------------2
2
a + b + 2a cos + cos2
2
2 2
2 2
2a =
( sin2 ) + 4 + ( sin2 )
( sin2 ) + 4 ( sin2 )
2b =
Optics
29
1 2
If i = 0 , and thus r = 0 : F r = F s = F p = ------------- (also sometimes written as F 0 )
+ 1
(60)
Optics
30
dL ( x r )
dL ( x r )
BRDF: f r ( x, i r ) = ----------------------------- = ---------------------------------------------------dE ( x i )
L ( x i ) cos i d i
nx
i
r
dL ( x 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
f r ( x, i r ) = f r ( x, r i ) = f r ( x, i r )
(63)
fr ( x, ) cos ( nx, )d 1
(64)
Biconical Reflectance
in
d out
out in
----------------------------------------------------------------------------------------------------------------------- ( in out ) =
d
cos
in
in
in
in and out can be a single direction, a solid angle, or the hemisphere. Combine the words directional, conical and hemispherical to obtain the right adjective for the reflectance. E.g. Biconical reflectance; directionalhemispherical reflectance etc. (definitions from R7, p. 32).
(65)
L ( x in ) cos in d
in
= f r, d E
in
31
B
Bihemispherical reflectance: d = f r, d and 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
n x 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 ( x r, y r, z r ) . Normally, these
will assumed to be normalized.
In general, negative values for cosine-lobes are ignored and set to zero.
(66)
Modified Phong-BRDF1
f r ( i r ) = k d + k s cosn ( r, s )
or also:
d s ( n + 2 )
2
f r ( i r ) = ----- + ---------------------- cosn ( r, s ) with d = k d and s = ------------ k s
2
n+2
Energy conservation: d + s 1 . d and s are the maximum energy ( i = n x ) reflected through the diffuse
part and specular part respectively. In other words:
d =
kd cos ( nx, )d
s =
ks cosn + 1 ( nx, )d
Proportional sampling: There are various ways to sample according to the modified Phong-BRDF, using a combination 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( ) =
1. The modified Phong-BRDF is very similar to the Phong shading 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 p 1 ( ) and p 2 ( ) .
I =
= I1 + I2
I = I 1 + I 2
N1
1
= -----N1
i=1
L ( i )k d cos ( n x, i ) 1
------------------------------------------------- + -----N2
p1 ( i )
N2
i=1
L ( i )k s cosn ( i, s ) cos ( n x, i )
--------------------------------------------------------------------------------p2 ( i )
2 d
1
p 1 ( ) = ------ (see 34): I 1 = --------N1
2
N1
L ( i ) cos ( nx, i )
i=1
d
cos ( n x, )
p 1 ( ) = -------------------------- (see 35): I 1 = -----N1
N1
L ( i )
i=1
2k s
1
Uniform over hemisphere (see 34): p 2 ( ) = ------ ; I 2 = ----------N2
2
k s
cos ( n x, )
Cosine -weighted (see 35): p 2 ( ) = -------------------------- ; I2 = -------N2
N2
L ( i ) cosn ( i, s )
i=1
cosn ( , s )
Proportional to specular lobe of BRDF (see 38): p 2 ( ) = ------------------------------------------------ ;
cosn ( , s ) d
x
ks
I 2 = ------
N2
cosn ( ,
s ) d
N2
L ( i ) cos ( nx, i )
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 ( q 1, q 2, q 3 ) with q 1 + q 2 + q 3 = 1 . Then generate i using
either p 1 ( ) or p 2 ( ) .
L ( i )k d cos ( n x, i )
if event 1: eval ( i ) = ------------------------------------------------q1 p1 ( i )
L ( i )k s cosn ( i, s ) cos ( n x, i )
if event 2: eval ( i ) = --------------------------------------------------------------------------------q2 p2 ( 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
1
Total estimator: I = ---N
eval ( i )
i=1
1
I = ---N
i=1
d s ( n + 2 )
L ( i ) ----- + ---------------------- cosn ( i, s ) cos ( n x, i )
2
--------------------------------------------------------------------------------------------------------------------q1 p1 ( i ) + q2 p2 ( i )
Interesting choices:
1
p 1 ( ) = ------ ;
2
n+1
p 2 ( ) = ------------ cosn ( , s ) (no resampling of directions under surface, so full lobe)
2
(n + 2)
-----------------
2 d
(n + 1) s
q 1 = -------------------------------------- ; q 2 = -------------------------------------(n + 2)
(n + 2)
2 d + -----------------
2 d + -----------------
(n + 1) s
(n + 1) s
(n + 2)
2 d + -----------------
(n + 1) s
then the above estimator is written as: I = -------------------------------------N
L ( i ) cos ( nx, i )
i=1
(68)
Cook-Torrance-BRDF
(see notations page 32)
F ( ) D ( h )G
f r ( i r ) = ------------ ---------------------------
cos i cos r
34
1
D ( ) = ---------------------e
2
m cos4
tan
----------m
( m is material-parameter)
Ward-BRDF
(see notations page 32)
2
exp ( tan2 h )
d
1
a. Isotropic Gaussian Model: f r ( i r ) = ----- + s -------------------------------- -------------------------------------------2
cos cos
4
i
Normalization 1 4 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 ( r 1 ) )
= 2r 2
b. Anisotropic Elliptical Gaussian Model:
2
cos cos
i
x and y are are the standard deviation of the surface slope in the x and y direction at the tangent plane.
2
h = atan --------------------------------------------------------
2
2
cos2 x + sin2 y
x
= atan ------ tan ( 2r 2 )
y
35
(70)
Lafortune-BRDF
fr ( i r ) =
( C x , k x i x r + C y , k y i y r + C z, k z i z r )
nk
Ck ( i ) ( a r )
nk
where:
( C x, k x i, C y, k y i, C z, k z i )
a = -----------------------------------------------------------------2
2
2
2
2 2
C x, k x i + C y, k y i + C z, k z i
2
C k ( i ) = ( C x, k x i + C y, k y i +
nk
---2 2 2
C z, k z i )
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/
36
L( x ) = Le( x ) +
Le ( r ( x, ) )f r ( x, ) cos ( nx, )d
(73)
cos ( n x, ) cos ( n z, )
G ( x, z ) = -------------------------------------------------------2
xz
(many authors include V ( x, z ) in the definition of G ( x, z ) , but in this document they are kept separate for
clarity).
Direct illumination only: see 74.
(74)
Li
y
r ( x, )
x ( Li )
L( x ) = Le( x ) +
Le ( y yx )f r ( x, xy )G ( x, y )V ( x, y )dAy
i = 1 ALi
37
L( x ) = Le( x ) +
L e ( y )f r ( x, ) cos ( n x, )V ( x, y )d
i = 1 x ( L i )
L( x ) = Le( x ) +
L e ( y )f r ( x, ) cos ( n x, )d
i = 1 ( Li )
vis
x
(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:
B ( x ) = L ( x )
B e ( x ) = L e ( x )
( x ) = f r ( x )
B ( z )G ( x, z )V ( x, z )
B ( x ) = B e ( x ) + ( x ) ---------------------------------------------- dA z
(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
out-scattering: light scatters away from the direction of travel
absorption
in-scattering
emission
emission
out-scattering
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.
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
with:
s
s1
( s 1, s 2 ) = e
t s1 s2
s ( s )
s ( s )
R ( s ) = ------------ = -------------------------------- : scattering albedo of the medium
t ( s )
a ( s ) + s ( s )
(77)
t s
+ Le( 1 e
t s
39
( S ) =
L e ( x )W ( x ) cos ( , nx ) d dAx
= L e, W
with
W( x ) = We( x ) +
W ( r ( x, ) )f r ( r ( x, ), ) cos ( n r ( x, ), )d
r ( x, )
W ( x ) is dimensionless and has the same transport properties as radiance (invariant along straight lines).
40
X. Form Factors
Form Factor: the fraction of uniform diffuse radiant energy leaving one surface that is incident upon a second surface.
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 Configuration 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.
dAy
ny
cos x cos y
G ( x, y )
= ----------------------------- dA y = -----------------dAy
2
r xy
dFdA x dA y
(80)
x
dAx
r xy
F dA x j =
- V ( x, y )dA y
---------------------------2
r
xy
Aj
(81)
nx
r xy
G ( x, y )V ( x, y )
- dA y
---------------------------------
Aj
FdA
1
= -----2
nx i
i=1
nx
Vi + 1
Form Factors
41
(82)
cos x cos y
- V ( x, y )dA y dA x
---------------------------2
r
xy
Ai Aj
G ( x, y )
1
= ----- -----------------V ( x, y )dA y dA x
Ai
A i Aj
x ( j ) is subtended solid angle covering surface j as seen from x (see 26 and 27; also 9):
1
F i j = -----
Ai
1
F i j = -----
Ai
Ai x ( j )
cos x
-------------- M ( x , j )d dAx
A i vis
x (j)
(83)
cos x
-------------- d dA x
An analytic solution for this integral, given any two polygons, was derived by Schrder and Hanrahan (R29).
(84)
Fi j
= 1
(85)
nx
Form Factors
Aj
dA x
A proj
x
42
(86)
Projection on a sphere
A proj
F dA x j = ------------2
4r
nx
Aj
A proj
dA x
1
F i j = ---N
A j G ( x k, y k )V ( x k, y k )
-------------------------------------------------
k=1
1 Aj
2
[ F i j ] = ---- -----
N Ai
2
2
G ( x, y )V ( x, y )
2
---------------------------------------dA y dAx F i j
AA
i
(88)
1
F i j = ---N
cos x k x ( j )M ( x k , j )
k
-----------------------------------------------------
k=1
2
cos2 x x ( j )M ( x , j )
1
2
2
- d dA x F i j
[ F i j ] = ---- -----------------------------------------------------2
N
Ai
Ai x ( j )
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)
1
F i j = ---N
M ( xk , j )
cos x d
x ( j )
----------------------------------------------------------
k=1
2
cos x M ( x , j ) cos x d
1
2
2
x ( j )
----------------------------------------------------------------------------=
d dA x F i j
[ F i j ]
2
N
A
Ai x ( j )
vis
By using visibility culling or rejection sampling, sampling and integration can be limited to x ( j ) .
(90)
1
F i j = ---N
M ( xk
, j)
k=1
1
[ F i j ] = ---- F i j ( 1 F i j )
N
2
This sampling procedure can be used to compute all F i j simultaneously for a given i using the same set of
rays ( x k, k ) :
for all patches j: Fij = 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, )
Fij += 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 probability that a line intersects a surface is proportional to the area of that surface.
F i j is estimated by N ij N i , with N ij the number of spans connecting surface patches i and j , and N i the
number of spans starting from surface patch i .
Form Factors
45
B i = B ei + i F i j B j
j
1 1 F1 1 1 F1 2 1 F1 n
B1
2 F2 1 1 2 F2 2 2 F2 n
B2
n Fn 1
(93)
n Fn 2 1 n Fn n Bn
B e1
=
B e2
B en
P i = P ei + i F j i P j
j
1 1 F1 1 1 F2 1 1 Fn 1
P1
2 F1 2 1 2 F2 2 2 Fn 2
P2
n F1 n
(94)
n F2 n 1 n Fn n Pn
P e1
=
P e2
P en
46
Approximation of B ( x ) : B ( x ) B ( x ) =
Bi Ni ( x )
i=1
B ( z )G ( x, z )V ( x, z )
Residual (substitute B ( x ) in continuous equation): r ( x ) = B ( x ) B e ( x ) ( x ) ---------------------------------------------- dAz
r ( x ), W i ( x ) .
i=1
r ( x )Wi ( x )dAx can now be set to be zero, resulting in a linear equation for
A
each W i ( x ) .
(94a) Point Collocation
W i ( x ) = ( x xi ) (residual is zero for selected number of points x i )
N
then: i:
Kij Bj Be ( xi )
( xi )
= 0 with K ij = N j ( x i ) ------------ N j ( z )G ( x i, z )V ( x i, z )dA z
j=1
(94b) Galerkin
Wi ( x ) = Ni ( x )
N
then: i:
with K ij =
= 0
G ( x, z )V ( x, z )
-dAz dA x
Ni ( x )Nj ( x )dAx ( x )Ni ( x )Nj ( z ) --------------------------------
AA
Subsequent iterations: x
(0)
,x
(1)
,x
(2)
e1
=
a n1 a nn x n
en
,
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
Correction vectors x
Residu vectors r
(k )
(k)
:x
(k + 1)
= x
(k)
+ x
(k)
(k )
= e Ax
(k)
, and therefore r
(k + 1)
= r
(k)
Ax
(k)
Gauss-Seidel iteration
asj xj ass
js
Algorithm:
for all patches j: Pj = Pej;
cycle through patches until convergence (selected patch = s)
Ps = Pes;
for all patches j
Ps += s.Fjs.Pj;
Incremental Gauss-Seidel: compute residu vector explicitly and increment solution vector instead of replacing
previous solution.
48
A ()
t ( ) = ---------------V
Final Gathering
A final gathering step is used to make a high-quality rendering of a radiosity solution, using a per-pixel radiance 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 ) +
(hemisphere integration)
or:
L ( x ) = L e ( x ) + L ( z zx )f r ( x, zx )G ( x, z )V ( x, z )dA z (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 proportional to L ; area sampling sampling proportional to stored (linked) form factors. See (R41, R4) for an overview.
Radiosity Extensions
49
Le ( yk yk x )fr ( x, xyk )G ( x, yk )V ( x, y 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 )
x ( L )
L ( x ) = --------------N
Le ( yk k )f r ( x, k ) cos ( nx, k )V ( x, yk )
k=1
50
Graphical representation
3. evaluate Le
yk
2. evaluate V
1. generate direction in solid angle
?
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 p L ( i ) = 1 N L
2. Select a surface point y on light source i using a uniform pdf p ( y ) = 1 A L i
NL
L ( x ) = -----N
AL L e ( yk y k x )fr ( x, xy k )G ( x, y k )V ( x, yk )
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 p L ( i ) = 1 N L
2. Select a random direction within solid angle subtended by light source i using pdf p ( ) = 1 x ( L )
NL
L ( x ) = -----N
51
Graphical representation
1. pick random light source
4. evaluate Le
yk
3. evaluate visibility
2. generate direction in solid angle
?
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 p L ( i )
2. Select a surface point y on light source i using a pdf p ( y )
N
1
L ( x ) = ---N
k=1
L e ( y k y k x )f r ( x, xy k )G ( x, y k )V ( x, y k )
-------------------------------------------------------------------------------------------------------------p L ( i )p ( yk )
k=1
f r ( x, xy k )G ( x, y k )V ( x, y k )
---------------------------------------------------------------------------Ai p ( yk )
tot
and if p ( y ) = 1 A i : L ( x ) = ---------N
f r ( x, xy k )G ( x, y k )V ( x, yk )
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 p L ( 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 important 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 contribution (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 [ 0, 1 ] .
Choose light source i if:
i1
j < 1 < j
j=1
j=1
i1
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 [ 0, 1 ] [ 0, 1 ] domain:
light source 1
light source 3
light
source
2
light source 4
0
0
1
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 ( ) = 1 2 (uniform sampling of hemisphere, see 34)
N
2
L ( x ) = -----N
53
1
L ( x ) = ---N
k=1
L e ( r ( x, k ) k )f r ( x, k ) cos ( n x, k )
-------------------------------------------------------------------------------------------------------------------p ( k )
Graphical representation:
r ( x, 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 ( n x, ) (cosine sampling of hemisphere, see 35)
N
L ( x ) = ---N
Le ( r ( x, k ) k )fr ( x, k )
k=1
f r ( x, )d
L ( x ) = -------------------------------------------------N
L e ( r ( x, k ) k ) cos ( nx, 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
f r ( x, ) cos ( nx, ) d
L ( x ) = -----------------------------------------------------------------------------N
Le ( r ( x, 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 usually 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 ) = L e ( x ) +
1
L ( x ) = L e ( x ) + ---N
L ( r ( x, i ) i )f r ( x, i ) cos ( n x, i )
------------------------------------------------------------------------------------------------------------p ( i )
i=1
L( x )
55
L ( x )f r ( x, ) cos ( nx, )d
AL
= L direct ( x ) + L indirect ( x )
and L i ( x ) = L r ( r ( x, i ) i ) .
L direct ( x ) is evaluated using any of the techniques for direct illumination (99 - 106). L indirect ( x ) is
evaluated with Monte Carlo integration:
N
1
L indirect ( x ) = ---N
L r ( r ( x, i ) i )f r ( x, i ) cos ( n x, i )
--------------------------------------------------------------------------------------------------------------p ( i )
i=1
L r ( r ( x, 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 indirect ( x ) = -----N
L r ( r ( x, i ) i )f r ( x, i ) cos ( nx, i )
i=1
L indirect ( x ) = ---N
L r ( r ( x, i ) i )fr ( x, i )
i=1
56
fr ( x, )d
L indirect ( x ) = -------------------------------------------------N
L r ( r ( x, i ) i ) cos ( nx, 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 r ( x, ) cos ( n x, )
p ( ) = ----------------------------------------------------------------------------- f r ( x, ) cos ( nx, ) d
x
fr ( x, ) cos ( nx, ) d
L indirect ( x ) = -----------------------------------------------------------------------------N
L r ( r ( x, 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 unbiased. For any (recursive) expression A to be evaluated, use the following procedure:
Pick value [ 0, 1 ] , and generate uniform random number r [ 0, 1 ] :
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 surface 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
I =
f ( x ) dx
---f --- dx
1
Using pdf p ( x ) :
Pixel-driven Path Tracing Algorithms
57
f(xi )
if x i : I = ------------------- p ( xi )
if x i > : I = 0
Graphical representation:
f (x )
----------------
f(x)
=
x
x
0
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
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-inthe-middle strategy for the paths generated. Ray tracing and light tracing can be considered to be special cases of bidirectional tracing.
Pixel-driven Path Tracing Algorithms
58
possible contributions
59
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 lighting illumination components.
References: R20
Multipass Algorithms
60
Le( x ) +
d fr ( x, ) cos ( nx, )
d L ( x )f r ( x, ) cos ( nx, )
(72).
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:
i:
61
z()
1.6
1.4
1.2
y() x()
1
0.8
0.6
0.4
0.2
0
380
430
780nm
X =
480
530
580
630
680
780nm
C ( )x ( ) d
Y =
380nm
Y
y = ----------------------X+Y+Z
780
780nm
C ( )y ( ) d
380nm
X
x = ----------------------X+Y+Z
730
Z =
C ( )z ( ) d
380nm
Z
z = ----------------------X+Y+Z
Y = Y
(1 x y)
Z = Y ------------------------y
X
Y =
Z
F1 ( )x ( ) d F2 ( )x ( ) d F3 ( )x ( ) d
a
(
)y
(
)y
(
)y
(
F
F
F
d
d
d
b
1
2
3
c
F1 ( )z ( ) d F2 ( )z ( ) d F3 ( )z ( ) d
62
2
400
380
1
F 3 ( ) = --- 1 + cos 2 ------------------
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).
x
0.670
0.330
0.210
0.710
0.140
0.080
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
* * *
Y Y n 0.008856
*
L =
Y Y n 0.008856
*
116 ( Y Y n )
13
4X
u' = -------------------------------X + 15Y + 3Z
16
9Y
v' = -------------------------------X + 15Y + 3Z
903.3 ( Y Y n )
where
4X n
u' n = ---------------------------------------X n + 15Y n + 3Z n
9Y n
v' n = ---------------------------------------X n + 15Y n + 3Z n
63
A
X = --- + 3Z
R
u
Q = ------------ + u' n
*
13L
L + 16
*
where
Y = Y n ------------------
v
116
R = ------------ + v' n
*
13L
( Q 4 )A 15QRY
Z = ---------------------------------------------A = 3Y ( 5R 3 )
12R
* * *
116 ( Y Y n )
13
903.3 ( Y Y n )
a = 500L ( f ( X Xn ) f ( Y Y n ) )
16
r 0.008856
where f ( r ) =
r 0.008856
13
7.787r + 16 116
b = 200L ( f ( Y Y n ) f ( Z Z n ) )
*
Y 13
a
+ ---------------
X = X n -----
*
Y n
500L
*
L + 16
Y = Y n ------------------
116
*
Y 13
b
+ ---------------
Z = Z n -----
*
Y n
200L
64
Index
B
barycentric coordinates..........................................................
bidirectional tracing...............................................................
BRDF.....................................................................................
biconical reflectance..........................................................
Cook-Torrance...................................................................
energy conservation...........................................................
Lafortune model ................................................................
lambertian diffuse reflection..............................................
measurements ....................................................................
Phong - Blinn model..........................................................
Phong model......................................................................
reciprocity..........................................................................
Ward model .......................................................................
dielectrics........................................................................... 29
12
58
31
31
34
31
36
31
36
34
32
31
35
C
CDF
see probability distribution function
color and display ...................................................................
color conversion
CIE XYZ to spectrum........................................................
CIE XYZ to/from Lab .......................................................
CIE XYZ to/from Luv.......................................................
CIE XYZ to/from NTSC ...................................................
spectrum to CIE XYZ........................................................
xyY to XYZ.......................................................................
coordinate transformations ....................................................
Cornell box ............................................................................
cosine lobes
integrate over hemisphere..................................................
integrate over spherical digons ..........................................
G
Gauss-Seidel iteration............................................................ 48
geometric transformations ..................................................... 10
H
Halton sequence..................................................................... 24
Hammersley sequence ........................................................... 24
hemisphere
random direction in spherical triangle ............................... 21
random direction proportional to cosine lobe.................... 20
random direction proportional to cosine-weighted solid angle
19
random direction proportional to off-normal cosine lobe.. 21
random direction proportional to solid angle..................... 19
62
62
64
63
63
62
62
11
61
17
17
light tracing............................................................................ 58
K
kronecker d .............................................................................. 6
L
M
D
diffuse emitter........................................................................ 26
dirac-impulse ........................................................................... 6
hemisphere......................................................................... 18
direct illumination
multiple light sources ........................................................ 51
rendering equation............................................................. 37
shadow rays ....................................................................... 50
single light source.............................................................. 50
disk
concentric map .................................................................. 13
polar map ........................................................................... 13
random point...................................................................... 12
dual light transport................................................................. 39
member function.................................................................... 10
monte carlo
combined estimators .......................................................... 23
combined estimators, balance heuristic ............................. 23
estimator ............................................................................ 22
estimator efficiency............................................................ 24
importance sampling.......................................................... 22
integration .......................................................................... 22
stratified sampling ............................................................. 23
multipass algorithms.............................................................. 60
N
next event estimation ............................................................. 56
extinction coefficient
clustering ........................................................................... 49
F
final gather step .....................................................................
flux.........................................................................................
form factor.............................................................................
fresnel reflection
conductors .........................................................................
Index
49
25
41
29
65
Q
quasi-random sampling sequences ........................................ 24
R
radiance ................................................................................. 26
invariant along straight lines.............................................. 26
radiant energy ........................................................................ 25
radiant intensity ..................................................................... 25
radiometric units.................................................................... 25
convert to photometric units .............................................. 27
radiosity
algorithms.......................................................................... 46
clustering ........................................................................... 49
continuous transport equation ........................................... 38
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
global illumination............................................................. 61
ray tracing performance..................................................... 61
total internal refraction .......................................................... 29
triangle
barycentric coordinates...................................................... 12
random point...................................................................... 12
surface area ........................................................................ 11
V
Van der Corput sequence ....................................................... 24
visibility
member function................................................................ 10
ray casting function.............................................................. 9
visibility function................................................................. 9
visibility function..................................................................... 9
S
solid angle..............................................................................
differential .........................................................................
subtended by polygon........................................................
subtended by surface .........................................................
transformation to surface...................................................
visible subtended by surface..............................................
spectral luminous efficiency curve ........................................
sphere
random point......................................................................
spherical coordinates .............................................................
stochastic ray tracing .............................................................
15
15
16
16
16
16
27
19
15
55
T
tangent-sphere function .........................................................
test scenes ..............................................................................
analytic solutions...............................................................
animated ray tracing ..........................................................
Cornell box ........................................................................
Index
17
61
61
61
61
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]
[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-Factors; 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. 307316 (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]
[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]
[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, Katholieke 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 Politcnica de Catalunya, Barcelona, Spain, 1997.
http://ima.udg.es/~mateu/
[29]
Schrder 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]
[32]
Siegel R., Howell J.R.; Thermal Radiation Heat Transfer; Hemisphere Publishing Corporation
[33]
[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]
[41]
Urea 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]
[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