Title: Fast Soft SelfShadowing on Dynamic Height Fields
1Fast Soft Self-Shadowing on Dynamic Height Fields
Derek Nowrouzezahrai University of Toronto
- John Snyder
- Microsoft Research
2Related Work
- horizon mapping Max88
- hard shadows
- precomputed for static geometry
3Related Work
- shadow map filtering Reeves87
- light bleeding artifacts
- small light sources
- no complex environmental lighting
Donnelly06
4Related Work
- ambient occlusion Bunnell05 Kontkanen05
- AO in screen-space Shanmugam07
- cone blocker model Heidrich00
Dimitrov08
Oat07
5Related Work
- static relighting Sloan02 Ng04
- dynamic relighting Bunnell05, Ren06, Sloan07
6Goals
- strong response to lighting direction (cast
shadows)
ambient occlusion
low-frequency SH Ren06
7Goals
- strong response to lighting direction (cast
shadows) - environmental directional lighting
8Goals
- strong response to lighting direction (cast
shadows) - environmental directional lighting
- dynamic geometry (not precomputed)
- real-time performance
- limitation geometry is height field
- applications
- terrain rendering (flight simulators, games,
mapping/navigation) - data visualization
9Summary of Main Ideas
- approximate horizon map via multi-resolution
- create height field pyramid Burt81
- sample height differences from each pyramid level
- use coarser levels as distance to receiver
increases - reduces sampling
- convert horizon map to SH visibility for soft
shadowing - use visibility wedges Dimitrov08
- get good directional lighting response
- sharpen shadows by restricting wedges azimuthally
- fast 2D lookup SH z rotation S over wedges
10Horizon Map Max88
height field zf(x)f(x,y), point p(x)
(x,f(x))
horizon angle ?(x,?)
max angle horizon makes at p in azimuthal
direction ?
Sample ? at all points x along set of directions
?i.
11Calculating the Horizon Map
12Calculating the Horizon Map
13Calculating the Horizon Map
14Calculating the Horizon Map
15Calculating the Horizon Map
16Calculating the Horizon Map
17Calculating the Horizon Map
18Calculating the Horizon Map
19Calculating the Horizon Map
20Calculating the Horizon Map
max
Problem aliasing need many samples in
t. Solution prefilter height field, apply
multi-scale derivative.
21Brute Force Sampling Requirements
22Multi-Resolution Approximation
multi-scale derivative
pyramid level i
sampling distance for level i
As t ?, i ? sample coarser levels further from
x.
fi
fi-1
fi-2
fi-3
23Multi-Resolution Horizon Angle
horizon angle sample i
w
w
w
w
i-3
i
i-1
i-2
24Multi-Resolution Horizon Angle
Up-sample coarser levels with 2D B-splines
w
w
w
w
i-3
i
i-1
i-2
knot
mid
25Smooth Interpolation
- non-smooth interpolation (e.g. bilinear) ? shadow
artifacts - use 1D b-spline for horizon angle vs. distance
(?i) - use 2D b-spline for heights (fi)
linearbilinear
b-splinebilinear
linearb-spline
b-splineb-spline
26Pyramid Level Step
- k 1 (standard power-of-2 pyramid) ? abrupt
transitions - k 4 smoothes transitions
k 1
k 2
k 3
k 4
27Pyramid Level Offset
- pyramid level bias when sampling height
differences - increasing bias increases shadow sharpness
- increases sampling requirements
o 0
o 1
o 2
o 3
o 4
28Summary of Main Ideas
- approximate horizon map via multi-resolution
- create height field pyramid Burt81
- sample height differences from each pyramid level
- use coarser levels as distance to receiver
increases - reduces sampling
- convert horizon map to SH visibility for soft
shadowing - use visibility wedges Dimitrov08
- get good directional lighting response
- sharpen shadows by restricting wedges azimuthally
- fast 2D lookup SH z rotation S over wedges
29Reconstructing Visibility
- so far discussed sampling in single azimuthal
direction - large lights sample multiple azimuthal directions
- linearly interpolate horizon angle ? as function
of ? - sequential pairs of ?i determine visibility
wedges
30Projecting Visibility to SH
- Visibility for a single wedge
- Project visibility wedge to SH (order 4)
- fix ?i 0 and ?f. Store as 2D table
31Reconstruct Full Visibility
- N azimuthal sampling directions ? N horizon
angles - (N 1) adjacent horizon angle pairs (wedge
boundaries)
- (N 1) table lookups (N 1) SH Z-rotations
- ? rotate wedge from ?i 0 to azimuthal direction
- Sum over all wedges
All operations (including horizon angle
calculation) in a single GPGPU shader. See
Snyder08 for full source code.
32Azimuthal Swaths
- azimuthal swaths contain many visibility wedges
- key lights restrict swath
- get sharper shadows
- acts as a geometric mask
- only sample where necessary
33Restricted Swaths
- smaller swaths ? sharper shadows
- approach limit determined by SH order
?f 45
?f 22.5
?f 11.25
?f 90
34Soft Shadowed Shading with SH
visibility vector at x
diffuse reflectance clamped cosine around normal
Nx
lighting environment
35Soft Shadowed Shading with SH
or BRDF x Visibility SH Product and dot with
lighting
36Comparison with Ground Truth
ground truth
k 1, o 1
k 2, o 2
k 3, o 3
k 4, o 4
37Measured Performance
38Image Results
39Video Results
Clip 1
Clip 2
40Conclusions
- multi-resolution approximation for horizon map
- soft shadowing via fast SH projection
- key env lighting decomposition
- simple GPU implementation
- real-time up to 512x512 dynamic height fields
- performance independent of geometric content
41Future Work
- subsample visibility
- combine with dynamic shadow casters
- via Ren06Sloan07 (sphere set blocker
approximation) - advantage of SH over cone models and AO
- simulate inter-reflections
- add local light sources
- generalize geometry
- screen space projection Shanmugam07
- local height field displacements
42Thanks! Any questions?
43Restricted Swaths
- For partial swaths, only directions affected by
key light are sampled
44Reconstructing Visibility
- So far discussed sampling single azimuthal
direction - Large lights require many directional samples
- Calculate horizon angle in many azimuthal
directions - Combine together, forming visibility wedges
Dimitrov08
- Canonically reposition fi 0, tabulate SH
projection as 2D LUT for fixed azimuthal spacing.
45Pyramid Level Step
- Control the sample spacing reduction
- pyramid level i
- sample spacing at level i
- k is the level step
- k 1 ? standard level-of-2 pyramid (e.g. MIP)
- we use k 4 ? storage 3.4x original HF
46Multi-resolution Horizon Map
As t ?, i ? sample coarser levels further from x
47Background
- The rendering equation for direct illumination is
48Background
- The rendering equation for direct illumination is
assume a diffuse BRDF and combine the
reflectance and the cosine term
49Background
- The rendering equation for direct illumination is
assume a diffuse BRDF and combine the
reflectance and the cosine term
project the lighting, clamped cosine weighted
reflectance, and visibility into SH
50Putting it all together
- Height field geometry ? uniform grid of height
values - Generated on the CPU or GPU
- stored in a texture
- A multi-resolution height pyramid is generated
on-the-fly - avoid large sampling rates as distance
- from receiver point increases
- Max blocking angles are determined
- Fast LUT fast SH Z-rotation generate visibility
- At every step
- Re-generate height-field and pyramid
51Putting it all together
- Height field geometry ? uniform grid of height
values - Generated on the CPU or GPU
- stored in a texture
- A multi-resolution height pyramid is generated
on-the-fly - avoid large sampling rates as distance
- from receiver point increases
- Max blocking angles are determined
- Fast LUT fast SH Z-rotation generate visibility
- At every step
- Re-generate height-field and pyramid
52Putting it all together
- Height field geometry ? uniform grid of height
values - Generated on the CPU or GPU
- stored in a texture
- A multi-resolution height pyramid is generated
on-the-fly - avoid large sampling rates as distance
- from receiver point increases
- Max blocking angles are determined
- Fast LUT fast SH Z-rotation generate visibility
- At every step
- Re-generate height-field and pyramid
53Putting it all together
- Height field geometry ? uniform grid of height
values - Generated on the CPU or GPU
- stored in a texture
- A multi-resolution height pyramid is generated
on-the-fly - avoid large sampling rates as distance
- from receiver point increases
- Max blocking angles are determined
- Fast LUT fast SH Z-rotation generate visibility
- At every step
- Re-generate height-field and pyramid
54Contributions
- A formulation of the maximum blocking angle as a
directional derivative - We analyze the effects of pyramid depth, step
size and filtering on the final shadow quality - Determining the visibility amounts to calculating
a multi-scale directional derivative - We present an efficient algorithm for determining
the visibility