Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Optimized Stencil Shadow Volumes
Graphics Pipeline.
Game Programming 09 OGRE3D Lighting/shadow in Action
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Computer Graphics methods
Real-Time High Quality Rendering CSE 291 [Winter 2015], Lecture 3 Shadow and Environment Mapping
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Shadow and Shadow Maps [5]. Object without shadow seem floating above the scene Shadow gives the depth information Shadow gives the information of the.
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
1 Dr. Scott Schaefer Shadows. 2/40 Shadows Shadows provide clues about depth Make scenes appear more realistic.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Real-Time Rendering COMS , Lecture 9. Real-Time Rendering Demo Motivation: Interactive rendering with complex natural illumination and realistic,
Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering Cass Everitt and Mark J. Kilgard Speaker: Alvin Date: 5/28/2003 NVIDIA.
Shadow Algorithms Gerald Matzka Computer Science Seminar.
Real-Time High Quality Rendering COMS 6160 [Fall 2004], Lecture 4 Shadow and Environment Mapping
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Computer Graphics Shadows
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Computer Graphics Mirror and Shadows
Shadow Algorithms Ikrima Elhassan.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
CS 638, Fall 2001 Today Light Mapping (Continued) Bump Mapping with Multi-Texturing Multi-Pass Rendering.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
1 Shadows © Jeff Parker, 2011 " What is written without effort is in general read without pleasure.” -- Samuel Johnson.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CHAPTER 11 Shadows © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –Shadow rendering algorithms – –Blinn’s shadow.
MIT EECS 6.837, Durand and Cutler Real-Time Shadows.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Real-time Shadow Mapping. Shadow Mapping Shadow mapping uses two-pass rendering - render depth texture from the light ’ s point-of-view - render from.
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Implementation II.
Computer graphics & visualization Shadows / Transparency.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Computer Graphics I, Fall 2010 Implementation II.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.
Stencil Shadows Garrett Weng. What are stencil shadows? Also known as shadow volumes Relies on use of the stencil buffer Create volumes of the shadows.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Shuen-Huei Guan Seminar in CMLab, NTU
CENG 477 Introduction to Computer Graphics
Computer Graphics Implementation II
Discrete Techniques.
3D Graphics Rendering PPT By Ricardo Veguilla.
Jim X. Chen George Mason University
Real-time Rendering Shadow Maps
UMBC Graphics for Games
RADEON™ 9700 Architecture and 3D Performance
Frame Buffer Applications
Presentation transcript:

Erdem Alpay Ala Nawaiseh

Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the realism of a scene is lost Spatial location of models can be ambiguous

Importance of Shadows Where is the light coming from? Where are the objects in relation to each other?

Importance of Shadows Where is the light coming from? Where are the objects in relation to each other? Shadows are being cast and the answers to these questions are easily found.

Common Real-Time Shadow Techniques Shadow volumes Light maps Projected planar shadows Hybrid approaches

Easy To Implement and with good results when casting shadows onto one plane Squishes the Model onto a plane in just one matrix multiplication Very Fast Can extend to cast onto multiple planes, but each plane will require another rendering of the model. Planar Projected Shadows

[x, y, z] is the difference between the center of the model and the light source. Ideally you want to use the distance from each vertex, However it is not as fast since the matrix will have to be computed on a per vertex basis instead of a per model basis. The vertices of the model are multiplied by the Planar Projection matrix. Plane Eq: Ax + By + Cz + D = 0

Shadow Mapping Lance Williams published the idea in 1978 Completely image-space algorithm  No knowledge of scene’s geometry is required  must deal with aliasing artifacts Well known software rendering technique  Pixar’s RenderMan uses the algorithm  Basic shadowing technique for Toy Story, etc.

Two pass algorithm: First, render depth buffer from the light’s point-of- view  Essentially a 2D function indicating the depth of the closest pixels to the light.  The result is a “depth map” or “shadow map”. Second, render scene from the eye’s point-of- view  For each rasterized fragment determine fragment’s XYZ position relative to the light  compare the depth value at light position XY in the depth map to fragment’s light position Z The Shadow Mapping

The Shadow Mapping Cont. The Shadow Map Comparison Two values  A = Z value from depth map at fragment’s light XY position  B = Z value of fragment’s XYZ light position If B is greater than A, then there must be something closer to the light than the fragment  then the fragment is shadowed If A and B are approximately equal, the fragment is lit

Shadow Mapping with a Picture in 2D (1) light source depth map Z = A depth map’s image plane A < B shadowed fragment case First step

