Shadow Techniques for Real-Time and Interactive Applications


Published on

PhD defense

Published in: Technology, Art & Photos
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Shadow Techniques for Real-Time and Interactive Applications

  1. 1. Shadow Techniques for Real-Time and Interactive Applications Stefan Brabec Promotionskolloquium MPI Informatik, Saarbrücken, Germany 3.2.2004
  2. 2. Importance of Shadows <ul><li>Shadows play important role in understanding the spatial relationship of objects in the scene </li></ul><ul><ul><li>Occluder </li></ul></ul><ul><ul><li>Receiver </li></ul></ul><ul><ul><li>Light source </li></ul></ul><ul><li>Good looking shadows give more realistic images </li></ul>Leonardo Da Vinci
  3. 3. Shadows in Computer Graphics <ul><li>Efficient methods for computing shadows are still a challenging task in computer graphics </li></ul><ul><li>Early work on shadow techniques [Arthur Appel, IBM Research, 1968] </li></ul>
  4. 4. Shadows in Computer Graphics <ul><li>Many algorithms proposed to compute shadows </li></ul><ul><li>But only a few techniques are suitable for real-time or interactive applications </li></ul>Discontinuity Meshing [Heckbert92]
  5. 5. Shadows for Real-Time Applications <ul><li>Refresh rate ~ 30 to 60 fps </li></ul><ul><ul><li>Games </li></ul></ul><ul><ul><li>VR Simulations </li></ul></ul><ul><ul><li>Virtual TV Set </li></ul></ul><ul><li>Only hardware-accelerated methods </li></ul><ul><ul><li>CPU resources dedicated for other tasks </li></ul></ul><ul><ul><ul><li>Sound, physics, AI, input </li></ul></ul></ul>Doom3
  6. 6. Shadows for Interactive Applications <ul><li>Refresh rate ~ 10 to 30 fps </li></ul><ul><ul><li>CAD/CAM </li></ul></ul><ul><ul><li>Digital Content Creation (DCC) </li></ul></ul><ul><ul><li>VR Interaction </li></ul></ul><ul><li>Hybrid approaches possible </li></ul><ul><ul><li>Combined CPU & GPU shadow technique </li></ul></ul>SolidWorks
  7. 7. Shadows for Non-Interactive Applications <ul><li>New group of applications </li></ul><ul><ul><li>Hardware-accelerated rendering methods for offline rendering (preview, production) </li></ul></ul><ul><ul><li>Example: Alias Maya6 hardware-renderer </li></ul></ul>Maya Software Maya OpenGL
  8. 8. Computing Shadows <ul><li>To compute shadows we need to analyse the spatial relationship of </li></ul><ul><ul><li>Receiver </li></ul></ul><ul><ul><li>Light source </li></ul></ul><ul><ul><li>Occluders </li></ul></ul><ul><li>Result: intensity distribution on receiver </li></ul>
  9. 9. Related Work <ul><li>Algorithms for computing hard shadows </li></ul><ul><ul><li>Projected Shadows [Blinn88] </li></ul></ul><ul><ul><li>Shadow Maps [Williams78] </li></ul></ul><ul><ul><li>Shadow Volumes [Crow77] </li></ul></ul><ul><li>Algorithms for computing soft shadows </li></ul><ul><ul><li>Plateaus [Haines01] </li></ul></ul><ul><ul><li>Smoothies [Chan03] </li></ul></ul><ul><ul><li>Penumbra Wedges [Akenine-M öller /Assarsson02/03] </li></ul></ul><ul><ul><li>Convolution [Soler98] </li></ul></ul>
  10. 10. Shadow Mapping [Williams78] <ul><li>Image-based method </li></ul><ul><ul><li>Compute shadow map from light view (depth buffer) </li></ul></ul><ul><ul><li>Compute final image </li></ul></ul><ul><ul><ul><li>compare actual vs. stored depth </li></ul></ul></ul>
  11. 11. Shadow Mapping <ul><li>Well suited for hardware-accelerated rendering [Segal92] </li></ul><ul><ul><li>Like texture mapping but with depth values </li></ul></ul><ul><ul><ul><li>Depth textures, texture compare mode </li></ul></ul></ul><ul><ul><li>First realized in SGI’s Infinite Reality </li></ul></ul><ul><ul><ul><li>Now available on all consumer-cards </li></ul></ul></ul>
  12. 12. Shadow Mapping <ul><li>But: shadow quality may suffer from sampling artifacts </li></ul>Blocky shadow edges due to limited shadow map resolution
  13. 13. Improve Sampling Rate <ul><li>Related work </li></ul><ul><ul><li>Perspective Shadow Maps [Stamminger02] </li></ul></ul><ul><ul><ul><li>Shadow mapping in post-perspective space </li></ul></ul></ul><ul><ul><li>Adaptive Shadow Maps [Fernando01] </li></ul></ul><ul><ul><ul><li>Hierarchical shadow map refinement </li></ul></ul></ul><ul><li>Our approach </li></ul><ul><ul><li>Optimize light frustum for current camera view </li></ul></ul>
  14. 14. Practical Shadow Mapping <ul><li>Render scene with projected texture </li></ul><ul><ul><li>Control texture encodes cells in shadow map </li></ul></ul><ul><li>Read back image </li></ul><ul><ul><li>Find those cells which are actually used </li></ul></ul>
  15. 15. Practical Shadow Mapping <ul><li>Fit light frustum to visible cells </li></ul><ul><ul><li>Axis-aligned bounding box </li></ul></ul><ul><ul><li>Minimum-area bounding rectangle </li></ul></ul><ul><li>Generate shadow map using the optimized frustum </li></ul>map regions used regions new map frustum
  16. 16. Practical Shadow Mapping optimized shadow map normal shadow map
  17. 17. Practical Shadow Mapping <ul><li>Control texture can also be used to improve depth sampling </li></ul><ul><li>Reduces artifacts due to limited numerical precision </li></ul>Self shadowing Missing shadows
  18. 18. Practical Shadow Mapping <ul><li>Adjust z-range (near/far) for visible objects </li></ul>z-range relevant z-range Normal approach: Near & far plane encloses all objects ! Better: Near & far plane encloses all from camera visible objects !
  19. 19. Practical Shadow Mapping <ul><li>Use 1D control texture that maps light distance to color (z-ramp) </li></ul><ul><ul><li>Detect relevant z-range e.g. [0.42;0.72] </li></ul></ul>0 range used 1
  20. 20. Practical Shadow Mapping <ul><li>Problem: </li></ul><ul><ul><li>Objects in front of near plane are shadow casters ! </li></ul></ul><ul><li>Solution: </li></ul><ul><ul><li>Clamp depth values </li></ul></ul><ul><ul><ul><li>One bit for objects in front enough (blocked: yes/no) </li></ul></ul></ul><ul><ul><li>Possible on many cards using depth replace operation </li></ul></ul><ul><ul><li>Direct support on GeForceFX </li></ul></ul>
  21. 21. Practical Shadow Mapping <ul><li>Can even go further and optimize depth distribution between near and far plane </li></ul><ul><ul><li>Histogram equalization </li></ul></ul><ul><ul><li>Improves depth contrast </li></ul></ul>Red: original distribution Green: normalized distribution z
  22. 22. Practical Shadow Mapping <ul><li>Summary </li></ul><ul><ul><li>Various ways to optimize light source’s viewing frustum </li></ul></ul><ul><ul><li>Better shadow quality </li></ul></ul><ul><ul><li>Most steps are hardware-accelerated </li></ul></ul><ul><ul><ul><li>Read-back of control image is main bottleneck </li></ul></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Full hardware implementation </li></ul></ul><ul><ul><li>Combine with other methods </li></ul></ul><ul><ul><ul><li>Perspective Shadow Maps </li></ul></ul></ul>
  23. 23. Shadow Mapping <ul><li>Previous slides: </li></ul><ul><ul><li>Concentrated on quality improvements for the classical shadow map approach </li></ul></ul><ul><li>But: there are special situations where the standard approach fails </li></ul><ul><ul><li>E.g. spotlight with extreme cut-off angle </li></ul></ul>
  24. 24. Shadow Mapping <ul><li>How to capture depth information for the complete environment ? </li></ul><ul><ul><li>Needed when using omni-directional light sources </li></ul></ul><ul><li>Simple solution: </li></ul><ul><ul><li>Use six shadow maps (cube map texture) </li></ul></ul><ul><ul><li>Needs 6+1 rendering passes ! </li></ul></ul>
  25. 25. Dual-Paraboloid Shadow Mapping <ul><li>Idea: Use dual-paraboloid mapping for shadow maps </li></ul><ul><ul><li>Proposed by [Heidrich98b] for environment mapping </li></ul></ul><ul><ul><li>One map covers one hemisphere </li></ul></ul><ul><ul><ul><li>Only two maps for full environment (two paraboloid maps attached back-to-back) </li></ul></ul></ul><ul><ul><li>Good sampling ratio </li></ul></ul><ul><ul><ul><li>No singularity as e.g. with spherical maps </li></ul></ul></ul>
  26. 26. Dual-Paraboloid Shadow Mapping <ul><li>Perfectly reflecting paraboloid as seen by an orthographic camera </li></ul><ul><li>Maps a 3D direction onto a 2D point on the paraboloid </li></ul><ul><li>By adding euclidian distance to light source we get a 3D-3D transformation </li></ul><ul><ul><li>Parabolic coordinates for shadow map lookup </li></ul></ul><ul><ul><li>Euclidian distance for shadow test </li></ul></ul>
  27. 27. Dual-Paraboloid Shadow Mapping <ul><li>Full environment in 2+1 passes </li></ul>first hemisphere second hemisphere final image with two shadow maps applied 1 2 3
  28. 28. Dual-Paraboloid Shadow Mapping <ul><li>Implementation </li></ul><ul><ul><li>Fully hardware-accelerated </li></ul></ul><ul><ul><li>Use vertex shader for paraboloid transformation </li></ul></ul><ul><ul><ul><li>Cannot change pixel position in fragment stage </li></ul></ul></ul><ul><ul><ul><li>Need highly tesselated scenes to get along with linear interpolation </li></ul></ul></ul>
  29. 29. Dual-Paraboloid Shadow Mapping <ul><li>Summary </li></ul><ul><ul><li>Can use shadow mapping for </li></ul></ul><ul><ul><ul><li>Omni-directional light sources (2+1 passes) </li></ul></ul></ul><ul><ul><ul><li>Hemispherical light sources (1+1 passes) </li></ul></ul></ul><ul><ul><li>Hardware-accelerated </li></ul></ul><ul><ul><ul><li>Need vertex transformation and shadow mapping </li></ul></ul></ul><ul><ul><li>High tesselation requiered </li></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>May use adaptive tesselation </li></ul></ul><ul><ul><ul><li>Displacement mapping </li></ul></ul></ul>
  30. 30. Shadow Volumes [Crow77] <ul><li>Object-space algorithm </li></ul><ul><ul><li>Compute regions of shadow in 3D </li></ul></ul><ul><ul><ul><li>Per-pixel correct shadow information </li></ul></ul></ul><ul><ul><ul><li>Cast shadows onto arbitrary receiver geometry </li></ul></ul></ul><ul><ul><li>Mostly used in games for selected shadow casters </li></ul></ul><ul><ul><ul><li>Characters etc. </li></ul></ul></ul>
  31. 31. Shadow Volumes <ul><li>Extend occluder polygons to form semi-infinite volumes </li></ul><ul><ul><li>Light source is center-of-projection </li></ul></ul><ul><ul><li>Everything behind occluder is in shadow </li></ul></ul>occluder light shadow region lit
  32. 32. Shadow Volume Rendering <ul><li>Stencil-based shadow volumes [Heidmann ‘91] Real shadows real time </li></ul><ul><ul><li>count in-out events using the stencil buffer </li></ul></ul>
  33. 33. Shadow Volume Rendering <ul><li>Problem: </li></ul><ul><ul><li>High number of rendering passes for many light sources </li></ul></ul>initialize z-buffer shadow volumes light contribution ambient contribution repeat for all lights final image
  34. 34. Combined Shadow Mask <ul><li>Idea </li></ul><ul><ul><li>Reduce rendering passes by storing intermediate results as shadow mask </li></ul></ul>repeat shadow volumes L i shadow volumes L i+1 shadow volumes L i+N shadow mask light contribution L i ....L i+N times
  35. 35. Combined Shadow Mask <ul><li>Example </li></ul><ul><ul><li>Use N=4 and store shadow mask as RGBA screen-space texture map </li></ul></ul><ul><ul><li>Apply contribution for each light using custom fragment shader </li></ul></ul><ul><ul><li>Sum is also at higher precision (float) as when using framebuffer accumulation </li></ul></ul>
  36. 36. Combined Shadow Mask <ul><li>Efficiently used this approach for rendering architectural scenes </li></ul>
  37. 37. Combined Shadow Mask <ul><li>Shadow mask can also be used to store parts of the illumination </li></ul><ul><ul><li>Include monochromatic goniometric diagrams </li></ul></ul><ul><ul><ul><li>Describes non-uniform intensity distribution </li></ul></ul></ul><ul><ul><li>Lookup cube map for non shadowed pixel </li></ul></ul><ul><ul><li>Mask is value in [0;1] </li></ul></ul><ul><ul><li>Nearly for free, since texture lookup is not the bottleneck </li></ul></ul>-X +X -Z +Z +Y -Y
  38. 38. Combined Shadow Mask <ul><li>Example with goniometric diagrams </li></ul>
  39. 39. Combined Shadow Mask <ul><li>Summary </li></ul><ul><ul><li>Storing intermediate results reduces number of scene rendering passes </li></ul></ul><ul><ul><li>Shadow mask texture can be used to store parts of the illumination </li></ul></ul><ul><ul><li>Contribution of light sources is accumulated at higher precision </li></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Can be combined with all shadow volume variants </li></ul></ul>
  40. 40. Shadow Volumes <ul><li>Previous slides </li></ul><ul><ul><li>Reduced cost of rendering shadow volumes </li></ul></ul><ul><li>Another big problem </li></ul><ul><ul><li>Generation of shadow volumes can be quite expensive </li></ul></ul><ul><ul><ul><li>Usually done on CPU </li></ul></ul></ul><ul><ul><ul><li>Need to synchronize CPU and GPU </li></ul></ul></ul><ul><ul><ul><ul><li>Shadow volumes should be ready when GPU gets ready to render them </li></ul></ul></ul></ul>
  41. 41. Shadow Volume Generation <ul><li>Trivial way: one volume for each polygon </li></ul><ul><ul><li>Number of shadow volumes puts heavy load on GPU (fill-rate) ! </li></ul></ul><ul><li>Better: silhouette-based approach </li></ul><ul><ul><li>Need to check each edge with each light for front/back-facing condition </li></ul></ul>Mesh as seen by light source Silhouette
  42. 42. Shadow Volume Generation <ul><li>Checking the front/back facing condition is normally a trivial task </li></ul><ul><li>Silhouette detection is not trivial for complex vertex shaders ! </li></ul><ul><li>How do we handle GPU transformation ? </li></ul>
  43. 43. Shadow Volume Generation <ul><li>From some OpenGL discussion forum: </li></ul>
  44. 44. Silhouette Detection on GPU <ul><li>Use graphics hardware to compute silhouettes </li></ul><ul><li>State-of-the-art hardware allows computation in object space </li></ul><ul><ul><li>Floating point calculations </li></ul></ul><ul><ul><li>Floating point textures </li></ul></ul><ul><ul><li>Powerful, programmable vertex and fragment processing units </li></ul></ul>
  45. 45. Silhouette Detection on GPU <ul><li>Restriction on input data </li></ul><ul><ul><li>Triangle meshes </li></ul></ul><ul><ul><li>Closed meshes with two triangles per edge </li></ul></ul><ul><ul><li>Connectivity is known (pre-computed) </li></ul></ul>Example: This is not a closed mesh, but since we are only focusing on one edge of this mesh its ok.
  46. 46. Silhouette Detection on GPU <ul><li>Need all data in global coordinate system </li></ul><ul><ul><li>Assign each vertex a unique identifier </li></ul></ul><ul><ul><li>Render one point per vertex and store away world/eye space position </li></ul></ul>P 0 P 1 P 2 P 3 P 4 position texture P 0 P 1 P 2 P 3 P 4 P N
  47. 47. Silhouette Detection on GPU <ul><li>Process edges </li></ul><ul><ul><li>Unique identifier per edge </li></ul></ul><ul><ul><li>Each edge has vertex indices for </li></ul></ul><ul><ul><ul><li>Its endpoints </li></ul></ul></ul><ul><ul><ul><li>Adjacent triangles </li></ul></ul></ul>E 0_idx P 0_idx P 1_idx P 3_idx P 4_idx glBegin(GL_POINTS) ; glAttrib(P0_idx, P3_idx, P1_idx, P4_idx); glVertex1f(E0_idx); glEnd();
  48. 48. Silhouette Detection on GPU <ul><li>Check front/back face condition for each edge </li></ul>E 0_idx P 0_idx P 1_idx P 3_idx P 4_idx input data 4 texture lookups for world space positions P 0 P 1 P 3 P 4 registers P 3 P 0 P 1 P 4 N 1 = (P 3 –P 0 )x(P 1 –P 0 ) N 2 = (P 4 –P 0 )x(P 3 –P 0 ) front & back facing ? position texture P 0 P 1 P 2 P 3 P 4 Light Store silhouette flag (yes/no) at edge index E 0 E 1 E 2 E 3 E 4 E M edge texture
  49. 49. Shadow Volume Rendering <ul><li>Final step </li></ul><ul><ul><li>Use position texture for world space lookup </li></ul></ul><ul><ul><li>Use edge texture for silhouette condition </li></ul></ul><ul><ul><ul><li>If not a silhouette edge move outside view (will be culled away early) </li></ul></ul></ul><ul><ul><li>Render quad for each edge </li></ul></ul>P 0 L P 3 P 0- L P 3- L
  50. 50. Shadow Volumes on GPU <ul><li>Example with three lights and dynamic vertex deformation </li></ul>
  51. 51. Shadow Volumes on GPU <ul><li>Summary </li></ul><ul><ul><li>Fully hardware-accelerated implementation, including silhouette detection </li></ul></ul><ul><ul><ul><li>Supports custom vertex shaders </li></ul></ul></ul><ul><ul><ul><li>Works for multiple lights in parallel </li></ul></ul></ul><ul><ul><li>No CPU resources needed </li></ul></ul><ul><ul><ul><li>Just pre-processing </li></ul></ul></ul><ul><ul><li>Relies on recent hardware capabilities </li></ul></ul><ul><ul><ul><li>Render-to-vertex-array or </li></ul></ul></ul><ul><ul><ul><li>Texture-lookup in vertex shader </li></ul></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Include culling methods to reduce fill rate </li></ul></ul>
  52. 52. Soft Shadow Techniques <ul><li>Up to now </li></ul><ul><ul><li>Computing hard shadows </li></ul></ul><ul><ul><ul><li>Point, directional, and spot lights </li></ul></ul></ul><ul><ul><ul><li>Relatively easy since only binary result (lit or shadow) </li></ul></ul></ul><ul><li>Next </li></ul><ul><ul><li>Computing soft shadows </li></ul></ul><ul><ul><ul><li>Linear or area light sources </li></ul></ul></ul><ul><ul><ul><li>Complex visibility function </li></ul></ul></ul>
  53. 53. Soft Shadow Maps <ul><li>Generate soft shadows for linear lights </li></ul><ul><ul><li>Light source represented by line segment </li></ul></ul><ul><ul><li>Good approximation for long, thin lamps </li></ul></ul><ul><ul><li>Penumbra region when occluder edge is not parallel to light source </li></ul></ul>Point Light Source Linear Light Source
  54. 54. Soft Shadow Maps <ul><li>Visibility of Light Source </li></ul><ul><ul><li>100% to 0% for [p1,p2] </li></ul></ul><ul><ul><li>0% for [p2,q2] </li></ul></ul><ul><ul><li>0% to 100% for [q2,q1] </li></ul></ul><ul><li>Idea </li></ul><ul><ul><li>normal shadow maps for umbra and completely lit regions </li></ul></ul><ul><ul><li>linear interpolation of visibility for penumbra regions </li></ul></ul><ul><ul><ul><li>Stored as visibility map </li></ul></ul></ul>
  55. 55. Soft Shadow Maps <ul><li>Visibility Map </li></ul><ul><ul><li>additional shadow map channel (percentage visibility) </li></ul></ul><ul><ul><li>two-channel shadow map for each sample point </li></ul></ul>
  56. 56. Soft Shadow Maps <ul><li>Generating the Visibility Map </li></ul><ul><ul><li>triangulate depth discontinuities </li></ul></ul><ul><ul><li>warp resulting skin polygons to other view </li></ul></ul>
  57. 57. Soft Shadow Maps <ul><li>Generating the Visibility Map </li></ul><ul><ul><li>render skin polygons to visibility map </li></ul></ul><ul><ul><li>Gouraud-Shading (linear interpolation) </li></ul></ul><ul><ul><ul><li>“ white” for vertices on receiver </li></ul></ul></ul><ul><ul><ul><li>“ black” for vertices on occluder </li></ul></ul></ul><ul><ul><li>completely lit regions </li></ul></ul><ul><ul><ul><li>default visibility 0.5 </li></ul></ul></ul><ul><ul><li>completely shadowed regions </li></ul></ul><ul><ul><ul><li>first shadow map channel </li></ul></ul></ul>
  58. 58. Soft Shadow Maps <ul><li>Generating the visibility map </li></ul>depth map edge detection triangulate render+shade visibility map to 3D warp
  59. 59. Soft Shadow Map Algorithm shade(p) { if( depth 1 (p) > S 1 [p] ) l 1 = 0; else l 1 = V 1 [p] * illum(p,L 1 ); if( depth 2 (p) > S 2 [p] ) l 2 = 0; else l 2 = V 2 [p] * illum(p,L 2 ); return l 1 +l 2 ; } S 1 V 1 S 2 V 2
  60. 60. Soft Shadow Maps <ul><li>Summary </li></ul><ul><ul><li>Efficient way to compute soft shadows for linear light sources </li></ul></ul><ul><ul><ul><li>E.g. using only two sample points </li></ul></ul></ul><ul><ul><li>Hardware-accelerated </li></ul></ul><ul><ul><ul><li>Only depth triangulation done on CPU </li></ul></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Extend to work for area lights </li></ul></ul><ul><ul><ul><li>Area approximation [Ying02] </li></ul></ul></ul><ul><ul><li>Perform depth triangulation on GPU </li></ul></ul><ul><ul><ul><li>Possible with render-to-vertex-array </li></ul></ul></ul>
  61. 61. Single Sample Soft Shadows <ul><li>Algorithm that approximates soft shadows using only one sample point on the light </li></ul><ul><li>Is this information sufficient to produce good looking soft shadows ? </li></ul>
  62. 62. Single Sample Soft Shadows <ul><li>Based on [Parker98] method for ray tracing </li></ul><ul><ul><li>Adding an outer hull to an object </li></ul></ul><ul><ul><li>Rays inside outer hull are attenuated according to the distance to object </li></ul></ul>
  63. 63. Single Sample Soft Shadows <ul><li>Our method </li></ul><ul><ul><li>Parker’s idea adapted for hardware rendering </li></ul></ul><ul><ul><ul><li>Use sampled input data (depth maps) </li></ul></ul></ul><ul><ul><ul><ul><li>Shadow map algorithm </li></ul></ul></ul></ul><ul><ul><ul><li>Concept of extended occluders </li></ul></ul></ul><ul><ul><ul><ul><li>Search for hard shadow/lit regions </li></ul></ul></ul></ul><ul><ul><li>But: </li></ul></ul><ul><ul><ul><li>Penumbra for outer and inner regions </li></ul></ul></ul>
  64. 64. Single Sample Soft Shadows <ul><li>Searching for blocked pixels </li></ul><ul><ul><li>Transform pixel position to light source coordinate system </li></ul></ul><ul><ul><li>If pixel is lit (shadow test) search neighborhood for nearest blocked pixel </li></ul></ul><ul><ul><li>Limit search by </li></ul></ul>
  65. 65. Single Sample Soft Shadows <ul><li>Assign attenuation value </li></ul><ul><ul><li>f rises up from 0 (no illum) to 1 (full illum) </li></ul></ul><ul><li>To do </li></ul><ul><ul><li>Define properties that affect size of penumbra </li></ul></ul><ul><ul><li>Integrate those into the search scheme </li></ul></ul>maximal extend hard shadow found
  66. 66. Single Sample Soft Shadows <ul><li>Distance receiver/light </li></ul><ul><ul><li>Varying r max according to this distance </li></ul></ul>P ` r m a x 2 r m a x 1 depth map search larger penumbra
  67. 67. Single Sample Soft Shadows <ul><li>Distance receiver/occluder </li></ul><ul><ul><li>Problem: need to find occluder first </li></ul></ul><ul><ul><ul><li>searching r max region </li></ul></ul></ul><ul><ul><li>Dim f based on this distance </li></ul></ul><ul><ul><li>Keep searching in r max for minimum f </li></ul></ul>larger penumbra
  68. 68. Single Sample Soft Shadows <ul><li>Adopted Parker’s scheme to add an outer penumbra to an umbra region </li></ul><ul><ul><li>Gives unrealistic thick shadows </li></ul></ul><ul><li>Can add inner penumbra by reverse search: </li></ul>c is user defined constant where inner and outer meet (e.g. 0.5) f  [0.0;c) f  [c;1.0] Attenuation depth_light[…] – depth_light[P` x , P` y ] P` z - depth_light[…] r`max = rmax * lit pixels blocked pixels Search for pixel is blocked pixel is lit Search when Inner Penumbra Outer Penumbra
  69. 69. Single Sample Soft Shadows <ul><li>Implementation </li></ul><ul><ul><li>Depth map generation on graphics card </li></ul></ul><ul><ul><li>Search done on CPU </li></ul></ul><ul><ul><ul><li>Read-back is bottleneck </li></ul></ul></ul><ul><ul><li>Attenuation applied as texture map </li></ul></ul><ul><ul><li>Still very fast </li></ul></ul>~20 fps (P4 + GF4) Light depth map: 512x125 Window resolution: 512x512
  70. 70. Single Sample Soft Shadows <ul><li>Summary </li></ul><ul><ul><li>Fast soft shadow approximation using a single light source sample </li></ul></ul><ul><ul><li>Generation of input data on GPU </li></ul></ul><ul><ul><li>Simple search scheme </li></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Search on GPU </li></ul></ul><ul><ul><li>Optimized CPU search </li></ul></ul><ul><ul><ul><li>Shadow width maps [Kirsch03] </li></ul></ul></ul><ul><ul><li>Include shape of area light </li></ul></ul>
  71. 71. Conclusions & Future Work <ul><li>Conclusions </li></ul><ul><ul><li>Efficient and robust hard shadows can be computed using state-of-the-art hardware </li></ul></ul><ul><ul><li>Real-time soft shadows are currently based on rough approximations </li></ul></ul><ul><ul><ul><li>Fake penumbra using point light sources </li></ul></ul></ul><ul><li>Future work </li></ul><ul><ul><li>Real-time soft shadows is the main research direction </li></ul></ul><ul><ul><li>Need better algorithms for special situations </li></ul></ul><ul><ul><ul><li>E.g. hair, fur, particles </li></ul></ul></ul>
  72. 72. Thank You !