09 shadow mapping
play

09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to - PowerPoint PPT Presentation

09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to previous instructor Kavita Bala Shadows as depth cue [tricks-and-illusions.com] Shadows as anchors Shadows as anchors [Mller et al. RTR ] Mark Kilgard Mark Kilgard Mark


  1. 09 Shadow Mapping Steve Marschner CS5625 Spring 2019 Thanks to previous instructor Kavita Bala

  2. Shadows as depth cue [tricks-and-illusions.com]

  3. Shadows as anchors

  4. Shadows as anchors

  5. [Möller et al. RTR ]

  6. Mark Kilgard

  7. Mark Kilgard

  8. Mark Kilgard

  9. Mark Kilgard

  10. Shadow Map Issues • if A and B are approximately equal? • Speckling slide courtesy of Kavita Bala, Cornell University

  11. Mark Kilgard

  12. Mark Kilgard

  13. Mark Kilgard

  14. opengl-tutorial.org first try at shadow mapping

  15. Mark Kilgard not enough shadow bias good shadow bias too much shadow bias

  16. opengl-tutorial.org shadow mapping with constant bias

  17. opengl-tutorial.org shadow mapping with slope-dependent bias

  18. opengl-tutorial.org closed surfaces and slope-dependent bias

  19. opengl-tutorial.org adding percentage-closer filtering

  20. Shadow map sample rate—bad case Light behind object Light’s “view direction” almost 
 opposite the eye’s view 
 direction “Dueling frusta” Mark Kilgard eye view light view

  21. Cascaded shadow maps (aka. parallel-split SM) [Möller et al. RTR ]

  22. Fan Zhang, Chinese U. Hong Kong Single shadow map, 2048x2048 Four 1024x1024 shadow maps (equal memory)

  23. Filtering shadow maps Shadow map lookups cause aliasing, need filtering As with normal maps, pixel is a nonlinear function of the shadow depth • this means applying a linear filter to the depth is wrong We want to filter the output, not the input, of the shadow test • what fraction of samples pass the test • samples pass the test if they are closer than the shadow map depth • therefore “percentage closer filtering” or PCF

  24. Percentage Closer Filtering • Soften the shadow to decrease aliasing – Reeves, Salesin, Cook 87 – GPU Gems, Chapter 11 Kavita Bala, Computer Science, Cornell University

  25. 1 sample SM Kavita Bala, Computer Science, Cornell University

  26. 4 sample PCF Kavita Bala, Computer Science, Cornell University

  27. 16 sample PCF Kavita Bala, Computer Science, Cornell University

  28. Kavita Bala, Computer Science, Cornell University

  29. Soft shadows from small sources Main e ff ect is to blur shadow boundaries • PCF can do this • …but how wide to make the filter? Real shadows depend on area of light visible from surface • this can vary in complex ways • example: sun viewed through leafy trees Useful approximation: convolution • shadows are convolutions when the blocker and source are parallel and planar • occluder fusion: approximating some occluding geometry as a planar blocker

  30. Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course Hard Shadows Umbra Completely lit

  31. Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course Soft Shadows Penumbra Umbra Completely lit

  32. Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course Shadow Hardening on Contact

  33. Percentage ‐ Closer Soft Shadows Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course 1. Blocker search Shadow map Average occluder depth � ��� �

  34. Percentage ‐ Closer Soft Shadows � ����� Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course 1. Blocker search 2. Penumbra width estimation � ��� � � � Planar � � � ��� � � occluder � �������� � � ����� � ��� � ��������

  35. Percentage ‐ Closer Soft Shadows Michael Schwarz, SIGGRAPH 2013 Real Time Shadows course 1. Blocker search 2. Penumbra width estimation � � 3. Filtering Filter region (size ~ � �������� ) 50% �

  36. Percentage-closer soft shadows Fernando, NVidia whitepaper ~2005

Recommend


More recommend