1 / 11

Shadow Volume

Shadow Volume. 黃聰賢. Introduction. Light Position. Mesh Polygon. Shadow Polygon. Top View. Camera. Screen. Side View. Camera View. Pass 1. Clear color buffer and stencil buffer Render the scene with ambient only. Pass 2. Mask color buffer and depth buffer

saniya
Télécharger la présentation

Shadow Volume

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. Shadow Volume 黃聰賢

  2. Introduction Light Position Mesh Polygon Shadow Polygon

  3. Top View Camera Screen Side View Camera View

  4. Pass 1 • Clear color buffer and stencil buffer • Render the scene with ambient only

  5. Pass 2 • Mask color buffer and depth buffer • Use glColorMask and glDepthMask • Enable back face culling • glCullFace(GL_BACK); • Increase stencil value if depth test is passed • Draw shadow polygons Stencil value = 1 Stencil value = 0

  6. Pass 3 • Mask color buffer and depth buffer • Enable front face culling • glCullFace(GL_FRONT); • Decrease stencil value if depth test is passed • Draw shadow polygons Stencil value = +1 -1 = 0 Stencil value = +1

  7. Pass 4 • Clear depth buffer • Set stencil pass condition • Equal to zero • Render the scene with full lighting (There are many ways to combine color.) Camera 0 Screen 0 1 0 Ambient only

  8. Silhouette Edges light

  9. Silhouette Edge Detection • Why? -1 +1 +1-1 =0

  10. n front • How? n front light Edge A n front back Edge B n Edge C back back n n

  11. Orientation Back Front b n c c n a b a b' b' a' a' Ensure shadow polygons face outside.

More Related