Convolution Shadow Maps * MPI Informatik Germany Hasselt University Belgium University College...

23
Convolution Shadow Maps * MPI Informatik Germany Hasselt University Belgium University College London UK T. Annen * T. Mertens P. Bekaert H.-P. Seidel * J. Kautz

description

EGSR Grenoble 3/23 Convolution Shadow Maps Problem statement Helix scene Shadow Mapping Filtering the z values of the Shadow Map Filtering the CSM data structure ??

Transcript of Convolution Shadow Maps * MPI Informatik Germany Hasselt University Belgium University College...

Page 1: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

Convolution Shadow Maps

* MPI Informatik Germany

† Hasselt UniversityBelgium

‡ University College LondonUK

T. Annen*T. Mertens† P. Bekaert†

H.-P. Seidel* J. Kautz‡

Page 2: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 2/23Convolution Shadow Maps

Motivation: Screen-space anti-aliasing

Percentage Closer Filtering (NVIDIA) Convolution Shadow Map (CSM)

Page 3: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 3/23Convolution Shadow Maps

Problem statementHelix scene Shadow

Mapping

Filtering the z values of the Shadow Map

Filtering the CSM data structure

? ?

Page 4: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 4/23Convolution Shadow Maps

Benefits of a CSM Efficient screen-space anti-aliasing through

hardware filtering– Including mipmapping and anisotropic filtering

Enables additional convolutions– Blur filter conceals discretization artifacts

Improves temporal coherence substantially

Page 5: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 5/23Convolution Shadow Maps

Related Work Percentage Closer Filtering

(PCF) [Reeves et al. 1987]– average multiple shadow tests– NVIDIA’s GPU version

2x2 pattern analogous to bilinear filter Trilinear (mipmap) not possible

Variance Shadow Maps (VSM) [Donnelly et al. 2006]– Probabilistic approach– Filtering z and z2 – Estimates upper bound only

Light leaking artifacts– Precision problems

Courtesy of Donnelly [Demo]

Page 6: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 6/23Convolution Shadow Maps

c

L

Shadow Mapping [Williams 1978]

x R3

p R2 x equals p just in

different spaces Shadow function:

s(x):=f(d(x),z(p)) Binary result:

– 1 if d(x)<=z(p)– 0 else

x

p

d(x)

z(p)

Page 7: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 7/23Convolution Shadow Maps

Shadow test function: s(x) What kind of

function is s(x)?

Heaviside Step Function: H(t)

Sha

dow

term

for x’

c

L

x

p d(x’)z(p)

x’

Page 8: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 8/23Convolution Shadow Maps

c

L

How to filter s(x) ?

x

p

d(x)

z(p)

Filter s(x) “around” p

Assume d(y) ≈ d(x)– d(x) representative

distance for N– Same for PCF

Then we get:

Nq

qpqp )()()( swsw

Nq

qpxqx ))(),(()()( zdfws f

)()),(( px zdfw

Nq

qpyqx ))(),(()()( zdfws f

y

y

N

Nq

p

Page 9: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 9/23Convolution Shadow Maps

Non-linearity of the shadow test =

Filtering shadow test result != filtering z values

Our new solution: Transform depth map such that we can write the shadow test as a sum

))]([),(()()),(( pxpx zwdfzdfw

1if(d,z) = ai(d) Bi(z)

M

i 1s(x) ≈ ai(d(x)) Bi(z(p))

Bi(z(p))

(1D function)

z(p)

Page 10: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 10/23Convolution Shadow Maps

s(x) ≈ a1(d) +a2(d) +..+ a4(d)

+..+ a8(d) +..+a16(d)

Reconstruction Example

Page 11: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 11/23Convolution Shadow Maps

Why is this useful? Fill expansion into convolution formula

Convolution on s(x) == convolution on Bi(z(p)) Note: d(x) and z(p) had to be separable! Decoupling d(x) and z(p) enables pre-filtering!

sf (x) = [w * f(d(x), z)](p)

M

i 1 = [w * ai(d(x)) Bi(z)](p)

M

i 1 = ai(d(x)) [w * Bi(z)](p)

Page 12: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 12/23Convolution Shadow Maps

Filtering Example

s(x) ≈

a1(d) +..+a4(d)

+…+

a8(d) +..+a16(d)

sf (x) ≈

a1(d) +..+a4(d)

+…+

a8(d) +..+a16(d)

Original Bi(z) After filtering Bi(z)

[w * Bi(z)]

Page 13: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 13/23Convolution Shadow Maps

Approximate shadow test with Fourier series

What expansion do we use?

)(tH c1 +c2 +..+c4 +..+c8 +..+c16

Page 14: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 14/23Convolution Shadow Maps

Important properties of a Fourier series Step function becomes sum of weighted sin()

Series is separable!

Constant error due to shift invariance

)sin()cos()cos()sin()sin( zdzdzd

)(tH c1 +c2 +..+c4 +..+c8 +..+c16

Page 15: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 15/23Convolution Shadow Maps

Anti-aliased shadows (SM: 5122) Trilinear filtering and additional convolution

PCF (NVIDIA) CSM CSM – 7x7 Gauss

Page 16: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 16/23Convolution Shadow Maps

Tree scene (SM: 20482) Mipmapped CSM recovers fine details

PCF (NVIDIA) CSM CSM – 7x7 Gauss

Page 17: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 17/23Convolution Shadow Maps

Blurred Shadows

1282

1282

2562

2562

5122

5122

10242

10242

Filte

r siz

e: 7

x7Fi

lter s

ize:

3x3

SM:

SM:

Page 18: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 18/23Convolution Shadow Maps

Issues with a Fourier series Ringing suppression

– Reduce higher frequencies Steepness of “ramp”

– Offset (transl. invariance!) Shift shadow test Increases lightness prob.

– Scaling Scale shadow test Decreases filtering

See paper for tradeoffs

Page 19: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 19/23Convolution Shadow Maps

Limitations and drawbacks Influence of reconstruction order M

Memory consumption increases as M grows Performance (filtering) decreases as M grows

M = 1M = 2M = 4M = 8M = 16

Page 20: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 20/23Convolution Shadow Maps

Performance and Memory Frame rate for complex scene (see video) ~365k

polygons (NVIDIA GeForce 8800-GTX)

Requires (M/2) 8-bit RGBA textures Apply convolution to each texture

C=3x3 2562 5122 10242 20482

M=4 63 61 57 43

M=8 53 50 44 30

M=16 42 39 32 19

PCF 76 74 71 69

01020304050607080

1 2 3 4

SM resolution

FPS

CSM M=4 CSM=8 CSM=16 PCF

256 512 1024 2048

Page 21: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 21/23Convolution Shadow Maps

Conclusion CSM, a new data structure which enables pre-

filtering of shadow maps– Mipmaps

High quality screen-space anti-aliasing for shadow rendering– Improved temporal coherence

Additional convolution conceals discretization artifacts

Page 22: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 22/23Convolution Shadow Maps

Outlook and Extensions New separable expansion

– Less memory– Higher performance– Better quality at contact points

Rendering approximate Soft shadows– Efficient algorithm based on spatial relations

Page 23: Convolution Shadow Maps * MPI Informatik Germany  Hasselt University Belgium  University College London UK T. Annen * T. Mertens  P. Bekaert  H.-P.

EGSR 2007 - Grenoble 23/23Convolution Shadow Maps

Video