### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Computer Graphics CAP 4720

University of Central Florida

GPA 3.76

### View Full Document

## 59

## 0

## Popular in Course

## Popular in System Engineering

This 74 page Class Notes was uploaded by Khalil Conroy on Thursday October 22, 2015. The Class Notes belongs to CAP 4720 at University of Central Florida taught by Staff in Fall. Since its upload, it has received 59 views. For similar materials see /class/227225/cap-4720-university-of-central-florida in System Engineering at University of Central Florida.

## Similar to CAP 4720 at University of Central Florida

## Reviews for Computer Graphics

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/22/15

learn etwgr E 1GagneDeveloperS Advanced Soft Shadow Mapping Techniques Louis Bavoil NVIDIA Developer Technology WWW EMEHNFE HM Why Soft Shadows Game EH11 Developer quotquotquot Antialiasing Filtering the shadow edges Area lights Cast penumbra with variable size Shadows hardening on contact 9x9 PCF taps WWWEMHNFEW Why Shadow Mapping for Soft Shadows GamDewlupery quotquotquotquotquotquot Most popular technique for shadows In games Purely imagebased technique Works with any rasterizable geometry Alternative techniques exist Silhouette based techniques such as smoothies and penumbra wedges o Silhouette detection robustness issues Do not work with alphatested geometry WWWElJEllNFElJNl Outline GameDewlupers quotquotquotquotquotquot FixedSize Penumbra PCF Percentage Closer Filtering VSM Variance Shadow Maps CSM Convolution Shadow Maps ESM Exponential Shadow Maps VariableSize Penumbra PCSS Percentage Closer Soft Shadows PCSS VSMCSM Baokprojection WWW EMEHHEEHM Shadow Mapping Eggnogwlupers39 Shadow map stores distance 2 to the light P is lit ltgt d ltz occluder WWW EMEHHEEHM Percentage Closer Filtering PCF GamDewlopery EMUquotmu Sample the result of dltz around projected point Filter the binary results in a given kernel lt3 Bilinear PCF NVIDIA and recent AMD GPUs implement 2x2 PCF in one fetch Using same sample locations and weights as for bilinear filtering WWWElJEllNFElZlNl Using Bilinear PCF with DX1O mommy Texture2Dltfloatgt tDepthMap EMUMn SamplerComparisonState ShadowSampler ComparisonFunc LESS Filter COMPARISONMNMAGLINEARMPPONT sum tDepthMapSampleCmpLevelZeroShadowSampler uv offset 2 WWWEHDMNFEUM PCF Filtering Increasing the number of PCF taps increases the softness of the shadows 9x9 taps 17x17 taps WWWEHDEUHFEHM Irregular PCF ElmeDevelupers quotquotquotquotquot PCF with large kernels requires many samples Using irregular sampling Trades banding for noise regular sampling irregular sampling WWWEl EUHFEHM PCF SelfShadowing Issue GameDewlupery Traditional depth bias write 2 bias in shadow map Bias constant bias slopebased bias Issue huge depth biases may be required for large PCF kernels False occlusion z lt d u d Ground plane depth bias should increase WWWEMUNFEHM GmDewlopers Mmquot Use depth gradient float2dzdu dzdv Make depth d follow tangent plane d dO dotuvoffset gradient Schuler06 and lsidoroO6 Render midpoints into shadow map Midpoint z Z0 Z1 2 Requires two rasterization passes Depth peel two depth layers Still requires a depth bias for thin objects Render backfaces into shadow map Only works for closed objects Light bleeding for large PCF kernels PCF SelfShadowing Solutions midpoints Z1 backfaces WWWElDElll lFEllM Backfaces and Large PCF kernels Rendering backfaces into shadow map generates light bleeding for large PCF kernels Not due to FP precision or shadow map resolution But reverse of the surface acne issue WWWElJEllNFElJN l NonLinearity of PCF GamDewlopery quotquotquotquotquot PCF cannot be prefiltered as is e Average d lt z Average 2 lt d e Filtering the depth buffer would smooth the heightfield of the shadow map Q Does not generate soft shadows May introduce artifacts Solutions Approximate shadow test by a linear function which can be prefiltered Goal blurring the shadow map to generate realistic soft shadows WWWElJEllNFElJNl Outline COMran VSM Variance Shadow Maps CSM Convolution Shadow Maps ESM Exponential Shadow Maps VariableSize Penumbra PCSS Percentage Closer Soft Shadows PCSS VSMCSM Baokprojection WWWEMDHEEDM Variance Shadow Maps Consider depth values in the filter kernel as a depth Ganweavers distribution Donnelly06 Lauritzen07 cordran Approximate the depth values in the kernel by a Gaussian distribution of mean u and variance 02 02 EzZ Ez2 H EZ Probability of being lit Using Chebyshev s inequality Pd lt 2 lt max 2 02 d I02 d lt H EX average ofX in filter kernel So the VSM z zquot2 can be prefiltered Can also be rendered using MSAA resolve WWWEMUNFEW VSM Visibility Function Pldltul maxw2 a2 d I02 d lt u GmDewlupers EMTrant l p d 02 Ezz Ez2 H EZ Pdltp sigmaquot200 sigmaquot200 l sigmaquot20 l sigmaquot210 Selfshadowing can be handled simply by clamping 02 to some small MinVariance parameter llIlWlllllEilmlilllFEllllll 29 VSM Rendering Blur z and 22 e Ez Ezz Fetch Ez EzZ with bilinear texture lookup Can also use trilinear andor anisotropic filtering to reduce aliasing Compute p Ez and 02 EzZ Ez2 If 02 lt MinVariance 02 MinVariance Light intensity approximation L m81X02 02 d I02 d lt H WWWMJWNFEHM Generating the VSM GamDewlopery quotquotquotquotquot Can use R32G32FFLOAT format Filterable format on all DX10class graphic hardware Can also use FP16 Donnelly06 Render 2 22 to VSM texture Where 2 is a linear distance Can use an orthographic projection z mulwPos mObjectToLightOrthoz Clear VSM to MAXZ MAXZMAXZ WWWElJEllNFElZlNl Rendering everything into the VSM shadow map mama Images with and without plane rendered in VSM GD ZuniIan VSM VSM e If receivers are not in the VSM will blur the object texels with z MAXZ missing occlusion e CSMs and ESMs also have this limitation Shadows look bad when blurring shadow map without everything rendered into them WWWGDCDNFBUM VSM Light Bleeding V moms Two quads floating above a ground plane nu high variance 02 I bleeding 9x9 VSM Box Filter 9x9 PCF Large depth complexity in filter kernel 02 is large Upper bound 02 02 d p2 9 1 WWWEMEUNFEUM VSM Light Bleeding Proposed in GPU Gems 3 LauritzenO7 Use a threshold to remap shadow intensity threshold0 threshold02 WWWEMHNFEW Layered VSM Lauritzen08 3D 2008 Partition shadowmap frustum into multiple depth ranges and clamp z to each range T VSM high variance 02 L 1 V ayer Layered VSM At zero variance J Layer 2 l K A bl quotwing WWWEHDEBNFE HM Layered VSM Compared to VSMs LVSMs Reduce or eliminate light bleeding artifacts Do not require 32bit float texture filtering Can still be generated in one pass using MRTs and need only one texture sample per pixel 39V H Contran Variance Shadow Map Layered Variance Shadow lVlap Outline cudran 7 CSM Convolution Shadow Maps ESM Exponential Shadow Maps VariableSize Penumbra PCSS Percentage Closer Soft Shadows PCSS VSMCSM Baokprojection WWW GDEUNFEDM ElmeDewluperS Convolution Shadow Maps quotquotquotquotquotquot 6 Approximate the step function function of depth by 1D Fourier expansion Annen07 12 M 1 2 2 cosckd kl quotk fill 3 IQIi M 1 2 sinckd k219i Function of d Reconstruct when rendering shadows M71 1 M 4 M16 smu kz g 08 g 06 E a 04 cosm z E 8 02 039 0 3965 O 05 fd zi Function OfZ Excerpted from Armen07 Write in shadow map and blur it WWWEMUNFEHM Generating a CSM GmDewlopers MW Assuming a linear depth 2 is available for every teer in the shadow map 2 needs to be normalized in 01 because the Fourier expansion is periodic Can generate CSM with full screen shader pass Rendering to R8G888A8UNORM MRTs 4 MRTs M8 is usually a good tradeoff Background texels cleared to CSM10f WWWEMUNFEW CSM Rendering ElmeDevelupers quotquotquotmquot e Fetch cosckz and smckz from the CSM textures and compute light intensity light 1 M t t 1 AM 1 1 rm M14 f m 2 2 Cos39kdsmqz m M 16 2 kZICR B 08 3 I 1 0396 m 0 5 22 TS11CkCOS RZJ 04 V kzl k E 02 o 0 77m 0 65 o 05 e Flnal IlghtlntenSIty rd z Scale by 2 otherwise fdz 05 for dz L saturate20 fdz WWW EMBHEEDM CSM Light Bleeding Limited bleeding 12 MZ1 may be seen as a H Gila 39 feature deep E 039839 39 shadow look 3 bleeding 39 Light bleeding when 0 should be in shadow 4165 6 05 dgtZ but light gt 0 rd zi WWW ElJElJNlEE lll CSM Ringing g nogvelwers 1 2 GlbbS phenomenon 39 MZ1 High order Fourier a 1 V 12116 terms generate ringing E 039839 i 3 0396 bleeding 7 m 04 Ringing workaround E 02 ng39ng o Attenuate terms based 0 on their order k I 0 55 do 05 2 fd r 2 Z icostklsinckn r 391 l 2 sinc kdcosckz Fi exp0lk39V392 WWW EMBHWDM CSM Ringing mm Light source facing inwards the cube 2 RGBA8 8 RGBA8 W W iii iii if iii M F ii ii iii Exponential Shadow Maps Salvi08 ShaderX6 EmDewrlgpers quot39quotquot Approximate step function zd gt 0 by expkzd expkz expkd Light dltz exp10dz ESM Parameter Tuning L expkz expkd WWW EDEHHFEDM Deep Shadow Look Shadows without any shading Soft shadow test gives translucent look CSM VSM ESM WWW EDEDNFEUM VSMCSMESM GameDewlupers quotquotquotquotquot Parameters VSM MinVariance BleedingReductionFactor CSM NumTextures AbsorptionFactor ESM ScaleFactor Storage VSM CSM ESM R32G32 N R8G8B8A8 R32 For CSM Ngt4 is usually required to avoid bleeding The less storage the faster the prefiltering WWWElJBllNFElJNl VSMCSMESM VSM 87 fps CSM 38 fps ESM 93 fps 8800 GTX Ultra WWWEHDEBNFEHM VSMCSMESM 2 quads floating above a ground plane VSM CSM ESM The minor ESM artifacts can be handled with another parameter which overdarkens the shadows Salvi08 WWWEDEBHFEHM Outline GameDevalupers Conquot 39 quotQ Q VariableSize Penumbra PCSS Percentage Closer Soft Shadows PCSS VSMCSM Backprojection WWWEDEUNWHM Percentage Closer Soft Shadows PCSS Fernand005 area light Assume a square light centered at the shadow b39OCker UHKHOWH map center Assuming some parallel WWW blocker to receiver Compute penumbra width WWW 2 mm dBIwkw 39 whyquot using similar triangles 43mm WWWElJEllNFElJNl PCSS Overview Step 1 Blocker Search Sample the depth buffer using point sampling Average all blockers with depth bias lt receiver in search region kernel Early out if no blocker found Step 2 Filtering Use filter radius from step 1 Clamp filter width to be gt MinRadius for antialiasing Filter the shadow map with PCF or VSMCSMESM WWWElJBlJNlEEHNl Search Region Gm 39 quotquotquotquotquot Where to find blockers Conservative search radius using similar triangles light znear search region LightRadius d SearchRadius dznear WWWMJEBNFEUM Blocker Search GameDevelupers quotquotquotquotquot 69 Why not domg jUSt one sample light would miss the occluder WWWEHDEBNFE HM Blocker Search a The more samples in the blocker search GIMDeVelupen EMUElm quot39 the less noisy artifacts in the soft shadows In practice 4x4 or 5x5 samples is sufficient Blocker Search with 3x3 taps Blocker Search with 5x5 taps WWW EDEHHWHM PCSS 16 POINT taps for the blocker search 16 PCF taps for the PCF filtering WWW GDBUNF BUM Outline GameDevelopers Conn l39l VariableSize Penumbra PCSS Percentage Closer Soft Shadows PCSS VSMCSM Backprojection WWWGDCUNFBDM PCSS VSMCSMESM 91359le Compute filter Size usmg blocker search Solutions to prefilter the shadow map to support fast blurs of variable size Summed Area Tables SAT Fast Box Filters Mipmapping Levei BIurLevei1 WWWElJBllNFE Nl Summed Area Tables ElmeDewluperS cumw e For a 1D texture each teer Sn of the SAT is Sn SumTi i0n 9 Average in interval ij is SiSi Ji Also works in 2D With more 4 fetches instead of 2 Fast algorithm for building SATs on GPUs Hensley05 Recursive doubling For NxN shadow map ogN passes WWWMJBBNFEHM Summed Area Shadow Maps gt GameDewlupery quotquotquot quot Using UINT32 Advantages more bits available than FP32 and support arbitrary shadow map resolution Drawback need to implement bilinear filtering in shader See GPU Gems 3 Chapter for details LauritzenO7 Best fitting formats for DX1O GPUs For SAVSM R32G32UINT For SACSM multiple R32G32832A32FLOATs For ESM storing expkz R32UNT WWWElJEllNFElJNl SAVSM vs MIPCSM Connmangwlapers Disadvantage of SAT can only do box filter Mipmap with recursive blurs looks more like a Gaussian SACSM MIPCSM WWWEDCUNFBUM SATs with variable size kernel GmDewlopers Cordm quotquot Rounding the filter radius generates banding float2 moments FilterMomentsBiinearuv roundfiterRadius Better quality trilinear filtering float2 momentsO FilterMomentsBiinearuv floorfiterRadius float2 moments1 FilterMomentsBiinearuv ceilfilterRadius float2 moments erpmomentsO moments1 fracfilterRadius WWWEMUNFEW SATS for VSMCSMESM l GameDewlupers quotquotquotquotquotquot Cost of building a SAT on G80 Ultra SAVSM 09 ms for 512quot2 33 ms for 1024quot2 SACSM with 16 FLOATs per teer 63 ms for 512quot2 and 275 ms for 1024quot2 SAESM 06 ms for 512quot2 22 ms for 1024quot2 CSM is not well suited for SATs Mipmaps are a better fit for them WWWElJBllNFE M MIPCSM GamDewlupery EMUquotmu 69 Build a mipmap pyramid on top of CSM Implemented as texture array with mip levels How to generate the mipchain Default 2x2 mipchain generates aliasing Use a larger box filter at least 7x7 to generate each LOD double spacing every level Lookup CSM using trilinear filtering Advantages of MIPCSM over SACSM Can use RGBA8 instead of RGBA32F Much faster to build than SACSM WWWElJEllNFElZlNl MIPCSM Game sleepers CordMn 039 To reduce issues to discretized blurs do a small blur prepass over the CSM without preblur with 5x5 pre blur WWWElDEllHFElll l l Outline GameDevelopers Zuniling Jy39f39f li 39 r Lquot f Backprojection WWWEDBDNFBUM Why PCF is wrong for soft shadows area light near plane GameDewlupers39 ENGIan zgtd zgtd PCF ShadowP gt O PCF ShadowP lt 1 Ground Truth ShadowP 0 Ground Truth ShadowP 1 WWWEMUHFE HM Unprojecting the shadow map Unproject shadow map texels into world space Atty05 Guennebaud06 Discretized approximation of the scene geometry 1 v 5 WWWEMWNFEHM Backprojecting texels ElmeDewluperS quotquotquotquot quot Backprolect texels onto light source Clamp to light borders and accumulate area 9 texels oating in world space WWWEMWFEHM MinMax Mipmap Shadow Map Game wlupers canquot De 39quotquot Can represent shadowmap data in hierarchical fashion Dmitriev07 Hierarchical traversal allows for efficient pruning of subtrees Build a hierarchical shadow map first R32G32FLOAT mipmap Each level stores min and max 2 of 2x2 subpixels Links SDK sample GDC 2007 talk WWWEMEUNFEHM Flattening the mipmap Generate mipmap and flattened 2D texture Load from texture without mipmaps is faster because it guarantees that all pixels access the same mipmap level GameDewlupers39 EMUulna Flattened mipmap WWWEllJElll lFElllll l Light Bleeding 69 Light bleeding is caused by gaps between micropatches WWWGDGUNFBUM Gap Filling GmDewlupers I W Extend backprojected quads on the sides to touch their left and top neighbors and the diagonal Similar to Guennebaud06 q backprojected texels filling the gaps WWWElElEllHFE M PCSS with PCF Frame Rate 120 fps 83 ms Shadow Map Generation 14 ms Blocker Search 5x5 taps PCF 5x5 taps Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT PCSS with PCF Frame Rate 96 fps 104 ms Shadow Map Generation 14 ms Blocker Search 5x5 taps PCF 9x9 taps Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT PCSS with PCF Frame Rate 54 fps 185 ms Shadow Map Generation 14 ms Blocker Search 5x5 taps PCF 17x17 taps Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT PCSS SAVSM Frame Rate 68 fps 147 ms SAVSM 65 ms total 44 Blocker Search 5x5 taps UINT32 SAVSM Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT PCSS MIPCSM Frame Rate 57 fps 175 ms MIPCSM 94 ms total 54 Blocker Search 5x5 taps MIPCSM 4 RGBA8 4 a Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT Hierarchical Backprojection Frame Rate 11 fps 91 ms MinMax Mipmap 26 ms 3 Image 1600x1200 Shadow Map 1024quot2 Triangle Count 211k GeForce 8800 GT M P Performance Comparison FPS VariableSize Penumbra 1600x1200 GeForce 8800 GT 5x5tap blocker search 1024A2 512A2 shadow maps 120 100 1024quot2 I 512 2 PCSS 5x5 PCF P CSS 9X9 PCF PCSS 17X17 PCF PCSS SAVSM PCSS MIPCSM 00 o a1 o a o u o Backproj wwwancuurcum Conclusions VSMCSMESM all have some sort of light bleeding There are ways to control it o VSM threshold andor layered VSM Lauritzen08 CSM more coefficients Annen07 ESM scale factor Salvi08 GameDewlupers39 l cordulna Percentage Closer Soft Shadows PCSS is good stuff Used in shipping game Hellgate London See our latest PCSS whitepaper February 2008 Two step process o 1 compute filter size using point sampling o 2 filter the shadow map using PCF WWWElJElJNlEElJNl Conclusions Can swap PCF filtering with other filtering methods 35333 PCSS SAVSM works great o See GPU Gems 3 Chapter for SAVSM including source code Q Can reduce light bleeding using layered VSMs Ideas for accelerating the blocker search Minmax mipmap hierarchical traversal Summed Area Table in the case where the shadow receivers are not in the P088 shadow map Shadow map generation recommendation Use a separate stream for the depth prepass with the minimum set of vertex attributes WWWElJEllNFElJNl Acknowledgments GameDmlupers39 quotquotquotquotquotquot NVIDIA Kevin Myers Randy Fernando Kirill Dmitriev Yury Uralsky Per Vognsen Marco Salvi ESM Andrew Lauritzen VSM WWW EMBHEEDM Resources aring Implementation details PCSS PCSS inteqration quide February 2008 DirectX 10 sample to be released soon Hierarchical backprojection SoftShadows sample in our SDK1O SAVSM GPU Gems 3 chapter lt3 Models ATAT Brad Blackburn wwwscifi3dcom Trees Generated using M Buddha Stanford Mesh Repository WWWGDBUHFCDM References GmDewlcpers quotquotquotquotquot Salvi08 Marco Salvi Rendering Filtered Shadows with Exponential Shadow Maps ShaderX6 Lauritzen08 Andrew Lauritzen Michael McCool Layered Variance Shadow Maps 3D 2008 poster Annen07 T Annen T Mertens P Bekaert HP Seidel J Kautz Convolution Shadow Maps EGSR June 2007 Dmitriev07 Kirill Dmitriev Yury Uralsky Soft shadows using hierarchical minmax shadow maps GDC 2007 Schuler06 Christian Schueler Normal Mapping without Pre Computed Tangents ShaderX5 lsidoroO6 John lsidoro Shadow Mapping GPUbased Tips and Techniques GDC 2006 WWWlE nllmtlllF lllll References GmDewlcpers quotquotquotquotquot Donnelly06 V lliam Donnelly Andrew Lauritzen Variance Shadow Maps 3D 2006 Guennebaud06 G Guennebaud L Barthe M Paulin Real time Soft Shadow Mapping by Backprojection EGSR 2006 FernandoO5 Randy Fernando PercentageCloser Soft Shadows SIGGRAPH 2005 Hensley05 J Hensley T Scheuermann G Coombe M Singh A Lastra Fast SummedArea Table Generation and its Applications Computer Graphics Forum 2005 Atty05 L Atty N Holzschuch M Lapierre JM Hasenfratz C Hansen F Sillion Soft Shadow Maps Efficient Sampling of Light Source Visibility Technical Report 2005 WWWlE nllmtlllF lllll

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.