Probabilistic Approaches to Shadow Maps Filtering
-
Upload
marco-salvi -
Category
Technology
-
view
3.579 -
download
1
description
Transcript of Probabilistic Approaches to Shadow Maps Filtering
![Page 1: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/1.jpg)
![Page 2: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/2.jpg)
Probabilistic Approaches to Shadow Maps FilteringMarco SalviPS3 EngineerLucasArts
v1.0
![Page 3: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/3.jpg)
Talk Breakdown
• Motivations and previous work• VSM extensions to many
moments• PDFs models• Higher order moments• Exponential shadow maps• Conclusions and Q&A
![Page 4: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/4.jpg)
Motivations• PCF is very popular, but..
• ..need many samples to fight aliasing• ..only scales linearly with sample count• ..difficult to re-use previous computations on
neighbouring pixels
• Can we do any better than PCF?• ultimately inspired by VSM paper
![Page 5: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/5.jpg)
Statistics 101(in a slide..)
• Probability Density Function (PDF) of a random variable
• Describe the probability that a random event can take place.
• Raw nth moment
N
i
ni
nn x
NxE
1
1
x
![Page 6: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/6.jpg)
Previous Work Variance Shadow Maps (1/2)
• Depth samples are seen as an (unknown a priori) PDF
• PDF represented by first two raw moments, pre-filterable with separable filters!
• moments can be hw filtered and mip-mapped
• Occlusion as an upper bound for probability of being in shadow
• Chebyshev’s inequality (CI)
![Page 7: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/7.jpg)
Previous Work Variance Shadow Maps (2/2)
• Light bleeding
• Only two moments are not enough to represent any PDF
![Page 8: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/8.jpg)
Many Moments (1/2)
• Natural extension to VSM• to compute extra moments is easy
• Generalize CI to higher moments• a very tough problem
• First 3rd and 4th order moments inequalities exist..
• ..expensive to evaluate
![Page 9: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/9.jpg)
Many Moments (2/2)
• Numerical accuracy issues with computations involving higher order moments
• Would need double precision math
• VSM still more robust/looks better
• These naïve extensions to VSM simply don’t work very well
![Page 10: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/10.jpg)
PDFs Models (1/5)
• We can adopt an a priori distribution model for our PDFs
• Abandon inequalities and compute occlusion evaluating model’s CDF
• Many distribution types available• Dirac, triangular, gauss, etc..• N ‘free’ parameters: mean, variance,
skewness, kurtosis, etc..
![Page 11: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/11.jpg)
PDFs Models (2/5)Rendering steps
1. Render N moments• Mip map and filter them!
2. Use method of moments to fit a distribution to its moments• Solve a (sometimes non) linear NxN
system of equations
3. Evaluate CDF to compute the occlusion term
![Page 12: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/12.jpg)
PDFs Models (3/5)A simple example
• Normal distribution as PDF model
• A function of mean and variance
• Fit it to first two moments
21,mm
2
212
2
1
222
1
mm
m
m
m
![Page 13: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/13.jpg)
PDFs Models (4/5)A simple example
• Occlusion (CDF) is a function of mean, variance and receiver depth
• Image quality comparable to VSM• Same light bleeding issues
2
21
2
recverf
occl
![Page 14: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/14.jpg)
PDFs Models (5/5)
• Other models possible• For example mixtures of two Dirac
or Normal distributions (3 and 5 free parameters)
• Require to render more moments and to iteratively solve (per pixel) complex non linear systems
![Page 15: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/15.jpg)
Higher Order Moments (1/6)
• Markov’s Inequality (MI)
• First order moment represents the whole depth distribution
R
OEROPOcclusion
OE
![Page 16: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/16.jpg)
Higher Order Moments (2/5)
![Page 17: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/17.jpg)
Higher Order Moments (3/6)
• No VSM-like light bleeding • Because variance is not used
• Markov’s upper bound is not good, it converges to zero too slowly
• Light bleeds everywhere, two LB types:
1.Translation dependant (absolute LB)2.Translation independent (relative LB)
![Page 18: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/18.jpg)
Higher Order Moments (4/6)
• MI still holds if its terms are replaced with f(x), a positive and monotonically increasing function :
• A good candidate for f(x) is
)(
)()()(
Rf
OfERfOfP
nx
![Page 19: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/19.jpg)
Higher Order Moments (5/6)
Varying n we get higher order moments:
No pre-filtering, one sample per pixel
![Page 20: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/20.jpg)
Higher Order Moments (6/6)
• Higher order moments reduce light bleeding with no over darkening
• A very simple algorithm• Render only one moment• MI can be evaluated with a single filtered sample and one division
![Page 21: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/21.jpg)
Exponential Shadow Maps (1/7)
• How to remove absolute light bleeding?
• Need a new f(x) that makes MI invariant under translations
• It can be shown that such a function has to satisfy the following equation: xfkxf
dx
d
![Page 22: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/22.jpg)
Exponential Shadow Maps (2/7)
• The previous well known differential equation admits a simple solution:
• Yes, we have to render• As with VSMs we can still pre-filter
and sample the (exponential) shadow map in the usual ways
kxeCxf depthk exp
![Page 23: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/23.jpg)
Exponential Shadow Maps (3/7)
512x512x4 bytes (fp32)5x5 box filter, 4 separable passes
![Page 24: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/24.jpg)
Exponential Shadow Maps (4/7)
• Runs out of range pretty soon• ln (max_fp32) ≈88
• Workaround: render linear depth and pre-filter in ln space:
• Pre-filtering is still very fast and it also simplifies occlusion computations
XYYX ewwxewew 1010 ln
![Page 25: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/25.jpg)
Exponential Shadow Maps (5/7)
• A detour: Convolution Shadow Maps• Assume planar receiver within a filtering region• Depth test approximated via Fourier expansion• Render N expansion terms
• ESM is equivalent to CSM where depth test is approximated with exp(O-R)
• Render only one term!• Potential light bleeding with no planar receiver• Can be reduced via over-darkening
![Page 26: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/26.jpg)
Exponential Shadow Maps (6/7)
Overdarkening can reduce light bleeding
![Page 27: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/27.jpg)
Exponential Shadow Maps (7/7)
• Tweak amount of relative LB with a scale factor K:
• Over darken shadows to control LB due to not planar receivers:
occluder = K * depth
occlusion = exp(Ko *(filtered_occluder-receiver))
![Page 28: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/28.jpg)
Conclusions (1/2)
• All techniques presented:• Allow to use separable filters and
hardware filtering & mipmaps support
• Reduce shadow maps aliasing• Are orthogonal to exotic shadow
maps projection schemes (LiSPSM, TSM, ...)
• Greatly reduce self-shadowing and shadow maps acne artifacts
![Page 29: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/29.jpg)
Conclusions (2/2)
• No presented technique is entirely satisfactory
• Must get rid of light bleeding associated to non planar receivers
• High order and exponential shadow maps
• A lot of work still to be done!• Hope to have inspired you
![Page 30: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/30.jpg)
Q&AIf you have any question, please contact me:email: [email protected]: http://pixelstoomany.wordpress.com
For more details about Exponential Shadow Maps please refer to:“Rendering Filtered Shadows with Exponential Shadow Maps”
Marco Salvi, ShaderX6, edited by W. Engel. Charles River Media, 2008.
![Page 31: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/31.jpg)
Bibliography (1/2)
[Williams83] Williams, Lance. “Pyramidal Parametrics”, SIGGRAPH83 Proceedings, Vol. 17, No. 3, July 1983".
[Reeves87] William T. Reeves, David H. Salesin, Robert L. Cook “Rendering anti aliased shadows with depth maps”, SIGGRAPH87 Proceedings, (July, 1987), pp. 283-291[Lokovic00] Tom Lokovic and Eric Veach, “Deep Shadow Maps.” SIGGRAPH 2000 Proceedings (August 2000), Addison-Wesley.
[Philips95] Thomas K. Philips, Randolph Nelson, “The Moment Bound Is Tighter Than Chernoff's Bound for Positive Tail Probabilities”, The American Statistician, Vol. 49, No. 2 (May, 1995), pp. 175-178
[Lokovic00] Tom Lokovic and Eric Veach, “Deep Shadow Maps.” SIGGRAPH 2000 Proceedings (August 2000), Addison-Wesley.
[Amour04] Jean-Francois St. Amour, Eric Paquette, et al.”Real Time Soft Shadows Using the PDSM Technique.” ShaderX4, edited by W. Engel. Charles River Media, Hingham, MA, 2005.
[Martin04] Tobias Martin and Tiow-Seng Tan ,”Anti-aliasing and Continuity with Trapezoidal Shadow Maps”, Proceedings of Eurographics Symposium on Rendering, 21-23 June 2004, Norrköping, Sweden, page 153-160 (text) and page 412 (color plate)
![Page 32: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/32.jpg)
Bibliography (2/2)
[Wimmer04] Michael Wimmer, Daniel Scherzer, Werner Purgathofer, “Light Space Perspective Shadow Maps” , Eurographics Symposium on Rendering 2004 [Schueler05] Schueler, Christian. “Eliminating Surface Acne with Gradient Shadow Mapping.” ShaderX4, edited by W. Engel. Charles River Media, Hingham, MA, 2005. [Donnelly06] William Donnelly, Andrew Lauritzen, “Variance Shadow Maps” Symposium on Interactive 3D Graphics and Games Proceedings (2006), ACM [Engel06] Wolfgang Engel, “Cascaded Shadow Maps”, ShaderX5, edited by W. Engel. Charles River Media, Hingham, MA, 2006. [Annen07] Thomas Annen, Tom Mertens, Philippe Bekaert, Hans-Peter Seidel, Jan Kautz, “Convolution Shadow Maps”, Rendering Techniques 2007: Eurographics Symposium on Rendering, June 2007.
[Salvi08] Marco Salvi, “Rendering Filtered Shadows with Exponential Shadow Maps”, ShaderX6, edited by W. Engel. Charles River Media, Hingham, MA, 2008.
![Page 33: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/33.jpg)
Appendix (1/2)
ESM: constant light bleeding
![Page 34: Probabilistic Approaches to Shadow Maps Filtering](https://reader036.fdocuments.in/reader036/viewer/2022062707/55866a79d8b42a36488b46d9/html5/thumbnails/34.jpg)
Appendix (2/2)
ESM, distance based light bleeding