Presentation is loading. Please wait.

Presentation is loading. Please wait.

黃聰賢. Light Position Mesh Polygon Shadow Polygon  Clear color buffer and stencil buffer  Render the scene with ambient only.

Similar presentations


Presentation on theme: "黃聰賢. Light Position Mesh Polygon Shadow Polygon  Clear color buffer and stencil buffer  Render the scene with ambient only."— Presentation transcript:

1 黃聰賢

2 Light Position Mesh Polygon Shadow Polygon

3  Clear color buffer and stencil buffer  Render the scene with ambient only

4  Mask color buffer and depth buffer  Enable back face culling  Increase stencil value if depth test is passed  Draw shadow polygons Stencil value = 1 Stencil value = 0

5  Mask color buffer and depth buffer  Enable front face culling  Decrease stencil value if depth test is passed  Draw shadow polygons Stencil value = +1 -1 = 0 Stencil value = +1

6  Clear depth buffer  Set stencil pass condition ◦ Equal to zero  Render the scene with full lighting Ambient only

7 light

8  Why? +1 +1-1 =0

9  How? Edge A Edge B light n n n n front back Edge C n back n

10 Front n Back n Ensure shadow polygons face outside. ab a' b' a b a' c c


Download ppt "黃聰賢. Light Position Mesh Polygon Shadow Polygon  Clear color buffer and stencil buffer  Render the scene with ambient only."

Similar presentations


Ads by Google