Presentation is loading. Please wait.

Presentation is loading. Please wait.

Real-Time Soft Shadows with Adaptive Light Source Sampling

Similar presentations


Presentation on theme: "Real-Time Soft Shadows with Adaptive Light Source Sampling"— Presentation transcript:

1 Real-Time Soft Shadows with Adaptive Light Source Sampling
Michael Schwärzler Supervisor: Oliver Mattausch Institute of Computer Graphics and Algorithms Vienna University of Technology

2 Outline Introduction Adaptive Light Source Sampling
Shadows in Computer Graphics SOFT Shadows Fake vs. physical correct approaches Adaptive Light Source Sampling Generating samples Reprojection step Comparison step Rendering n Light Source Samples Results Limitations Conclusion Michael Schwärzler

3 Introduction – Shadows
provide information on the relative position of an object in space reveal presence of occluded objects provide information on light source size Help to estimate the geometry of the receiver Hard shadow algorithms widely used in games & applications! Cast by point light sources! Binary decision Algorithms: Shadow Volumes algorithm Shadow Mapping algorithm (see previous talk) Michael Schwärzler

4 Introduction – SOFT Shadows
are cast by area light sources  3D visibility problem  longer rendering time! consist of umbra & penumbra significantly increase the realism hide border artifacts Umbra & penumbra extents depend on relationship between light source size, distance from occluder to receiver and distance from light source to occluder Fast & correct calculation of soft shadows is a complex task & area of active research! Michael Schwärzler

5 Introduction – SOFT Shadows
Rendering physically correct soft shadows with real-time frame rates (>60 fps) is hard to achieve! Physically correct approaches Take samples from all over the light source, sum them up Computationally expensive! „fake“ approaches PCSS, backprojection, … Human visual system not very sensitive to the geometrical correctness of soft shadows… Calculated using a single sample from the middle of the light source  hard shadow Fake penumbra is estimated & added to the umbra Problems: several occluders, large light sources, incorrect penumbra estimation Michael Schwärzler

6 Adaptive Light Source Sampling
Size of penumbra regions hard to predict Sampling density has to be constantly high to guarantee smooth shadow transitions Taking many samples is expensive Adaptive Light Source Sampling: Select sampling points adaptively Selection is view-dependant Avoid generation and evaluation of shadow maps which do not contribute to an increased image quality  rendering time can be saved Physically correct shadows! quality and accuracy comparable to shadows which are generated with a fixed sampling rate Michael Schwärzler

7 Adaptive Light Source Sampling
Generation of samples: Start with initial shadow maps Compare maps If necessary: subdivide 1D-Source: 2D-Source: Michael Schwärzler

8 Adaptive Light Source Sampling
Reprojection & Comparison Step: Shadow maps are reprojected into same space  can be compared there Projection Center: View Point  makes the comparison result view-dependant! Compare depth values: Values are considered equal if: Output depth = 1.0 Otherwise: Output depth = 0.0 Michael Schwärzler

9 Adaptive Light Source Sampling
Get number of pixels with different depths: Exploit hardware occlusion query! Used to determine the visibility of an object Returns the number of pixels which pass the z-Test! Example: Draw bounding box of detailed object  only if the query returns a value > 0, the detailed object has to be drawn! In our case, the occlusion query returns the number of pixels p which are considered to be different in the two compared shadow maps! We evaluate a simple error metric: If this condition is true, new sample is created in-between the compared ones! A contribution weight is assigned to each sample Depends on subdivision depth: Michael Schwärzler

10 Rendering n Shadow Maps
By simply summing up the hard shadows values multiplied with their corresponding weights, we obtain the fragment’s occlusion value! But: Today‘s shaders can only sample a limited amount of textures!  only a small number of shadow maps can be evaluated in a single pass Solution 1: Use a „Deferred Rendering“ System Evaulate each shadow map in a single pass, store result in accumulation buffer In a final pass, render scene geometry with information from shadow buffer! Drawbacks: Additional memory for accumulation buffer needed, more read/write Solution 2: Use Texture Arrays Store each shadow map in array Access all shadow maps in the array in a single pas Drawbacks: Only in newer render APIs, Texture Arrays could be faster… Michael Schwärzler

11 Results Goal of our algorithm:
Improve generation of physically correct soft shadows Adaptively select only light source samples which contribute to visual quality of penumbrae. In nearly all our tests, our approach performed better than a version with 128 fixed equally distributed samples: In scene configurations with small penumbra regions: real-time <= 50 shadow maps: at least twice as fast Worst case (very large penumbra, fills wide area of frame buffer): performance of our algorithm worse same number of shadow maps plus the reprojection and comparison steps! ~66% of the speed of the sampling approach with 128 fixed equally distributed samples. Michael Schwärzler

12 Results: 128 SMs 11 FPS 7 SMs >60 FPS 128 SMs 5 FPS 44 SMs 10 FPS
Michael Schwärzler

13 Results: 128 SMs 3 FPS 28 SMs 12 FPS Michael Schwärzler

14 Results: 81 SMs 12 FPS 14 SMs 40 FPS Michael Schwärzler

15 Results Limitations: Frame rate not constant
Global error metric is not perfect…  When hardly any shadows are visible on the screen, the number of differing pixels on the screen is very low In such a case, the algorithm will stop the subdivision - no matter how coarse the shadow boundaries are Very small light leaks can be missed due to the global error metric as well Michael Schwärzler

16 Conclusions Our method makes it possible to render physically accurate soft shadows in most cases faster than the regular light sampling method with a fixed sampling rate Only samples which contribute to the visual quality are computed and evaluated The subdivision decision is made by reprojecting neighboring shadow maps to the camera’s point of view and comparing them there using a hardware occlusion query The time needed for these checks is compensated by the reduced number of shadow maps which have to be calculated Future work: Find a better error metric for the decision whether more sampling points are needed or not! Michael Schwärzler

17 Thank you for your attention!
End Thank you for your attention! Michael Schwärzler


Download ppt "Real-Time Soft Shadows with Adaptive Light Source Sampling"

Similar presentations


Ads by Google