shadowscg02 - Computer Graphics 2 Graphics Hardware and...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Graphics 2 Graphics Hardware and OpenGL Shadows Stefan Brabec
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Overview Shadow Algorithms for real time / interactive rendering applications Topics Local vs. Global Illumination How to add shadows to your scene Fake methods Analytic methods Projected Geometry Shadow Volumes Pixel-based methods Shadow Maps Soft Shadows
Background image of page 2
Local vs. Global Illumination Core OpenGL uses local illumination model Light sources used: distant, point, spot Pros: Fast calculation of pixel color using Phong, only needs Material properties (diffuse, specular, ambient coeff) Light settings (intensity, fall-off, color) but no info about other objects in the scene ! Each primitive can be processed independently of others Cons: Good looking images need global effects Reflected light (e.g. environment mapping) Shadows
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Global: Shadows A point is in shadow if the light got blocked between the light source and point Light Source Viewer Point is in shadow Occluder Point is lit Need mask that contains information about blocked / non blocked pixels
Background image of page 4
Masking in OpenGL OpenGL provides several ways of masking pixels Stencil buffer with stencil test Alpha test with alpha values Texture stage Blending
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How to add shadows ? Can be done in two ways: 1 st method: Full illumination + darkening FB = DiffuseTex0 * ( Light0 + Light1 + Light2… ) if pixel is in shadow (with respect to Light0) FB = FB * 0.5 This is wrong since the contribution of Light1,2 etc. is also affected !
Background image of page 6
How to add shadows ? 2 nd FB = DiffuseTex0 * ( Light0 * Mask0 + Light1 * Mask1 + Light2 * Mask2… ) Mask values 0 if pixel is in shadow (with respect to Light X) 1 if pixel is lit by Light X 0…1 for pixels on shadow edge (soft shadow edge) Accumulation of (Light0 * Mask0)+ … can be done using additive blending
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How to add shadows ? Algorithm Render scene with ambient illumination only For each light source Render scene with illumination from this light only Scale illumination by shadow mask Add up contribution to frame buffer Expensive but correct ! Speed-Up Masks stored as textures Apply masks & sum up using e.g. register combiners
Background image of page 8
Shadows in OpenGL Fake methods Should give impression of a global computation Analytic methods Process scene’s geometry Pixel based methods Work on sampled representations of the scene
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fake methods Still commonly used in games Shadows are simple, hand-drawn polygons No global effect …but better than no shadow at all Images from TombRaider. ©Eidos Interactive.
Background image of page 10
Analytic Methods Analytic shadow techniques generate the shadow mask using the scene’s geometry Object space precission Two methods explained in detail Projected Geometry Shadow Volumes
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/05/2010 for the course COMPUTER S 876 taught by Professor Ch during the Spring '10 term at Amirkabir University of Technology.

Page1 / 57

shadowscg02 - Computer Graphics 2 Graphics Hardware and...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online