Top Banner
Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto
38

Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Mar 27, 2015

Download

Documents

Vanessa King
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Fast Soft Self-Shadowing on Dynamic Height Fields

John Snyder

Microsoft Research

Derek Nowrouzezahrai

University of Toronto

Page 2: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Related Work

• horizon mapping [Max88; …]

– hard shadows– precomputed for static geometry

[Sloan&Cohen00]

Page 3: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Related Work

• shadow map filtering [Reeves87; …]

– light “bleeding” artifacts– small light sources– no complex environmental lighting

[Donnelly06]

Page 4: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Related Work

• ambient occlusion [Bunnell05; Kontkanen05; …]

– AO in screen-space [Shanmugam07;…]

– “cone” blocker model [Heidrich00;…]

[Oat07]

[Dimitrov08]

Page 5: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Related Work

• static relighting [Sloan02; Ng04; …]

• dynamic relighting [Bunnell05, Ren06, Sloan07]

Page 6: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Goals

• strong response to lighting direction (cast shadows)

low-frequency SH [Ren06]ambient occlusion

Page 7: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Goals

• strong response to lighting direction (cast shadows)• environmental + directional lighting

Page 8: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Goals

• 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

Page 9: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

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

2. 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 + Σ over wedges}

Summary of Main Ideas

Page 10: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Horizon Map [Max88]

height field: z=f(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.

Page 11: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

Page 12: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 13: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 14: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 15: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 16: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 17: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 18: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 19: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

t

Page 20: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Calculating the Horizon Map

t

yxftytxft

),()sin,cos(tanmax),( 1

),0(

x

Problem: aliasing – need many samples in t.Solution: prefilter height field, apply multi-scale derivative.

t

max

Page 21: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

As t ↑, i ↑ : sample coarser levels further from x.

Multi-Resolution Approximation

i

iiiiii d

yxfdydxfdfD

),()sin,cos(),,,(

x

kii ld 2

multi-scale derivative

sampling distance for level i

if pyramid level i

fi fi-1 fi-2 fi-3

di di-1

di-2di-3

Page 22: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

i i-1 i-2 i-3

Multi-Resolution Horizon Angle

horizon angle sample i

di di-1

di-2di-3

),,,(tan 1iii dfD x

Page 23: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Up-sample coarser levels with 2D B-splines:

Reconstruct blocking angle function with 1D B-splines:

)),,(),...,,,(,(spline-b),,( 1100 NN dxdxx

i i-1 i-2 i-3

Multi-Resolution Horizon Angle

knot

mid

Take max over sample knots and midpoints:),,(max),(

}1,0{

xx

N

Page 24: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Pyramid Level Step

• k = 1 (standard power-of-2 pyramid) abrupt transitions

• k = 4 smoothes transitions

k = 1 k = 2 k = 3 k = 4

Page 25: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Pyramid 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

Page 26: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

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

2. 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 + Σ over wedges}

Summary of Main Ideas

Page 27: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Reconstructing 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

Page 28: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Projecting Visibility to SH

• Project visibility wedge to SH (order 4)

• fix i = 0 and Δφ. Store as 2D table

• Visibility for a single wedge

otherwise. 1,

)( and ] ,[ if ,0),( 1

iiv

S

ibabai dsv )(),,(),( sysv

Page 29: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Reconstruct Full Visibility

• (N – 1) table lookups + (N – 1) SH Z-rotations

rotate wedge from i = 0 to azimuthal direction

• Sum over all wedges

• N azimuthal sampling directions N horizon angles• (N – 1) adjacent horizon angle pairs (wedge boundaries)

All operations (including horizon angle calculation) in a single

GPGPU shader. See [Snyder08] for full source code.

Page 30: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Azimuthal Swaths

• azimuthal swaths contain many visibility wedges– key lights: restrict swath

– env lights: use complete swath

get sharper shadowsacts as a geometric maskonly sample where necessary

Page 31: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Soft Shadowed Shading with SH

xV visibility vector at x

diffuse reflectance: clamped

cosine around normal Nx

L lighting environment

)( xH N

xN

wedges

izrot ) ,(

Page 32: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Soft Shadowed Shading with SH

LHV xx ),(, N SH triple product

xV )( xH N

or

BRDF x Visibility SH Product

and dot with lighting

xT

LTx ,

Page 33: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Comparison with Ground Truth

ground truth k = 1, o = 1 k = 2, o = 2 k = 3, o = 3 k = 4, o = 4

Page 34: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Measured PerformanceHF resolution pyramid levels FPS (key only) FPS (env + key)

256x256(130k triangles)

33 165 57.2

512x512(522k triangles)

37 34.5 11.5

1024x1024(2.1M triangles)

41 7.05 2.48

Page 35: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Image Results

Page 36: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Video Results

Clip 1

Clip 2

Page 37: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Conclusions

• 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

Page 38: Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto.

Thanks! Any questions?