Approximate Soft Shadows on Arbitrary Surfaces using Penumbra
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University of Technology Sweden
Why shadows? Why soft? Copyright 2002 Tomas Akenine-Möller
Our goal is plausible soft shadows in real time • Soft shadow generation is a fundamental CG problem • Many algorithms exist… • Not a single one that can be used in, e. g. , a game • We (all) want – Good performance (use hardware) – Arbitrary receivers and casters – Plausible, or even better, physically-correct shadows • Our paper is one small step in the right direction Copyright 2002 Tomas Akenine-Möller
Previous work on real-time shadows • Lots… • Most important algorithms for shadows on arbitrary surfaces: – Shadow Mapping [Williams] • See ”Perspective Shadow Maps”, SIGGRAPH 2002 • Heidrich et al, EGRW 2000, soft version – Shadow Volumes [Crow, Heidmann] • See Everitt and Kilgard’s report on how to robustly render shadow volumes Copyright 2002 Tomas Akenine-Möller
Some previous work on real-time soft shadow generation • Heckbert/Herf [HH]: – average a high number of images from point samples on light source, use as a texture on a plane – Uses many passes: 64 -256 (or fewer, and banding artifacts) – Not practical for dynamic scenes • Soler/Sillion [SS]: – For planar configurations, convolve hard shadow with shape of light source – Fast – Hierarchical error-driven algorithm – Image-based can use any shadow casting geometry and light source [same for HH] • Haines’ plateaus: – Planar as well – Overemphasize the umbra – Few passes Copyright 2002 Tomas Akenine-Möller
Our idea • Extend the shadow volume algorithm – And use ideas from Haines’ work • In the shadow volume algorithm, each silhouette edge shadow quad • For soft shadows, instead each edge a wedgelike shape: penumbra wedge Copyright 2002 Tomas Akenine-Möller
In 3 D, things are more complicated… so make some simplifying assumptions • Simplifications: – Spherical light sources – Only use silhouette as seen from center of light source – Bound the penumbra volume with 4 planes, sharing a silhouette edge • Also, use a hires stencil buffer (we use 16 bits) – called light intensity buffer here Copyright 2002 Tomas Akenine-Möller
How to rasterize a wedge… • Init light intensity (LI) buffer to 255 before • 255 = full light, 0 = no light, 0 < x < 255 penumbra Copyright 2002 Tomas Akenine-Möller
Examples of rasterization in 2 D 255 Front plane wedge 0 100 0 255 back plane LI-buffer =255 + ( 0 – 255 ) = 0 (umbra) • Next, describe missing pieces: – Construction of wedges – Light intensity interpolation Copyright 2002 Tomas Akenine-Möller
Penumbra wedge construction Copyright 2002 Tomas Akenine-Möller
Light intensity interpolation • To make it possible to implement using programmable hardware: – Our only requirement was C 0 continuity across wedges (side planes) • First attempt: – Compute positive intersection distances (tf and tb) to front and back plane – Then s=tb/(tf+tb) – Occasional artifacts • 2 nd try: Copyright 2002 Tomas Akenine-Möller
Implementation • Need pretty large vertex & pixel shaders in order to implement using graphics hw • So currently: – Render scene using hw-accelerated Open. GL – Read back Z-buffer – Software wedge rasterization into LI-buffer • (some optimizations not covered here – see paper) • For each pixel (x, y) get z and form the world-space coordinates • Point inside wedge compute light intensity – When all wedges rasterized • Clamp to [0, 255] and modulate specular + diffuse image, and then add ambient image Copyright 2002 Tomas Akenine-Möller
Results: simple scene, comparison with Heckbert/Herf and Soler/Sillion Our algorithm 2 fps using SW Heckbert/Herf 128 samples 20 fps using HW Soler/Sillion [worst case for this algorithm] Copyright 2002 Tomas Akenine-Möller
Results: increasing light source size, and complex shadow receiver 1. 8 fps on a 1. 5 GHz PC Copyright 2002 Tomas Akenine-Möller
Fractal landscape as shadow receiver 100 k triangles Copyright 2002 Tomas Akenine-Möller
Two lights Demo Copyright 2002 Tomas Akenine-Möller
Problems with our algorithm • Acute angles in shadow casting geometry Original result Expected result [HH] Our algorithm using 6 extra wedges per acute angle • Only used spherical light sources • We use silhouette from center of light source (like Haines) • Due to our construction of wedges, we can only render soft shadows for silhouettes that form closed loops – Limits the types of shadow casting geometry • Non-robust creation of side planes when silhouette edge is near-parallel to incoming light – Hack to avoid: remove such edges, and shorten & reconnect neighbors Copyright 2002 Tomas Akenine-Möller
Future and Current Work • We’ve added occlusion culling… • …and dealt with eye-inshadow problem • Late, late results – Use a penumbra wedge to bound the exact penumbra volume – Much more accurate light intensity computation – Allows us to use arbitrary shadow casting geometry – Most artifacts disappear Copyright 2002 Tomas Akenine-Möller Demo
Future work • Qualitative analysis of errors – When do they occur? – And when do we care/not care? • Accurate comparison to other algorithms • More light source shapes • Implementation using – New graphics hardware (large pixel shader program) – Use HILO texture as LI buffer Copyright 2002 Tomas Akenine-Möller
Thanks for listening! Copyright 2002 Tomas Akenine-Möller
- Slides: 20