Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shadow Algorithms Gerald Matzka Computer Science Seminar.

Similar presentations


Presentation on theme: "Shadow Algorithms Gerald Matzka Computer Science Seminar."— Presentation transcript:

1 Shadow Algorithms Gerald Matzka Computer Science Seminar

2 G. Matzka, 2001.06.20 2 / 22 Overview n Introduction n Shadow Algorithms u Fake Shadow u Vertex Projection u Shadow Z-Buffer u Shadow Volume u u Shadow Volume Reconstruction u u Static Shadow n Use Cases

3 G. Matzka, 2001.06.20 3 / 22 Introduction n Why Shadow? n What is Shadow? n Anatomy of Shadow n Umbra vs. Penumbra n Shadow Volume

4 G. Matzka, 2001.06.20 4 / 22 Why Shadow? n Objects appear not anchored n Shadow provides additional information n Second view of an object n Without shadow object seems to float n State of the art

5 G. Matzka, 2001.06.20 5 / 22 Definition: Shadow n n “An area that is only partially irradiated or illuminated due to blockage of light by an opaque object.” n n A point is in shadow relative to a given light source if rays from that light source cannot directly reach the point. Shadowed points cannot see the light.

6 G. Matzka, 2001.06.20 6 / 22 Umbra vs. Penumbra n Area light sources produce soft shadow n Umbra: area in full shadow n Penumbra: boundary area; gradient from full shadow to light

7 G. Matzka, 2001.06.20 7 / 22 Definition: Shadow Volume n Shadow planes n Volume formed from shadow planes n Open and infinite n Inside in shadow - outside in light n Must be clipped and capped

8 G. Matzka, 2001.06.20 8 / 22 Shadow Algorithms n Fake Shadow n Vertex Projection n Shadow Z-Buffer n Shadow Volume n n Shadow Volume Reconstruction n n Static Shadow

9 G. Matzka, 2001.06.20 9 / 22 Fake Shadow n No exact calculation n Approximation of shadow position and shape n Estimated by center or anchor of object n Pro: simple, fast n Contra: flat ground, only ground shading, not exact, rotate limitations

10 G. Matzka, 2001.06.20 10 / 22 Vertex Projection n Object projected to ground n Exact mathematical calculation n Pro: still simple, exact, no rotate limitations n Contra: flat ground, only ground shading

11 G. Matzka, 2001.06.20 11 / 22 Shadow Z-Buffer n Based on hidden surfaces n Light’s point of view rendering into Z-Buffer n Camera’s point of view rendering, lookup in Z- Buffer n Transformation between camera and light view n Z-value compare - shadowed or lit

12 G. Matzka, 2001.06.20 12 / 22 Shadow Z-Buffer cont. n Problems: n Problems: inaccuracies in calculations u self-shadowing: small fudge factor u point-sampling: area-sampling n Pro: n Pro: accurate, medium effort n n Contra: blocky, self-shadowing, compare with neighbor, drawn twice

13 G. Matzka, 2001.06.20 13 / 22 Shadow Volumes n Count of Shadow Volumes at viewing position n front plus  back minus n Three steps: u silhouette generation u drawing of shadow volume(s) u rendering the shadow

14 G. Matzka, 2001.06.20 14 / 22 n Step 1: Silhouette generation u u boundaries between adjacent front-facing and back-facing polygons  silhouette u u adding light vertex to silhouette vertexes  shadow planes u u shadow planes together with object  shadow volume Shadow Volumes cont.

15 G. Matzka, 2001.06.20 15 / 22 Shadow Volumes cont. n n Step 2: Drawing of Shadow volume u u rendered twice in stencil buffer (cull- mode)

16 G. Matzka, 2001.06.20 16 / 22 Shadow Volumes cont. n Step 3: Rendering the Shadow u stencil buffer holds shadow u render a polygon using stencil buffer bits u shadow for one light created n Repeat for next light from step 1

17 G. Matzka, 2001.06.20 17 / 22 Shadow Volumes cont. n Pro: u greatly improved realism u hardware support of stencil buffer n Contra: u high requirement on fill-rate u sharp shadow u additional scene management

18 G. Matzka, 2001.06.20 18 / 22 Shadow Volume Reconstruction n mixture of Z-Buffer and Shadow Volume n light’s point of view rendering n edge filter to create silhouette image n silhouette image used as shadow volume n clip and cap shadow volume n draw shadow volume n apply shadow accordingly

19 G. Matzka, 2001.06.20 19 / 22 Shadow Volume Reconstruction n Pro: u smoother than Z-Buffer u faster than Shadow Volume n Contra: u u additional step (edge filter, reconstruction) u u inaccuracies (edge filter, reconstruction)

20 G. Matzka, 2001.06.20 20 / 22 Static Shadow n not a real-time Shadow Algorithm n none moving or none animating objects n pre-calculated shadow maps n rendered as normal polygons

21 G. Matzka, 2001.06.20 21 / 22 Use Cases n Games and 3D Engines n Ray-Tracers (no real-time shading) n Trade-Off between speed and quality!!! n Outcast: derived Z-Buffer algorithm, caused by voxel and polygon mixture

22 G. Matzka, 2001.06.20 22 / 22 Conclusion n Shadow gives large amount of information n Shadow generation is a classic computer graphics problem n Several basic algorithms with advantages and disadvantages n State of the art in modern computer games

23 The End Thanks for listening!


Download ppt "Shadow Algorithms Gerald Matzka Computer Science Seminar."

Similar presentations


Ads by Google