An Efficient Representation for Irradiance Environment Maps An

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