approximate soft shadows on arbitrary surfaces using penumbra wedges tomas akenine-möller ulf...
Post on 21-Dec-2015
223 views
TRANSCRIPT
Approximate Soft Shadows onArbitrarySurfacesusingPenumbraWedges
Tomas Akenine-MöllerUlf AssarssonDepartment of Computer Engineering,Chalmers University of TechnologySweden
Copyright 2002 Tomas Akenine-Möller
Why shadows?Why soft?
Copyright 2002 Tomas Akenine-Möller
Our goal is plausible softshadows 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, EGRW2000, 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 wedge-like shape: penumbra wedge
Copyright 2002 Tomas Akenine-Möller
In 3D, 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
wedge
Front planebackplane
Examples of rasterization in 2D
• Next, describe missing pieces:– Construction of wedges– Light intensity interpolation
255
LI-buffer =255
0
+ ( 0 – 255 ) = 0 (umbra)
255 0255 100
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 C0 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
• 2nd 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 OpenGL– 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 algorithm2 fps using SW
Heckbert/Herf128 samples20 fps using HW
Soler/Sillion[worst case for thisalgorithm]
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 receiver100k 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
• 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
Original result Expected result [HH]Our algorithm using 6extra wedges per acute angle
Copyright 2002 Tomas Akenine-Möller
Future and Current Work• We’ve added occlusion
culling…• …and dealt with eye-
in-shadow problem
Demo
• Late, 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
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!