Pismo Parallax-Interpolated Shadow Map Occlusion Ivan Neulander Introduction: Soft Shadows • Problem: Render soft shadows from an area light source – Light source can be any.
Download ReportTranscript Pismo Parallax-Interpolated Shadow Map Occlusion Ivan Neulander Introduction: Soft Shadows • Problem: Render soft shadows from an area light source – Light source can be any.
Pismo Parallax-Interpolated Shadow Map Occlusion Ivan Neulander Introduction: Soft Shadows • Problem: Render soft shadows from an area light source – Light source can be any polygonal model – Want fast solution, of sufficient quality for visual effects – Want speed vs. quality control Area Light Umbra Penumbra Introduction: Soft Shadows • Some Solutions: a) Ray tracing • Very high quality, physically accurate but usually slow b) “Shadow Map” ray tracing: project ray to map • Lower quality, relatively fast • Samples shadow map many times per ray • Soft Shadows by Ray Tracing Multilayer Transparent Shadow Maps: Xie, Tabellion, Pearce • Efficient Image-Based Methods for Rendering Soft Shadows: Agarwala et al c) Use many shadow maps: overlapping shadows • Fast at low quality but very slow at high d) Use many shadow maps: Pismo • Almost as fast as (c), but much higher quality • Samples shadow map few times per ray Pismo 128 256 16 32 64 4with 8 Shadow Shadow Shadow 4 Shadow Maps Maps MapsMaps Soft Shadow Example Area Light Hard Shadows from 3 Point Lights with Shadow Maps Pismo Shadow Estimation: Problem • Problem: Estimate shadow ray PL, extending from P to arbitrary point L on area light • Use the 3 shadow maps rendered from the triangle vertices, all fixated on a common focal point F L P Pismo Shadow Estimation: Solution • Solution: 1) Compute position of putative occluder O • Displace P toward L by distance d • How to compute d ? P O L Pismo Shadow Estimation: Solution Shadow Map #1 • Solution: 2) Project O into screen space of Shadow Map #1 • Use depth value at this pixel to compute ray occlusion • Using O instead of P accounts for parallax shift between view from Shadow Map O camera and view from L L P Pismo Shadow Estimation: Solution Shadow Map #2 • Likewise, project O into screen space of Shadow Map #2 P O L Pismo Shadow Estimation: Solution Shadow Map #3 • Likewise, project O into screen space of Shadow Map #3 P O L Pismo Shadow Estimation: Solution Blending the Three Shadow Maps • Barycentrically blend the 3 shadow maps’ occlusion results to get the final occlusion estimate for the shadow ray PL • Uses 3 shadow map queries per ray P O L Pismo Shadow Estimation: Solution Compute Multiple Shadow Rays • Repeat the process for multiple shadow rays between P and other light positions on the area light P Estimating Initial Depth d: Preprocess Shadow Maps • For each Shadow Map, we generate a Bled Shadow Map: an image-processed copy where we • bleed out silhouette pixels • apply a slight blur • One-time preprocess per shadow map • Regular Shadow Map stores multiple occluder depths per pixel (layered) • Bled Shadow Map stores max depth only Estimating Initial Depth d: Compute d1 • Project P to a pixel in Bled Shadow Map #1 • If queried depth is less than depth from P to L, subtract and we’re done; else, compute following average: P • Sample multiple jittered pixels in (layered) Shadow Map, centered about original pixel • For each sample: L If queried depth is less than depth from P to L, add difference to average • Computed once per shading sample (not per ray) Estimating Initial Depth d: Compute d2 • Project P to a pixel in Bled Shadow Map #2 • Estimate value for d2 as above • Computed once per shading sample L P Estimating Initial Depth d: Compute d3 • Project P to a pixel in Bled Shadow Map #3 • Estimate value for d3 as above • Computed once per shading sample L P Estimating Initial Depth d: Blend d1, d2, d3 • Barycentrically blend d1,d2,d3 to get d for given L • Use blended d value to compute O as shown • Computed per-ray (but no shadow map queries) L P Depth Compensation: Problem • Depth from L to P (LP) differs from depth from Shadow Map D to P (DP) • Need to compensate depth estimates that use D in place of L D DP LP L P Depth Compensation: Solution D (Shadow Map) L LO LP O DO DP P • Adjust initial estimates d1,d2,d3 by LP – DP • Blend d1,d2,d3 and compute O • Adjust depth queried from D (based on O) by LO – DO F (Focal Point) Contact Shadows • Problem: Pismo requires a higher shadow bias than regular shadowing to avoid self-shadow artifacts – This attenuates crisp short-range shadows • Solution: Compute contact shadows at close range and blend them in with Pismo Shadows Contact Shadows: Implementation • A Contact Shadow: – is based on hard shadows from discrete shadow maps – consists of 2 or more such shadows that overlap – fades out beyond Pismo shadow bias distance – is blended with Pismo shadow over bias distance blend = Results: Area Light with 4 Shadow Maps Pismo Off Pismo On 128 rays / pixel Area Light Results: Area Light with 5 Shadow Maps Pismo Off Pismo On 128 rays / pixel Area Light Performance: Pismo vs. Ray Tracer Pismo@4 5 DMs: 33 s Final: 263 s Total: 296 s •1600x1200 resolution •128 rays / pixel •Athlon64 @ 2800 MHz Pismo@5 5 DMs: 42 s Final: 246 s Total: 288 s Ray-Traced Total: 1073 s Quality: Large Area Light Ray Tracer 444Blurred Pismo Hard Shadows Shadows Shadows 555Blurred Pismo Hard Shadows Shadows Shadows 999Blurred Pismo Hard Shadows Shadows Shadows 4 Hard Shadows 5 Hard Shadows 9 Hard Shadows 4 Blurred Shadows 5 Blurred Shadows 9 Blurred Shadows 4 Pismo Shadows 5 Pismo Shadows 9 Pismo Shadows Quality: Pismo@4 vs. Ray Tracer Pismo@4 Pixel Difference Ray Tracer Quality: Pismo@5 vs. Ray Tracer Pismo@5 Pixel Difference Ray Tracer Quality: Pismo@9 vs. Ray Tracer Pismo@9 Pixel Difference Ray Tracer Conclusions Pismo is a useful enhancement to rendering soft shadows with multiple shadow maps • Conceptually simple & easy to implement – integrates easily into an existing rendering pipeline • Provides an intuitive control over speed/quality • Creation of multiple shadow maps easily accelerated: – Multiprocessing – GPU rendering – Morphing Future Work • Accelerate creation of shadow maps • Automate tessellation of light polygons • Improve blending of contact shadows • Parallelize Pismo sampling Ivan Neulander www.rhythm.com/~ivan/pubs.html [email protected]