{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

shadowscg02 - Computer Graphics 2 Graphics Hardware and...

Info icon This preview shows pages 1–14. Sign up to view the full content.

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

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

View Full Document Right 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
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 Position & direction of light source 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
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right 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 !
Image of page 6
How to add shadows ? 2 nd & correct method: Use mask for each light 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
Image of page 7

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

View Full Document Right 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 Use more lights & masks in one pass Masks stored as textures Apply masks & sum up using e.g. register combiners
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
Image of page 9

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

View Full Document Right 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.
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
Image of page 11

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

View Full Document Right Arrow Icon
Projected Geometry [Blinn88] Me and my fake shadow Shadows for selected large receiver polygons Ground plane Walls
Image of page 12
Projected Geometry Example: xz plane at y=0 y y y z z y z y y y x x y x v l v l v l p v l v l v l p - - = - - =
Image of page 13

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

View Full Document Right Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern