An Efficient Representation for Irradiance Environment Mapscyy/courses/rendering/... · Irradiance...

Post on 08-Aug-2020

35 views 0 download

Transcript of An Efficient Representation for Irradiance Environment Mapscyy/courses/rendering/... · Irradiance...

An Efficient Representation for Irradiance Environment MapsAn Efficient Representation for An Efficient Representation for Irradiance Environment MapsIrradiance Environment Maps

Ravi RamamoorthiRavi Ramamoorthi Pat HanrahanPat Hanrahan

Stanford University

SIGGRAPH 2001

Stanford University

SIGGRAPH 2001

Irradiance Environment MapsIrradiance Environment MapsIrradiance Environment Maps

Incident Radiance(Illumination Environment Map)

Irradiance Environment Map

R N

AssumptionsAssumptionsAssumptions

• 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

nn ωωω dLE

Diffuse ReflectionDiffuse ReflectionDiffuse Reflection

Radiosity(image intensity)

Reflectance(albedo/texture)

Irradiance(incoming light)

×=

quake light map

)()(),( nxnx EB ρ=

Computing IrradianceComputing IrradianceComputing 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

IncidentRadiance Irradiance

Spherical HarmonicsSpherical HarmonicsSpherical Harmonics

-1-2 0 1 2

0

1

2.

.

.

( , )lmY θ ϕ

xy z

xy yz 23 1z − zx 2 2x y−

l

m

1

Spherical Harmonic ExpansionSpherical Harmonic ExpansionSpherical Harmonic Expansion

Expand lighting (L), irradiance (E) in basis functionsExpand lighting (L), irradiance (E) in basis functions

0

( , ) ( , )l

lm lml m l

L L Yθ φ θ φ∞ +

= =−

=∑ ∑

0( , ) ( , )

l

lm lml m l

E E Yθ φ θ φ∞ +

= =−

=∑ ∑

= .67 + .36 + …

Analytic Irradiance FormulaAnalytic Irradiance FormulaAnalytic Irradiance Formula

Lambertian surface acts like low-pass filterLambertian surface acts like low-pass filter

lm l lmE A L=lA

π

2 / 3π

/ 4π

0

( )2 1

22

( 1) !2( 2)( 1) 2 !

l

l l l

lA l evenl l

π− ⎡ ⎤−

= ⎢ ⎥+ − ⎢ ⎥⎣ ⎦

l0 1 2

9 Parameter Approximation9 Parameter Approximation9 Parameter Approximation

-1-2 0 1 2

0

1

2

( , )lmY θ ϕ

xy z

xy yz 23 1z − zx 2 2x y−

l

m

Exact image Order 01 term

RMS error = 25 %

9 Parameter Approximation9 Parameter Approximation9 Parameter Approximation

-1-2 0 1 2

0

1

2

( , )lmY θ ϕ

xy z

xy yz 23 1z − zx 2 2x y−

l

m

Exact image Order 14 terms

RMS Error = 8%

9 Parameter Approximation9 Parameter Approximation9 Parameter Approximation

-1-2 0 1 2

0

1

2

( , )lmY θ ϕ

xy z

xy yz 23 1z − zx 2 2x y−

l

m

Exact image Order 29 terms

RMS Error = 1%

For any illumination, average error < 3% [Basri Jacobs 01]

Computing Light CoefficientsComputing Light CoefficientsComputing Light Coefficients

Compute 9 lighting coefficients Llm• 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 Llm• 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

( , ) ( , ) sinlm lmL L Y d dπ π

θ φ

θ φ θ φ θ θ φ= =

= ∫ ∫

( , )[ ] [ ]lm lm

pixelsL envmap pixel basisfunc pixel

θ φ= ×∑

ComparisonComparisonComparison

Incident illumination

300x300

Irradiance mapTexture: 256x256

HemisphericalIntegration 2Hrs

Irradiance mapTexture: 256x256

Spherical HarmonicCoefficients 1sec

Time 300 300 256 256∝ × × × Time 9 256 256∝ × ×

RenderingRenderingRendering

• 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.

),(ˆ),(,

φθφθ lmlmml

l YLAE ∑=

RenderingRenderingRendering

Irradiance approximated by quadratic polynomialIrradiance approximated by quadratic polynomial2

4 00 2 11 2 1 1 2 10 5 22 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 c L c Ly xz yz x yc L−

− −

−= + + + +

+ −

+

+ +

( ) tE n n Mn=

1

xyz

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

Surface Normal vectorcolumn 4-vector

4x4 matrix(depends linearly

on coefficients Llm)

Hardware ImplementationHardware ImplementationHardware 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

( ) tE n n Mn=

surface float1 irradmat (matrix4 M, float3 v) { float4 n = {v , 1} ; return dot(n , M*n) ;}

Complex GeometryComplex GeometryComplex GeometryAssume no shadowing: Simply use surface normalAssume no shadowing: Simply use surface normal

y

Lighting DesignLighting DesignLighting Design

Final image sum of 3D basis functions scaled by LlmAlter appearance by changing weights of basis functions

Final image sum of 3D basis functions scaled by LlmAlter appearance by changing weights of basis functions

ResultsResultsResults

SummarySummarySummary

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 Realfor Real--Time Rendering in Dynamic, Time Rendering in Dynamic,

LowLow--Frequency Lighting EnvironmentsFrequency Lighting Environments

Peter-Pike Sloan, Microsoft Research

Jan Kautz, MPI Informatik

John Snyder, Microsoft Research

SIGGRAPH 2002

( )V sr

( ) ( )i iL s l B s=∑r r%

( )( ) ( ) ( ) ( , ) ( )i i NR v l B s V s f s v H s d s= ∑∫r r r r r r r%

( ) ( ) ( ) ( , ) ( )i i NR v l B s V s f s v H s d s=∑ ∫r r r r r r r%

( ) max( ,0)NH s s N= •Preprocess for all Preprocess for all ii

vr

( ) ( ) ( ) ( , ) ( )NR v L s V s f s v H s d s= ∫r r r r r r r

( ) i iR v l t=∑r%

Basic ideaBBasic ideaasic idea

Basis 16Basis 16

Basis 17Basis 17

Basis 18Basis 18

illuminateilluminate resultresult

......

......

UUse 25 basesse 25 bases

PrecomputationPrecomputationPrecomputation

No Shadows/Inter Shadows No Shadows/Inter Shadows Shadows+InterShadows+Inter

DiffuseDiffuseDiffuse

GlossyGlossyGlossy

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 8500

Arbitrary BRDFArbitrary BRDFArbitrary BRDF

Other BRDFsOther BRDFs Spatially VaryingSpatially VaryingAnisotropic BRDFsAnisotropic BRDFs

VolumesVolumesVolumes

• 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