1 / 25

CSL 859: Advanced Computer Graphics

CSL 859: Advanced Computer Graphics. Dept of Computer Sc. & Engg. IIT Delhi. Shadow Volumes. Shadow Volumes. Stencil Buffer. Like color/z buffer; one entry per pixel Traditionally a few bits of Z-buffer Stencil value also masks whether to render Render to Stencil Stencil operation

glenys
Download Presentation

CSL 859: Advanced Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi

  2. Shadow Volumes

  3. Shadow Volumes

  4. Stencil Buffer • Like color/z buffer; one entry per pixel • Traditionally a few bits of Z-buffer • Stencil value also masks whether to render • Render to Stencil • Stencil operation void StencilFunc (enum func, int ref, uint mask ) NEVER, ALWAYS, LESS, LEQUAL, EQUAL, GEQUAL, GREATER, or NOTEQUALvoid StencilOp (enum sfail, enum zfail, enum zpass) KEEP, ZERO, REPLACE, INCR, DECR, INVERT glEnable(GL_STENCIL_TEST)

  5. Stencil Shadow Volume Overview • Render the scene with shadow color • For each light source • Using the depth from pass 1, construct a mask in the stencil buffer enabling pixels not in shadow • Shadow volume constructed by computing silhouettes of occluders • And capping the volumes • Render the scene again, lit this time. • Stencil buffer masks out shadowed areas

  6. Stencil Generation • Disable depth and color writes • Set the stencil operation to increment on depth pass (counting shadows in front of the object) • Enable back-face culling (ie front drawing) • Draw the shadow volumes (ie front faces) • Set the stencil operation to decrement on depth pass • Enable front-face culling • Draw the shadow volumes (ie back faces) What if Eye is in shadow?

  7. Stencil Shadow Volumes a b

  8. Reverse Stencil • Disable depth and color writes • Enable front-face culling • Set the stencil operation to increment on depth fail (counting shadows behind the object). • Render the shadow volumes (ie back faces) • Enable back-face culling • Set the stencil operation to decrement on depth fail. • Render the shadow volumes (ie front faces)

  9. single shadow map pixel Shadow Map Aliasing

  10. Perspective Shadow Maps • [Stamminger & Grettakis 02]

  11. Deep Shadow Map • Deep shadow maps • Instead of storing a depth at each pixel • Store a series of depths w/ reduction of light transmitted • Important for complex self-shadowing models • Hair, clouds [Lokovic & Veach 2000]

  12. Deep Shadow Maps Without self-shadowing With self-shadowing

  13. Shadows from Area Light • Accumulation buffer • Higher resolution than final image • Sample area light • Render from multiple light-points • Average [Heckbert & Herf 97] Overlapping shadows have undesired artifacts

  14. Fake Soft Shadows • Extend shadow map [Chan & Durand 03] • Use extra primitives (smoothies) to soften shadows light’s view (blockers only) light’s view (blockers + smoothies)

  15. Fake Soft Shadows • Shadows not geometrically correct • Shadows appear qualitatively like soft shadows Hard shadows Fake soft shadows

  16. Shadow Map Creation • Render blockers into depth map observer’s view light’s view

  17. Silhouette Detection • Find blockers’ silhouette edges in object space object-space silhouettes observer’s view light’s view

  18. Construct Smoothies • Blocker only: silhouette vertex silhouette edges blocker exterior

  19. Construct Smoothies • Blocker + smoothies: t silhouette vertex silhouette edges t smoothie edge smoothie corner blocker exterior

  20. Construct Smoothies • Smoothie edges: rectangles in screen space with a fixed width • Smoothie corners: connect adjacent smoothie edges t t geometry shading

  21. Render Smoothies • Store depth and alpha values into smoothie buffer Smoothie Buffer (alpha) Smoothie Buffer (depth) light’s viewpoint

  22. light source smoothie blocker receiver Compute Shadows • Compute intensity using depth comparisons

  23. Hard Shadow • Image sample behind blocker (intensity = 0) light source smoothie blocker receiver completely in shadow

  24. Soft Shadows • Image sample behind smoothie (intensity = ) light source smoothie blocker receiver partially in shadow

  25. No Shadow • Image sample illuminated (intensity = 1) light source smoothie blocker receiver illuminated

More Related