the shadow knows shadow algorithms
play

the shadow knows Shadow Algorithms Who knows what evil lurks in the - PDF document

the shadow knows Shadow Algorithms Who knows what evil lurks in the hearts of men? Why shadows? Anatomy of a shadow Increase realism Umbra Area completely obscured by object Shows relationships between objects. Hard


  1. …the shadow knows Shadow Algorithms Who knows what evil lurks in the hearts of men? Why shadows? Anatomy of a shadow � Increase realism � Umbra � Area completely obscured by object � Shows relationships between objects. � “Hard” shadows � Penumbra � Area partially obscured by object � “Soft” shadows Anatomy of a shadow Anatomy of a Shadow Learner.org Learner.org 1

  2. Anatomy of a shadow Shadows and Computer Graphics � Notes about shadows in computer graphics � Still an area of active research � Soft shadows � Real time / efficient techniques � In Global illumination algorithms shadows, even soft shadows, come “for free”. � Precalculated and “mapped” shadows. Watt / Policarpo Classic Shadow Algorithms Scan Line Algorithm � [Appel 1968][Kelley 1970] � Projecting Polygons / scan line � Object space algorithm � Shadow volumes � Uses aux data structure that records, for each � Shadow Z-Buffer (Shadow Map) polygon pair, if one polygon shadows another. � Projection from light source onto a sphere � Number of possible entries = n(n-1) � Used in conjunction with a scan line algorithm Scan Line Algorithm Scan Line Algorithm � Projection (a) A is visible (b) B is visible (c) B is shadowed by A (d) B is visible Watt / Policarpo 2

  3. Shadow Volumes Shadow volumes � [Crow 1977] � Object space � Calculate volume swept out by shadow of an object � Intersect this volume with view volume Watt / Policarpo Shadow Volumes Shadow Volumes � Advantages � Can shadow anything (including self- shadowing) � Disadvantages � Must construct the shadow volumes � Counting problem Watt / Policarpo Shadow Map Shadow z-buffer (Shadow Map) � [Williams 1978] � Step 1 (Construct shadow map) � Image space � The view of the scene is constructed from the light source’s point of view. � Use a Z buffer (depth buffer) from light � The depth values (Z) for the objects source point of view and use as a closest to the light source are stored to the texture onto scene rendered from depth map for each point. viewpoint 3

  4. Shadow Map Shadow Map � Step 2 – Use Shadow Map � Render scene from viewpoint � use the saved depth buffer as a texture which is projected from the light's position � compare the value from the texture projected onto the point to the distance from the point to the light http://www-sop.inria.fr/reves/personnel/Marc.Stamminger/psm/ Shadow Map Shadow Map � Basic Z buffer algorithm � Modified Z buffer algorithm Initialize frame buffer (to background) Initialize frame buffer (to background) Initialize Z-buffer (to 0) Initialize Z-buffer (to 0) For each polygon P { For each polygon P { For each pixel p in polygon’s projection { For each pixel p in polygon’s projection { z = P’s z at pixel p z = P’s z at pixel p if (z > Zbuffer at that pixel) { if (z > Zbuffer at that pixel) { zBuffer at pixel = z zBuffer at pixel = z Frame buffer at pixel = calcColor() Frame buffer at pixel = calcColor() } if ( z > shadow depth) place in shadow } } } Shadow Map Building a Better Shadow Map � Filtering � Advantages � Z-buffer, projection supported in hardware � Disadvantages � Aliasing � Self shadowing difficult 4

  5. Building a Better Shadow Map Building a Better Shadow Map � Deep Shadow Maps � shadow maps store visibility functions for every pixel. � function describes how the light passes from the shadow camera origin to the desired pixel. � 0 – 1 rather than 0 or 1. Lokovic/Veach 2000 Summary Wednesday � Shadows…the shadow knows � Peter Anderson… � Classic Shadow Algorithms � Linear Pixel Shuffling � Scan line � Don’t forget 1 page summary! � Shadow volumes � Shadow maps � Shadow algorithms are still an active research area. � Questions? 5

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend