height field pyramid

Download Report

Transcript height field pyramid

Fast Self-Shadowing on
Dynamic Height Fields
John Snyder
Microsoft Research
Derek Nowrouzezahrai
University of Toronto
Related Work
• horizon mapping
[Max88; Stewart98; Sloan&Cohen00]
– hard shadows
– precomputed for static geometry
[Sloan&Cohen00]
Related Work
• shadow map filtering
[Reeves87; Donnelly06; …]
– light “bleeding” artifacts
– small light sources
– no complex environmental lighting
[Donnelly06]
Related Work
• ambient occlusion
[Bunnell05; Kontkanen05; …]
– AO in screen-space [Shanmugam07; Dimitrov08]
[Dimitrov08]
– “cone” blocker model [Heidrich00; Oat07]
[Oat07]
Related Work
• static relighting [Sloan02; Ng04; …]
• dynamic relighting [Bunnell05, Zhang06, Sloan07]
Goals
• response to lighting direction (cast shadows)
ambient occlusion
low-frequency SH [Ren06]
Goals
• response to lighting direction (cast shadows)
• environmental + directional lighting
Goals
•
•
•
•
•
response to lighting direction (cast shadows)
environmental + directional lighting
dynamic geometry (not precomputed)
real-time performance
limitation: restrict geometry to height field
Summary of Main Ideas
1. approximate the horizon map via multi-res
-
avoid aliasing with height field pyramid
sample height differences from each pyramid level
use coarser levels as caster-to-receiver dist. increases
real-time for dynamic height fields
2. use the horizon map to generate SH visibility
-
soft shadows using visibility wedges [Dimitrov08]
fully directional lighting response
sharpen shadows with restrictive wedges
fast: {2D lookup + SH z rotation + Σ over wedges}
Background
• Given a height field z = f ( x) = f ( x, y ) , the
maximum elevation angle of the horizon in the
azimuthal direction, called the horizon angle, is
 f ( x + t cos j , y + t sin j ) - f ( x, y ) 
w ( x, j ) = max tan 

t( 0 , )
t


-1
Note: the horizon angle contains an expression
similar to a numerical derivative of f
Using a HF pyramid
• We will use a multi-resolution pyramid in order to
accelerate the computation of the horizon angle
– pyramid level i denoted f i (x) for i  {0,1,..., N - 1}
with resolution multipliers of b -i = 2 -i k
– for k = 4 storage is approximately 3.4x the original HF
Using a HF pyramid
• We will use a multi-resolution pyramid in order to
accelerate the computation of the horizon angle
– pyramid level i denoted f i (x) for i  {0,1,..., N - 1}
with resolution multipliers of b -i = 2 -i k
– for k = 4 storage is approximately 3.4x the original HF
• The pyramid will allow us to use an approximate
sampling rate in directions and distance from
receiver point
– reduces sampling requirements of points far from the
receiver while avoiding aliasing artifacts
Multi-Scale Derivative
•
1.
2.
3.
4.
We introduce a multi-scale directional
derivative, defined in terms of:
the pyramid scale
the receiver point
the azimuthal direction
and the distance to the receiver point
f i ( x + d i cos j , y + d i sin j ) - f i ( x, y )
D( f i , x, j , d i ) =
di
•
Sample heights from coarser pyramid levels as
the distance from the receiver increases
Approximate Horizon Angle
•
To approximate the horizon angle given the
multi-scale directional derivative we
1. obtain the horizon angle at each pyramid level
wi ( x, j , d i ) = tan -1 (Di ( f i , x, j , d i ) )
2. convert the discrete “scale-space” horizon
angles from step 1 to a continous function
using b-spline interpolation
w (t , x, j ) = b - spline(t , w0 ( x, j ,d 0),..., w N -1 ( x, j ,d N -1))
Approximate Horizon Angle
3. and take the max of the continuous function
over all scales in the pyramid
w ( x, j )  max w (t , x, j )
t {0, N -1}
For strong directional lighting, b-spline pyramid
synthesis as well as b-spline blocker angle
interpolation are required to eliminate aliasing
Main Ideas
1. Approximating the horizon map
-
using a height field pyramid to avoid aliasing
in real-time for dynamic height field geometries
2. Use the horizon map to generate SH visibility
-
soft shadows using visibility “wedges”
fully directional lighting response
can sharpen shadows with restrictive wedges
FAST: {2D lookup + SH z rotation + Σ over wedges}
Background
• The rendering equation for direct illumination is
L( x, sout ) =  Lin ( x, s ) f r ( x, s, sout )v( x, s ) cos(sq )ds
S
Background
• The rendering equation for direct illumination is
L( x, sout ) =  Lin ( x, s ) f r ( x, s, sout )v( x, s ) cos(sq )ds
S
assume a diffuse BRDF and combine the
reflectance and the cosine term
L( x) =  Lin ( x, s )h( x, N x )v( x, s )ds =  Lin ( x, s )T ( x)ds
S
S
Background
• The rendering equation for direct illumination is
L( x, sout ) =  Lin ( x, s ) f r ( x, s, sout )v( x, s ) cos(sq )ds
S
assume a diffuse BRDF and combine the
reflectance and the cosine term
L( x) =  Lin ( x, s )h( x, N x )v( x, s )ds =  Lin ( x, s )T ( x)ds
S
S
project the lighting, clamped cosine weighted
reflectance, and visibility into SH
L( x)  L  [H ( N x ) *Vx ]= L  Tx
Putting it all together
•
•
Height field geometry  uniform grid of height
values
Generated on the CPU or GPU
–
•
A multi-resolution height pyramid is generated on-the-fly
–
•
stored in a texture
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
• Determine total SH visibility over each azimuthal swath
• Shade with SH triple product
Putting it all together
•
•
Height field geometry  uniform grid of height
values
Generated on the CPU or GPU
–
•
A multi-resolution height pyramid is generated on-the-fly
–
•
stored in a texture
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
• Determine total SH visibility over each azimuthal swath
• Shade with SH triple product
Putting it all together
•
•
Height field geometry  uniform grid of height
values
Generated on the CPU or GPU
–
•
A multi-resolution height pyramid is generated on-the-fly
–
•
stored in a texture
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
• Determine total SH visibility over each azimuthal swath
• Shade with SH triple product
Putting it all together
•
•
Height field geometry  uniform grid of height
values
Generated on the CPU or GPU
–
•
A multi-resolution height pyramid is generated on-the-fly
–
•
stored in a texture
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
• Determine total SH visibility over each azimuthal swath
• Shade with SH triple product
Contributions
• 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
Contributions
• 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