ShadowsOutlineEntertainment (Active)Slide 4NotationSlide 6Planar ShadowsPlanar Soft ShadowsSlide 9Projective ShadowsSlide 11Slide 12Slide 13Derivation of shadow polygonsSlide 15Slide 16Slide 17Shadow Z-bufferSlide 19Slide 20Slide 21Slide 22Aliasing problemsSlide 24Slide 25gShadow MapsShadow MapsSlide 28Slide 29Shadow VolumesStencil BufferComputing the ‘stencil’ of an objectSlide 33Slide 34Slide 35Slide 36Slide 37Slide 38Taken from:2D Cutaway of a Shadow VolumeShadow Volume AdvantagesShadow Volume DisadvantagesVisualizing Shadow Volumes in 3DVisualizing the Stencil Buffer CountsAlgorithmWhy Eye-to-Object Stencil Enter/ Leave Counting Approach WorksIlluminated, Behind Shadow VolumesShadowed, Nested in Shadow VolumesIlluminated, In Front of Shadow VolumesProblems Created by Near Plane Clipping (Zpass approach)Alternative Approach: ZfailZfail versus Zpass ComparisonSlide 53Insight!Avoiding Far Plane ClippingStandard glFrustum Projection MatrixLimit of glFrustum Projection Matrix as Far Plane is Moved to ∞Verifying Pinf Will Not Clip Infinitely Far Away Vertices (1)Verifying Pinf Will Not Clip Infinitely Far Away Vertices (2)Is Pinf Bad for Depth Buffer Precision?Pinf Depth Precision Scale FactorRobust Stenciled Shadow Volumes w/o Near (or Far) Plane CappingRendering Closed, but Infinite, Shadow Volumes1st Set of Shadow Volume PolygonsExamples of Possible Silhouette Edges for Quake2 Models2nd and 3rd Set of Shadow Volume PolygonsComplete Robust Stenciled Shadow Volume Rendering TechniqueRequirements for Our Stenciled Shadow Volume Technique (1)Requirements for Our Stenciled Shadow Volume Technique (2)Requirements for Our Stenciled Shadow Volume Technique (3)Requirements for Our Stenciled Shadow Volume Technique (4)Our Approach in Practice (1)Our Approach in Practice (2)Our Approach in Practice (3)Our Approach in Practice (4)Another Example (1)Another Example (2)Stenciled Shadow Volumes with Multiple LightsStenciled Shadow Volumes for Simulating Soft ShadowsStenciled Shadow Volume Optimizations (1)Stenciled Shadow Volume Optimizations (2)Stenciled Shadow Volume Optimizations (3)Stenciled Shadow Volume Optimizations (4)Hardware Enhancements: Wrapping Stencil OperationsHardware Enhancements: Depth Clamp (1)Hardware Enhancements: Depth Clamp (2)Hardware Enhancements: Two-sided Stencil Testing (1)Hardware Enhancements: Two-sided Stencil Testing (2)Usage of NV_stencil_two_side & EXT_stencil_wrapShadow Volume History (1)Shadow Volume History (2)Shadow Volume History (3)Shadow Volume History (4)Our ContributionConclusionsShadowsAaron BloomfieldCS 445: Introduction to GraphicsFall 2006(Slide set originally by Dave Luebke)22OutlineOutline•IntroductionIntroduction3Entertainment (Active)Doom III (ID Software)4ShadowsAn important visual cue, traditionally hard to do in real-time renderingWith depth issues, there is one algorithm used (Z-buffer)Not so much with shadowsThere are 4 competing algorithms for real-time renderingAnother option is to use texture-maps of the shadows5NotationLight sourcePoint vs area Occluders & receiversIdentify ahead of time?Self-shadowing?ShadowUmbra PenumbraSoft vs hard shadows66OutlineOutline•Planar shadowsPlanar shadows7Planar ShadowsOld trick: project the occluder geometry to a plane and render over ground planeCan do with a matrixZ-bias issuesSemiopaque shadows harderStencil and Z-buffer tricksAnother option: generate textured rectangleProblemsLight source inside object (Antishadows)Only planar receivers no self-shadowing8Planar Soft ShadowsBasic idea:Sample light source multiple times, average results (accumulation buffer) into a textureGooch et al: move plane up and downNested shadows fewer passes99OutlineOutline•Projective shadowsProjective shadows10Projective ShadowsDeveloped in ’68/’70Consider the scene from the light’s point of viewFind all pairs of polygons where one can shadow the otherO(n2) in worst caseOptimization: get rid of those that don’t interact earlyNormal scan-line conversionFind list of possible occluders for given sample/pixelThree cases1. Shadow does not cover sample: render normally2. Shadow does cover pixel: render with modulated shadow amount3. Shadow partially covers sample: subdivide, and recurse11Projective Shadows12Projective ShadowsPros“Easily” incorporates into renderersConsBad for multiple light sourcesOr moving light sources1313OutlineOutline•Derivation of shadow polygonsDerivation of shadow polygons14Derivation of shadow polygonsIdea is to determine which polygons are applying shadowsAlgorithmConsider scene from light’s point of viewRemove all hidden surfaces (which are the shadowed ones)Combine this with the original scene modelAnything not removed is shadowed15StepsintheAlgorithm16Derivation of shadow polygonsProsGood with stationary lights and a moving cameraConsHidden surface remove is done twiceOnce for the shadowsOnce for the normal reasons1717OutlineOutline•Shadow Z-bufferShadow Z-buffer18Shadow Z-bufferUse a separate shadow Z-buffer for each light sourceA bit inefficient if there are many light sourcesAlternatively, use a singe shadow buffer, and execute the algorithm once for each light sourceRender the scene from the light sourceThe shadow Z-buffer contains a ‘depth image’ from the light sourceMeaning those polygons that are light by the light sourceThen render the scene normallyIf a sample is visible, compute the corresponding sample in the shadow Z-bufferIf the distance is greater, then the sample is shadowed1920212223Aliasing problemsTwo occurrences of aliasing problemsAlong the boundary of the hard shadowsWith projecting a pixel-sized sample from two directions24AliasingProblemsWithShadowZ-buffer25Shadow Z-bufferProsUses the well-known Z-buffer algorithmConsUses the well-known Z-buffer algorithmExtends it’s inefficiency and memory requirementsSusceptible to aliasing artifacts26gShadow MapsIdea: Render scene from light source, read Z-bufferResult: discretized image (shadow map) telling distance of objects to light sourceRender scene normallyAt each pixel, calculate distance D to lightCompare to distance S stored in shadow mapIf D=S, surface lit by light, else
View Full Document