Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi."— Presentation transcript:

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

2 Shadow Volumes

3

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

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

6 Stencil Generation Disable depth and color writes Disable depth and color writes Set the stencil operation to increment on depth pass (counting shadows in front of the object) Set the stencil operation to increment on depth pass (counting shadows in front of the object) Enable back-face culling (ie front drawing) Enable back-face culling (ie front drawing) Draw the shadow volumes (ie front faces) Draw the shadow volumes (ie front faces) Set the stencil operation to decrement on depth pass Set the stencil operation to decrement on depth pass Enable front-face culling Enable front-face culling Draw the shadow volumes (ie back faces) 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 Disable depth and color writes Enable front-face culling Enable front-face culling Set the stencil operation to increment on depth fail (counting shadows behind the object). Set the stencil operation to increment on depth fail (counting shadows behind the object). Render the shadow volumes (ie back faces) Render the shadow volumes (ie back faces) Enable back-face culling Enable back-face culling Set the stencil operation to decrement on depth fail. Set the stencil operation to decrement on depth fail. Render the shadow volumes (ie front faces) Render the shadow volumes (ie front faces)

9 Shadow Map Aliasing single shadow map pixel

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

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

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

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

14 Fake Soft Shadows Extend shadow map [Chan & Durand 03] Extend shadow map [Chan & Durand 03] Use extra primitives (smoothies) to soften shadows 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 not geometrically correct Shadows appear qualitatively like soft shadows Shadows appear qualitatively like soft shadows Hard shadowsFake soft shadows

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

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

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

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

20 Construct Smoothies Smoothie edges: rectangles in screen space with a fixed width Smoothie edges: rectangles in screen space with a fixed width Smoothie corners: connect adjacent smoothie edges Smoothie corners: connect adjacent smoothie edges t t geometryshading

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

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

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

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

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


Download ppt "CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi."

Similar presentations


Ads by Google