Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sample Based Visibility for Soft Shadows using Alias-free Shadow Maps Erik Sintorn – Ulf Assarsson – uffe.

Similar presentations


Presentation on theme: "Sample Based Visibility for Soft Shadows using Alias-free Shadow Maps Erik Sintorn – Ulf Assarsson – uffe."— Presentation transcript:

1 Sample Based Visibility for Soft Shadows using Alias-free Shadow Maps Erik Sintorn – erik.sintorn@chalmers.seerik.sintorn@chalmers.se Ulf Assarsson – uffe at chalmers dot seuffe at chalmers dot se ElmarEisemann – elmar.eisemann@inrialpes.fr

2 Introduction – Shadow Map Aliasing A common technique for rendering shadows is Shadow Maps (Williams L, 1978) Scene rendered as seen from camera Scene rendered as seen from light Depth of closest fragments Are rendered to shadow map Several screen samples end Up in the same light-space texel

3 Introduction – Shadow Map Aliasing (cont) To get rid of aliasing several methods have been suggested – Shadow Volumes (Crow F C, 1977) – Methods for better adaption of shadow map Martin T, Tan T.-S: Antialiasing and continuity with trapezoidal shadow maps Wimmer M, Scherzer D, Purgathofer W: Light space perspective shadow maps Lefohn A E, Sengupta S, Owens J D: Resolution mapped shadow maps – Alias free shadow maps Aila T, Laine S: Alias free shadow maps Johnson G S, Lee J, Burns C A, Mark W R: The irregular z-buffer: Hardware acceleration for irregular data structures Arvo J, Alias free shadow maps using graphics hardware

4 Introduction – Soft Shadows There is no such thing as point lights umbra penumbra

5 Introduction – Soft Shadows In raytracing, several random rays are shot towards the light volume

6 Introduction – Soft Shadows (cont) Very much work has been done on soft shadows The papers most related to ours are: – Laine S, Aila T, Assarsson U, Akenine-Möller T: Soft Shadow Volumes for ray tracing. – Lethinen J, Laine S, Aila T: An improved physically based soft shadow algorithm. – Eisemann E, Décorét X: Visibility Sampling on GPU and applications

7 Alias Free Hard Shadows Transform and project view-samples into lightspace, then store in a compact datastructure with a list per lightspacetexel 1: Construction of Alias Free Shadow Map

8 Alias Free Hard Shadows Render all geometry (conservatively) from lights point of view and for each generated fragment, test all view-samples in that list against the triangle and set the corresponding bit in the output if occluding. 1: 2: Usage of Alias Free Shadow Map

9 Alias Free Hard Shadows Finally, use the result from the previous step and the SM datastructure in a fullscreen pass over the camera-view image to find shadowing information for each pixel 1: 2: 3: Applying shadow map

10 Alias Free Hard Shadows 1: 2: 3: Creating the SM Data Structure in CUDA Atomically increase the size for the corresponding list 23001 00112 10101 01102 Transform light sample to light space And save the previous value for each view-sample 01012 ………… 0 …………… …………… Kernel

11 Alias Free Hard Shadows 1: 2: 3: Creating the SM Data Structure in CUDA 23001 00112 10101 01102 02555 66678 10 11 11 12 12 13 13 14 15 15 Running Sum Scan 22

12 Alias Free Hard Shadows 1: 2: 3: Creating the SM Data Structure in CUDA 23001 00112 10101 01102 02555 66678 10 11 11 12 12 13 13 14 15 15 01012 …………0 …………… …………… The size of each list Starting index of each list List index of each view-sample Compact array of lists Resulting SM Data Structure:

13 Alias Free Hard Shadows 1: 2: 3: Render geometry in lightspace, like classic Shadow Maps but: For each triangle For each generated fragment Fragment coordinates gives us size of list and list pointer Loop over all samples and set corresponding bit if triangle occludes sample Blending with OR operation finally gives us occlusion information for each view sample 23001 00112 10101 01102 01012 …………0 …………… ……………

14 Alias Free Hard Shadows 1: 2: 3: 23001 00112 10101 01102 01012 …………0 …………… …………… In a final pass we draw a fullscreen quad over the image For each pixel, the view-sample is obtained and is reprojected into lightspace With the lightspace coordinates we can look-up the occlusion result The list index for each sample tells us which bit to check Draw shadow if bit is set

15 Conservative Rasterization We use a simplified version of Jon Hasselgren,TomasAkenineMöllers and LennartOlssons method from GPU gems 2, with the modification that we: – Always output six vertices per triangle – Easily implemented in a geometry shader – Can be overconservative by at most one pixel per vertex

16 Alias free hard shadows results 44k triangles, 66 fpsTiny demo

17 Soft Shadows To render soft shadows we need only minor changes to the last two steps of the algorithm 1: 2: 3: umbra penumbra

18 Soft Shadows To render soft shadows we need only minor changes to the last two steps of the algorithm 1: 2: 3: 101000101101101 … View Sample: 1 2 3 4 5 6 7 8 9 10 11 12 … n Visibility of view-sample 11 from light source Occlusion result for hard shadows: 101000101101101 … View Sample: 1 2 3 N Visibility of view-sample 3 from light-sample 3 Light Sample: 1 2 3 4 1 2 3 4 1 2 3 4 … 2 3 4 Occlusion result for soft shadows:

19 Soft Shadows Finding occlusion results for all light-samples 1: 2: 3: Light Samples View-sample

20 Soft Shadows Plane makes two angles and a distance with the light source 1: 2: 3: distance

21 Soft Shadows Plane makes two angles and a distance with the light source 1: 2: 3:

22 Soft Shadows Texture lookup gives us all samples NOT occluded: texelFetch(d, ϕ, θ)=000010000 1: 2: 3:

23 Soft Shadows 1: 2: 3: 000010000 011100000 000000111 OR 000110111 011110111 011111111 000111111 111110111 AND 011110111 Edge results are OR:ed for each triangle Triangle results are AND:ed per view-sample

24 Soft Shadows 1: 2: 3: Receiver Plane Volumetric Light Source Influence Region

25 Soft Shadows 1: 2: 3: 23001 00112 10101 01102 01012 …………0 …………… …………… The shadow is now written as the fraction of bits set in the occlusion test result for each fragment

26 Results Hard shadows 44k triangles 66 fps

27 Results

28 256 light samples, ~6k triangles

29 Results 379k triangles: Shadow Rays (P4 3.06 GHZ): 964 seconds Modelled by SamuliLaine Soft Shadow Volumes: 75 seconds Soft Shadows using alias free shadow maps: 1.5 sec

30 Demo


Download ppt "Sample Based Visibility for Soft Shadows using Alias-free Shadow Maps Erik Sintorn – Ulf Assarsson – uffe."

Similar presentations


Ads by Google