Title: Real-time Soft Shadows in Dynamic Scenes using Spherical Harmonic Exponentiation
1Real-time Soft Shadows in Dynamic Scenes using
Spherical Harmonic Exponentiation
- John Snyder
- Principal Researcher
- Microsoft Research
2Project Collaborators
- Zhong Ren, Zhejian University (intern at MSRA)
- Rui Wang, Zhejian University (intern at MSRA)
- Kun Zhou, MSRA
- Xinguo Liu, MSRA
- Bo Sun, Columbia University (intern at MSR)
- Peter-Pike Sloan, DirectX
- Hujun Bao, Zhejiang University
- Qunsheng Peng, Zhejiang University
- Baining Guo, MSRA
paper appears in Siggraph 2006
3Fast Soft Shadows in Dynamic Scenes
- Motivation
- realism
- shape/proximity cues
- new look
- Challenges
- large light sources
- complex, dynamic blockers/receivers
- self-shadows cast-shadows
unshadowed
shadowed
4Previous Work in Fast Shadow Rendering
Name Reference Lighting Constraints
shadow buffer/vol. Williams78, point -
accum. buffer Segal92, small area many passes
PRT (SH) Sloan02, low-freq static
PRT (all-freq) Ng03, all-freq static, diffuse
PRT (dynamic) James03,05 low-freq precomp. sequences
LDPRT Sloan05 low-freq local effects
ambient occlusion Bunnel04, DC no casting
shadow fields Zhou05 low-freq few, rigid objs
SHEXP current low-freq many, deform objs
5Previous Work in Fast Shadow Rendering
Name Reference Lighting Constraints
ambient occlusion Bunnel04, DC no casting
shadow fields Zhou05 low-freq few, rigid objs
SHEXP current low-freq many, deform objs
- soft shadows from large-area lights
- dynamic shading
- blocker/receiver motion not precomputed
6Ambient Occlusion vs. SHEXP
ray traced
7SHEXP Summary
- Approximate blockers with spheres
- accumulate over large blockers, not light
directions - symmetry simplifies calculation
8SHEXP Summary
- Approximate blockers with spheres
- accumulate over large blockers, not light
directions - symmetry simplifies calculation
- Represent low-frequency visibility/lighting in SH
9SHEXP Summary
- Approximate blockers with spheres
- accumulate over large blockers, not light
directions - symmetry simplifies calculation
- Represent low-frequency visibility/lighting in SH
- For each receiver point p
- accumulate visibility logarithm over blocker
spheres - exponentiate
- shade
10SH ReviewProjection and Reconstruction
s
11SH ReviewProjection and Reconstruction
12SH ReviewProjection and Reconstruction
13SH ReviewProducts
14SH ReviewProducts
15SH ReviewProducts
16SH ReviewShading Ng04
gp
L
H(Np)
lighting
visibility
BRDF
17SH ReviewShading Ng04
gp
L
H(Np)
18Visibility Accumulation (Product Space Zhou05)
g g1g2gm
- m moving blockers
- gi is SH visibility of blocker i
- exact product order m(n-1)1
- truncate to order n after each
- need m-1 expensive SH products
19Visibility Accumulation Example(Product Space)
Product Space Accumulated
64 Spheres
1 Spheres
2 Spheres
3 Spheres
16 Spheres
32 Spheres
20Idea Use Log Space
- SH product expensive O(n5)
- SH add cheap O(n2)
- e.g. SH order n4
- ab ? 673 flops
- ab ? 16 adds!
- suggests rule for positive reals
21Visibility Accumulation(Log Space)
g exp(f 1 f 2 f m)
- applies scalar rule to every visibility direction
- f ilog(gi) is SH log visibility of sphere i
- need m-1 vector adds, one exp
- greatly reduces per-blocker cost ( ? )
22Visibility Accumulation Example(Log Space)
Log Space Accumulated
64 Spheres
1 Spheres
2 Spheres
3 Spheres
16 Spheres
32 Spheres
23Log vs. Product Space
SH Projection
Visibility Function
Log Space Approx.
Product Space Approx.
24SH Exponential Volterra Series
- expand exp(x) in SH projection formula
25SH Exponential Volterra Series
- expand exp(x) in SH projection formula
- yielding sum of powers f p
26SH Exponential Product Series
- exact evaluation horribly expensive!
- order-p tensors
- output order grows with p p(n-1)1
- approximate with product series
- degree p series needs p-1 SH products
- truncate each product back to order n
27Accelerating Product Series
- bigger f ? more series terms in exp( f )
- DC isolation compute DC via scalar exp
- scaling/squaring divide by 2p, exp, square p
times - factoring reduce products Higham05
28Optimal Linear Approximation
- linear model (degree 1 series)
- no SH products!
- optimal coefs a and b
- tabulated functions of input magnitude f
- least-squares fit to example visibility functions
- accurate for n 4, f 4.8
- extend magnitude range using scaling/squaring
29SHEXP Method Comparison
log space (SHEXP)
PS-2, 45k
PS-21, 328k
product space, 495k
HYB, 31k
OL, 0
30SHEXP Method Comparison
log space (SHEXP)
PS-2, 45k
PS-21, 328k
product space, 495k
- evaluate on GPU
- workhorse method
HYB, 31k
OL, 0
31SH Logarithm
- computed for sphere blockers as preprocess
- naïve method numerical integration with clipping
- better method series inversion
32Approximating Blocker Geometry
- bounding sphere set
- minimize outside volume Wang06
- animate via mean value coordinates Ju05
33Single Sphere Visibility
- tabulate logs of circle visibility, f (q)
- function of angle subtended, q
- canonically oriented around z axis
- rotate on-the-fly
34Single Sphere Visibility(Rotation)
- use rotation rule Sloan05
35Self-Shadowing Replacement Rules
Tp
p
36Sphere Hierarchies
Blocker Hierarchy
37Sphere Hierarchies
38Sphere Hierarchies
39Sphere Hierarchies
40Per-Band Weighting
41Rendering
- Per-cluster computation (on CPU)
- Per-vertex computation (on GPU)
42Per-Cluster Computation (CPU)
- For each cluster
- choose cut
- for each sphere in cut
- compute weight vector
- Pack information into textures
- sphere cut info (center, radius, weight vector)
- vertex info (position, normal, receiver cluster
id)
43Per-Vertex Computation (GPU)
- For each sphere i in cut
- apply self-shadow replacement rules
- get canonical log visibility vector f (q)
- rotate and apply weights, yielding f i
- accumulate f f i
- Exponentiate using HYB
- total visibility vector g exp( f )
- Shade using (H(N), L, g)
44Demos
45Implementation Performance
- per-vertex shading via render-to-vertex buffer
- battle demo
- 65k receiver vertices
- 244 leaf spheres, avg47, max117
- 26Hz average frame rate
- dino demo
- 120k receiver vertices
- 500 leaf spheres, avg42, max160
- 14Hz average frame rate
46Contributions
- Blocker approximation using bounding sphere sets
- general, deformable objects
- Accumulation of low-frequency blocker visibility
- much faster in log space
- accurate as product space
- Fast evaluation of SH exp/log
- product series approx. to Volterra series
- optimal linear method
- SH log by series inversion
47Limitations
- Low-frequency lighting
- Low-frequency (diffuse) BRDF
- Distant lighting
- true local lighting requires sorting
- demo special case
48Future Work
- Anisotropic blocker models
- Diffuse inter-reflection
- Models for spatial, temporal variation
49Acknowledgements
- Becky Sundling
- video production
- Mingdong Xie
- modeling and animation
- Anon. SIGGRAPH reviewers
- suggestions and comments
and thank you!