Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Fast Soft Self-Shadowing on Dynamic Height Fields John Snyder Microsoft Research Derek Nowrouzezahrai University of Toronto."— Presentation transcript:

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

2 Related Work horizon mapping [Max88; …] – –hard shadows – –precomputed for static geometry [Sloan&Cohen00]

3 Related Work shadow map filtering [Reeves87; …] – –light bleeding artifacts – –small light sources – –no complex environmental lighting [Donnelly06]

4 Related Work ambient occlusion [Bunnell05; Kontkanen05; …] – –AO in screen-space [Shanmugam07;…] – –cone blocker model [Heidrich00;…] [Oat07] [Dimitrov08]

5 Related Work static relighting [Sloan02; Ng04; …] dynamic relighting [Bunnell05, Ren06, Sloan07]

6 Goals strong response to lighting direction (cast shadows) low-frequency SH [Ren06] ambient occlusion

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

8 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

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

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

11 Calculating the Horizon Map

12 t

13 t

14 t

15 t

16 t

17 t

18 t

19 t

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

21 Brute Force Sampling Requirements

22 As t, i : sample coarser levels further from x. Multi-Resolution Approximation multi-scale derivative sampling distance for level i pyramid level i fifi f i-1 f i-2 f i-3 d i d i-1 d i-2 d i-3