Shadow Mapping with a Picture in 2D (1) light source eye position depth map Z = A fragment’s light Z = B depth map’s image plane eye view image plane, a.k.a. the frame buffer A < B shadowed fragment case Second Step

Shadow Mapping with a Picture in 2D (2) light source eye position depth map Z = A fragment’s light Z = B depth map image plane eye view image plane, a.k.a. the frame buffer A  B unshadowed fragment case

Shadow Mapping with a Picture in 2D (3) The depth map could be at a different resolution from the frame buffer This mismatch can lead to artifacts image precision mismatch! An artifact is small error caused by the render process.

More realistic Example for mapping 1 st Pass

More realistic Example for mapping 2 nd Pass

Z-Buffer (Depth Buffer) Speeds up games by telling the graphics processor not to render objects that aren't actually in view, specifically objects or parts of objects which are covered up by other geometry. Ranges from 16bit to 32bit, and it can take up as much memory as an extra frame buffer. If depth test is enabled, when a new color that arrives for a pixel is closer to the window than the one already in the depth buffer. If it passes, it then replaces the value already in the depth buffer.

Stencil Buffer It's usually only 1bit or 8bit. The stencil allows applications to "tag" various regions of the frame buffer. The stencil buffer can tell the video card what it's allowed to redraw For example, let's say you have an air simulation game where the view is from the cockpit. It would be a waste to render the cockpit interior every frame the cockpit interior is tagged with a stencil number > 1 The stencil buffer tag will tell the video card to only redraw where it sees a 0 in the stencil buffer

What Is Shadow Volume A volume of space formed by an occluder Bounded by the edges of the occluder First proposed by Frank Crow in Notice that the “far” ends of the volume goes to infinity

How does Shadow Volume works Compute the shadow volume for all visible polygons from the light source Add the shadow volume polygons to the scene database Tag them as shadow polygons Assign its associated light source

Approaches in shadow volumes  Initially set parity to 0 and shoot a ray from eye to P  Invert parity when the ray crosses the shadow volume boundary  Parity = 1  it is in shadow  Parity = 0  it is not in Shadow First approach : Parity Test When is a surface is inside shadow?

Approaches in shadow volumes First approach : Parity Test Problems with Parity Test

How does Shadow Volumes Works  Consider a camera at any point outside of the shadow and a point being shaded. Shoot a ray from camera to the point.  If the point is in the shadow volume it will have a positive value since the ray incremented the stencil buffer every time it entered the shadow volume (front facing), and decremented it when it left (back facing). Second Approach : Counter When is a surface is inside shadow?

How does Shadow Volumes Works If the camera is within the shadow volume the incrementing and decrementing must be reversed. This however is extra work for a check to determine the location of the camera must be made. Shadowing object light source eye position

Shadow Volumes Step 1: Render scene  Z-values

Shadow Volumes Front face: +1 Step 2: Render shadow volume faces Back face: -1

Shadow Volumes Front face: ±0 (Depth test) Back face:±0 (Depth test)  =±0

Shadow Volumes Front face: +1 Back face:±0 (Depth test)  =+1 ±0

Shadow Volumes Front face: +1 Back face:-1  =±0 ±0 +1

Shadow Volumes ±0 +1 ±0 Step 3: Apply shadow mask to scene

Conclusion Shadow Mapping: offers real-time shadowing effects Independent of scene complexity Does not mandate multi-pass as stenciled shadow volumes do Ideal for shadows from spotlights Shadow Volume: The addition of shadow volume polygons can greatly increase your database size Using the stencil buffer approach, pixel fill becomes a key speed factor More precise than shadow mapping Polygon count explodes with object complexity of geometry and number of light sources

References Shadow Mapping References Lance Williams, “Casting Curved Shadows on Curved Surfaces,” SIGGRAPH 78 (paper) William Reeves, David Salesin, and Robert Cook (Pixar), “Rendering antialiased shadows with depth maps,” SIGGRAPH 87 (paper) adow_mapping.pdf adow_mapping.pdf

References Shadow Volume References Lance Williams, “Casting Curved Shadows on Curved Surfaces,” SIGGRAPH 78 (paper) William Reeves, David Salesin, and Robert Cook (Pixar), “Rendering antialiased shadows with depth maps,” SIGGRAPH 87 (paper) adow_mapping.pdf adow_mapping.pdf Shadow Volume Reconstruction from Depth Maps Michael D. McCool University of Waterloo