An Efficient Representation for Irradiance Environment Maps An Efficient Representation for An Efficient Representation for
Irradiance Environment Maps Irradiance Environment Maps
Ravi Ramamoorthi Ravi Ramamoorthi Pat Hanrahan Pat Hanrahan
Stanford University SIGGRAPH 2001 Stanford University
SIGGRAPH 2001
Irradiance Environment Maps Irradiance Environment Maps Irradiance Environment Maps
Incident Radiance
(Illumination Environment Map)
Irradiance Environment Map
R N
Assumptions Assumptions Assumptions
• Diffuse surfaces
• Distant illumination
• No shadowing, interreflection
Hence, Irradiance is a function of surface normal
• Diffuse surfaces
• Distant illumination
• No shadowing, interreflection
Hence, Irradiance is a function of surface normal
Ω
∫
⋅
=
) (
) )(
( )
(
n
n
n L ω ω d ω
E
Diffuse Reflection Diffuse Reflection Diffuse Reflection
Radiosity
(image intensity)
Reflectance (albedo/texture)
Irradiance
(incoming light)
= ×
quake light map
) (
) (
) ,
( x n x E n
B = ρ
Computing Irradiance Computing Irradiance Computing Irradiance
• Classically, hemispherical integral for each pixel
• Lambertian surface is like low pass filter
• Frequency-space analysis
• Classically, hemispherical integral for each pixel
• Lambertian surface is like low pass filter
• Frequency-space analysis Incident
Radiance Irradiance
Spherical Harmonics Spherical Harmonics Spherical Harmonics
-1
-2 0 1 2
0
1
2
. . .
( , ) Y lm θ ϕ
y z x
xy yz 3 z
2− 1 zx x
2− y
2l
m
1
Spherical Harmonic Expansion Spherical Harmonic Expansion Spherical Harmonic Expansion
Expand lighting (L), irradiance (E) in basis functionsExpand lighting (L), irradiance (E) in basis functions
0
( , ) ( , )
l
lm lm
l m l
L θ φ
∞ +L Y θ φ
= =−
= ∑ ∑
0
( , ) ( , )
l
lm lm
l m l
E θ φ
∞ +E Y θ φ
= =−
= ∑ ∑
= .67 + .36 + …
Analytic Irradiance Formula Analytic Irradiance Formula Analytic Irradiance Formula
Lambertian surface acts like low-pass filter
Lambertian surface acts like low-pass filter
lm l lm
E = A L A
lπ
2 / 3π
π / 4 0
( )
2 1
2 2
( 1) !
2 ( 2)( 1) 2 !
l
l l l
A l l even
l l
π − − ⎡ ⎤
= ⎢ ⎥
+ − ⎢⎣ ⎥⎦
0 1 2
l
9 Parameter Approximation 9 Parameter Approximation 9 Parameter Approximation
-1
-2 0 1 2
0 1 2
( , ) Ylm θ ϕ
y z x
xy yz 3z2 −1 zx x2 − y2 l
m
Exact image Order 0
1 term
RMS error = 25 %
9 Parameter Approximation 9 Parameter Approximation 9 Parameter Approximation
-1
-2 0 1 2
0 1 2
( , ) Ylm θ ϕ
y z x
xy yz 3z2 −1 zx x2 − y2 l
m
Exact image Order 1
4 terms
RMS Error = 8%
9 Parameter Approximation 9 Parameter Approximation 9 Parameter Approximation
-1
-2 0 1 2
0 1 2
( , ) Ylm θ ϕ
y z x
xy yz 3z2 −1 zx x2 − y2 l
m
Exact image Order 2
9 terms
RMS Error = 1%
For any illumination, average error < 3% [Basri Jacobs 01]
Computing Light Coefficients Computing Light Coefficients Computing Light Coefficients
Compute 9 lighting coefficients L
lm• 9 numbers instead of integrals for every pixel
• Lighting coefficients are moments of lighting
• Weighted sum of pixels in the environment map
Compute 9 lighting coefficients L
lm• 9 numbers instead of integrals for every pixel
• Lighting coefficients are moments of lighting
• Weighted sum of pixels in the environment map
2
0 0
( , ) ( , ) sin
lm lm
L L Y d d
π π
θ φ
θ φ θ φ θ θ φ
= =
= ∫ ∫
( , )
[ ] [ ]
lm lm
pixels
L envmap pixel basisfunc pixel
θ φ
= ∑ ×
Comparison Comparison Comparison
Incident illumination
300x300
Irradiance map Texture: 256x256
Hemispherical Integration 2Hrs
Irradiance map Texture: 256x256 Spherical Harmonic
Coefficients 1sec
Time 300 300 256 256∝ × × × Time 9 256 256∝ × ×
Rendering Rendering Rendering
• We have found the SH coefficients for irradiance which is a spherical function.
• Given a spherical coordinate, we want to calculate the corresponding irradiance quickly.
• We have found the SH coefficients for irradiance which is a spherical function.
• Given a spherical coordinate, we want to calculate the corresponding irradiance quickly.
) ,
ˆ ( )
, (
,
φ θ
φ
θ
lm lmm l
l
L Y A
E = ∑
Rendering Rendering Rendering
Irradiance approximated by quadratic polynomialIrradiance approximated by quadratic polynomial
2
4 00 2 11 2 1 1 2 10 5 2
2 2
0
1 2 2 1 21 1 2 1 1 22
1 (3 1
( ) 2 2 2
2 2 2 ( )
)
x y z z
x
E n c L c L c L c L c L
c L y c L xz c L yz c L x y
−
− −
−
= + + + +
+ −
+
+ +
( )
tE n = n Mn
1 x y z
⎛ ⎞⎜ ⎟
⎜ ⎟⎜ ⎟
⎜ ⎟⎜ ⎟
⎝ ⎠
Surface Normal vector column 4-vector
4x4 matrix (depends linearly on coefficients Llm)
Hardware Implementation Hardware Implementation Hardware Implementation
Simple procedural rendering method (no textures)
• Requires only matrix-vector multiply and dot-product
• In software or NVIDIA vertex programming hardware
Simple procedural rendering method (no textures)
• Requires only matrix-vector multiply and dot-product
• In software or NVIDIA vertex programming hardware
( ) t
E n = n Mn
surface float1 irradmat (matrix4 M, float3 v) { float4 n = {v , 1} ;
return dot(n , M*n) ; }
Complex Geometry Complex Geometry Complex Geometry
Assume no shadowing: Simply use surface normalAssume no shadowing: Simply use surface normal
y
Lighting Design Lighting Design Lighting Design
Final image sum of 3D basis functions scaled by Llm
Alter appearance by changing weights of basis functions
Final image sum of 3D basis functions scaled by Llm
Alter appearance by changing weights of basis functions
Results Results Results
Summary Summary Summary
Theory
• Analytic formula for irradiance
• Frequency-space: Spherical Harmonics
• To order 2, constant, linear, quadratic polynomials
• 9 coefficients (up to order 2) suffice
Practical Applications
• Efficient computation of irradiance
• Simple procedural rendering
• New representation, many applications
Theory
• Analytic formula for irradiance
• Frequency-space: Spherical Harmonics
• To order 2, constant, linear, quadratic polynomials
• 9 coefficients (up to order 2) suffice
Practical Applications
• Efficient computation of irradiance
• Simple procedural rendering
• New representation, many applications
Precomputed Radiance Transfer Precomputed Radiance Transfer
for Real
for Real - - Time Rendering in Dynamic, Time Rendering in Dynamic, Low Low - - Frequency Lighting Environments Frequency Lighting Environments
Peter-Pike Sloan, Microsoft Research Jan Kautz, MPI Informatik
John Snyder, Microsoft Research
SIGGRAPH 2002
( ) V sr
( ) i i ( ) L sr =%
∑
l B sr( )
( ) i i( ) ( ) ( , ) N ( ) R vr =%
∫ ∑
l B s V s f s v Hr r r r s d sr r( )
i i( ) ( ) ( , )
N( )
R v r = % ∑ ∫ l B s V s f s v H r r r r s d s r r ( ) max( , 0)
H
Ns =
Preprocess for all Preprocess for alls N •
iivr
( ) ( ) ( ) ( , ) N ( ) R vr =
∫
L s V s f s v Hr r r r s d sr r( )
i iR v r = % ∑ l t
Basic idea B B asic idea asic idea
Basis 16 Basis 16
Basis 17 Basis 17
Basis 18 Basis 18
illuminate
illuminate resultresult
... .. .
... .. .
UUse 25 basesse 25 bases
Precomputation Precomputation Precomputation
No Shadows/Inter Shadows
No Shadows/Inter Shadows Shadows+InterShadows+Inter
Diffuse Diffuse Diffuse
Glossy Glossy Glossy
No Shadows/Inter Shadows
No Shadows/Inter Shadows Shadows+InterShadows+Inter
•
Glossy object, 50K mesh•
Runs at 3.6/16/125fps on 2.2Ghz P4, ATI Radeon 8500Arbitrary BRDF Arbitrary BRDF Arbitrary BRDF
Other BRDFs
Other BRDFs Spatially VaryingSpatially Varying Anisotropic BRDFs
Anisotropic BRDFs
Volumes Volumes Volumes
• Diffuse volume: 32x32x32 grid
• Runs at 40fps on 2.2Ghz P4, ATI 8500
• Here: dynamic lighting
• Diffuse volume: 32x32x32 grid
• Runs at 40fps on 2.2Ghz P4, ATI 8500
• Here: dynamic lighting