23 i i-1 i-2 i-3 Multi-Resolution Horizon Angle horizon angle sample i d i d i-1 d i-2 d i-3 ),,,(tan 1 iii dfD x

24 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

25 non-smooth interpolation (e.g. bilinear) shadow artifacts use 1D b-spline for horizon angle vs. distance ( i ) use 2D b-spline for heights ( f i ) Smooth Interpolation linear+bilinearb-spline+bilinearlinear+b-splineb-spline+b-spline

26 Pyramid Level Step k = 1 (standard power-of-2 pyramid) abrupt transitions k = 4 smoothes transitions k = 1k = 2k = 3k = 4

27 Pyramid Level Offset pyramid level bias when sampling height differences increasing bias increases shadow sharpness increases sampling requirements o = 0o = 1o= 2o = 3o = 4

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

29 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

30 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 ii v S ibabai dsv)(),,(),(sysv

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

32 Azimuthal Swaths azimuthal swaths contain many visibility wedges –key lights: restrict swath –env lights: use complete swath get sharper shadows acts as a geometric mask only sample where necessary

33 Restricted Swaths smaller swaths sharper shadows approach limit determined by SH order Δ φ = 90° Δ φ = 45 ° Δ φ = 22.5 ° Δ φ = 11.25 °

34 Soft Shadowed Shading with SH visibility vector at x diffuse reflectance: clamped cosine around normal N x lighting environment )( x HN x N wedges iz rot),(

35 Soft Shadowed Shading with SH SH triple product )( x HN or BRDF x Visibility SH Product and dot with lighting

36 Comparison with Ground Truth ground truth k = 1, o = 1k = 2, o = 2k = 3, o = 3k = 4, o = 4

37 Measured Performance HF resolutionpyramid levelsFPS (key only)FPS (env + key) 256x256 (130k triangles) 3316557.2 512x512 (522k triangles) 3734.511.5 1024x1024 (2.1M triangles) 417.052.48

38 Image Results

39 Video Results Clip 1 Clip 2

40 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

41 Future Work subsample visibility combine with dynamic shadow casters –via [Ren06;Sloan07] (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

42 Thanks! Any questions?

43 Restricted Swaths For partial swaths, only directions affected by key light are sampled Sharper shadows than possible with SH visibility over all directions!

44 Reconstructing Visibility So far discussed sampling single azimuthal directionSo far discussed sampling single azimuthal direction –Large lights require many directional samples Calculate horizon angle in many azimuthal directionsCalculate horizon angle in many azimuthal directions -Combine together, forming visibility wedges -Combine together, forming visibility wedges [Dimitrov08] Canonically reposition φ i = 0, tabulate SH projection as 2D LUT for fixed azimuthal spacing.Canonically reposition φ i = 0, tabulate SH projection as 2D LUT for fixed azimuthal spacing.

45 Pyramid Level Step Control the sample spacing reductionControl the sample spacing reduction –pyramid level i : –sample spacing at level i : )(xf i k = 4 smoothes transitionk = 4 smoothes transition –k is the level step –k = 1 standard level-of-2 pyramid (e.g. MIP) –we use k = 4 storage 3.4x original HF

46 As t, i : sample coarser levels further from x Get angles from height differences : ),,,(tan),,( 1 iiiii dxfDdx ),,(max),( }1,0{ xx N i iiii ii d yxfdydxf dxfD ),()sin,cos( ),,,( where and l is the step size. )2( kii i llbd Recall: Sample t discretely with a multi-scale derivative … Multi-resolution Horizon Map

47 Background The rendering equation for direct illumination isThe rendering equation for direct illumination is dsssxvssxfsxLsxL outr S inout )cos(),(),,(),(),(

48 Background The rendering equation for direct illumination isThe rendering equation for direct illumination is assume a diffuse BRDF and combine the reflectance and the cosine term dsssxvssxfsxLsxL outr S inout )cos(),(),,(),(),( dsxTsxL sxvNxhsxLxL S inx S )(),(),(),(),()(

49 Background The rendering equation for direct illumination isThe 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 xxx TLVNHLxL )()( dsxTsxL sxvNxhsxLxL S inx S )(),(),(),(),()( dsssxvssxfsxLsxL outr S inout )cos(),(),,(),(),(

50 Putting it all together Height field geometry uniform grid of height valuesHeight field geometry uniform grid of height values Generated on the CPU or GPUGenerated on the CPU or GPU –stored in a texture A multi-resolution height pyramid is generated on-the-flyA multi-resolution height pyramid is generated on-the-fly –avoid large sampling rates as distance from receiver point increases Max blocking angles are determinedMax blocking angles are determined –Fast LUT fast SH Z-rotation generate visibility At every step: Re-generate height-field and pyramidRe-generate height-field and pyramid Determine total SH visibility over each azimuthal swathDetermine total SH visibility over each azimuthal swath Shade with SH triple productShade with SH triple product

51 Putting it all together Height field geometry uniform grid of height valuesHeight field geometry uniform grid of height values Generated on the CPU or GPUGenerated on the CPU or GPU –stored in a texture A multi-resolution height pyramid is generated on-the-flyA multi-resolution height pyramid is generated on-the-fly –avoid large sampling rates as distance from receiver point increases Max blocking angles are determinedMax blocking angles are determined –Fast LUT fast SH Z-rotation generate visibility At every step: Re-generate height-field and pyramidRe-generate height-field and pyramid Determine total SH visibility over each azimuthal swathDetermine total SH visibility over each azimuthal swath Shade with SH triple productShade with SH triple product

52 Putting it all together Height field geometry uniform grid of height valuesHeight field geometry uniform grid of height values Generated on the CPU or GPUGenerated on the CPU or GPU –stored in a texture A multi-resolution height pyramid is generated on-the-flyA multi-resolution height pyramid is generated on-the-fly –avoid large sampling rates as distance from receiver point increases Max blocking angles are determinedMax blocking angles are determined –Fast LUT fast SH Z-rotation generate visibility At every step: Re-generate height-field and pyramidRe-generate height-field and pyramid Determine total SH visibility over each azimuthal swathDetermine total SH visibility over each azimuthal swath Shade with SH triple productShade with SH triple product

53 Putting it all together Height field geometry uniform grid of height valuesHeight field geometry uniform grid of height values Generated on the CPU or GPUGenerated on the CPU or GPU –stored in a texture A multi-resolution height pyramid is generated on-the-flyA multi-resolution height pyramid is generated on-the-fly –avoid large sampling rates as distance from receiver point increases Max blocking angles are determinedMax blocking angles are determined –Fast LUT fast SH Z-rotation generate visibility At every step: Re-generate height-field and pyramidRe-generate height-field and pyramid Determine total SH visibility over each azimuthal swathDetermine total SH visibility over each azimuthal swath Shade with SH triple productShade with SH triple product

54 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


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

Similar presentations


Ads by Google