Jim X. Chen George Mason University

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

Lecture 8 Transparency, Mirroring
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
Game Programming 09 OGRE3D Lighting/shadow in Action
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Computer Graphics methods
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
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.
Shadow Algorithms Gerald Matzka Computer Science Seminar.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
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.
Hidden Surface Removal
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Computer Graphics Mirror and Shadows
Shadow Algorithms Ikrima Elhassan.
Direct Illumination with Lazy Visibility Evaluation David Hart Philip Dutré Donald P. Greenberg Cornell University SIGGRAPH 99.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
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.
CHAPTER 11 Shadows © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –Shadow rendering algorithms – –Blinn’s shadow.
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.
1 Shadows (2) ©Anthony Steed Overview n Shadows – Umbra Recap n Penumbra Analytical v. Sampling n Analytical Aspect graphs Discontinuity meshing.
1 10/24/ :01 UML Graphics II Shadows Session 4.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Computer graphics & visualization Shadows / Transparency.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Bounding Volume Hierarchy. The space within the scene is divided into a grid. When a ray travels through a scene, it only passes a few boxes within the.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
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.
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.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
1© 2009 Autodesk Hardware Shade – Presenting Your Designs Hardware and Software Shading HW Shade Workflow Tessellation Quality Settings Lighting Settings.
Rendering Pipeline Fall, 2015.
- Introduction - Graphics Pipeline
Real-Time Soft Shadows with Adaptive Light Source Sampling
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
Distributed Ray Tracing
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
Mike Merchant Nicholas Hilbert
CSCE 441: Computer Graphics Hidden Surface Removal
Path Tracing (some material from University of Wisconsin)
Introduction to Computer Graphics with WebGL
Real-Time Rendering Intro to Shadows
Lecture 13 Clipping & Scan Conversion
Distributed Ray Tracing
UMBC Graphics for Games
Ray Tracing Polyhedra ©Anthony Steed
Distributed Ray Tracing
Computer Graphics Material Colours and Lighting
Frame Buffer Applications
Distributed Ray Tracing
Presentation transcript:

Jim X. Chen George Mason University Basic Shadow Methods Jim X. Chen George Mason University Covers chapter 14.1 & 14.2 of Computer Graphics and Virtual Environments (Slater, Steed and Chrysanthou) . See www.booksites.net/slater 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Light source Light Creator Receiver Shadow Observation: Shadows are places light does not reach. 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Definitions Light sources Shadow creator(occluder)s and receivers Light source Creator and receiver Creator Note back facing primitives (as seen from the light source) are always in shadow So the sphere is self shadowing too (not shown) Receiver 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadows 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volume Shadow planes Volume formed from shadow planes Open and infinite Inside in shadow - outside in light Must be clipped and capped 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volume A point is shadowed iff it is in at least one shadow volume Light Cap Side Shadow Volume Dark Cap (at infinity) 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Ray Tracing Shadows Ray tracing casts shadow feelers to a point light source. Many light sources are illuminated over a finite area. The shadows between these are substantially different. Area light sources cast soft shadows Penumbra Umbra 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Soft Shadows 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Soft Shadows Umbra – No part of the light source is visible. Penumbra – Part of the light source is occluded and part is visible (to a varying degree). Which part? How much? What is the Light Intensity reaching the surface? 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Anti-Aliasing Supersampling Jittering – Stochastic Method 6 10 2 13 3 14 12 8 15 7 11 5 9 4 1 eye 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Supersampling 1 sample per pixel 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Supersampling 16 samples per pixel 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Supersampling 256 samples per pixel 9/21/2018 CS 752 Interactive Graphics Software

Monte Carlo Integration For each hit point, use a bundle of rays and take the average - Expensive Monte Carlo Approach Using a randomly chosen ray at each hit point Average the value from each ray 9/21/2018 CS 752 Interactive Graphics Software

Result: Hard Shadow - Cube Without antialiasing With antialiasing 9/21/2018 CS 752 Interactive Graphics Software

Result: Soft Shadow - Ball Hard shadow Soft shadow 9/21/2018 CS 752 Interactive Graphics Software

More Shadow Algorithms Fake Shadow Vertex Projection Shadow Z-Buffer Shadow Volume … 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Fake Shadow No exact calculation Approximation of shadow position and shape Estimated by center or anchor of object Pro: simple, fast Contra: flat ground, only ground shading, not exact, rotate limitations 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Vertex Projection Object projected to ground Exact mathematical calculation Pro: still simple, exact, no rotate limitations Contra: flat ground, only ground shading 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Projection Shadows Project creator geometry onto receiver plane [Blinn] Projection matrix M p=Mv l=(lx,ly,lz) y v p y=0 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Projection Shadows Render projected polygons to an image (render-to-texture) Apply image as a texture onto the receivers Compute texture coords on the fly Use projective texturing Advantage: Texture can be projected onto multiple shadow receivers Do not need to regenerate texture if static scene Limitation: objects can either cast or receive a shadow, not both 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Z-buffer 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Z-buffer Based on hidden surfaces Light’s point of view rendering into Z-Buffer Camera’s point of view rendering, lookup in Z-Buffer Transformation between camera and light view Z-value compare - shadowed or lit 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Z-buffer Render the scene twice First from the light source Need z-buffer only Second from the camera Each time we scan a pixel P (xv,yv,zv) transform P to light space (xs,yz,zs) and test zs against stored value in z-buffer from light If less than or equal to this value it is lit 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Z-buffer “Less than or equal” test is imprecise it is only accurate in the image space of the light self-shadowing: small fudge factor Imagine a shadow throw over complex objects or long distances point-sampling: area-sampling 9/21/2018 CS 752 Interactive Graphics Software

Shadow Volume Techniques 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes Just like a polygon - you are inside a volume if you need to cross a surface to exist it General idea of shadow volumes is count the number of shadow planes you cross +1 for front facing -1 for back facing If total is >0 you are in shadow Special case if the eye itself is in shadow 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes Two stages: 1) Preprocessing Find all planes of the shadow volume and their plane equations 2) At run-time Determine shadow plane count per pixel Use a scan-line method OR stencil test 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Using Stencil Test Three steps: silhouette generation drawing of shadow volume(s) rendering the shadow 9/21/2018 CS 752 Interactive Graphics Software

Shadow Volume Stencil Test A stencil buffer is screen sized buffer (1-8bit) that stores a flag about a rendering operation E.G. stencil[x,y] is negated if zbuffer[x,y] is less than current z value (i.e. stencil is set if and only if z buffer test passes) Many uses in graphics 9/21/2018 CS 752 Interactive Graphics Software

Shadow Volume Stencil Test Render the scene into the RGB and z-buffer Turn z-buffer writing off, then render all shadow polygons with the stencil buffer Increment stencil count for front-facing Decrement for back facing Re-render scene with lighting OFF and only render pixels where stencil is non-zero 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes cont. Step 1: Silhouette generation boundaries between adjacent front-facing and back-facing polygons  silhouette adding light vertex to silhouette vertexes  shadow planes shadow planes together with object  shadow volume 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes cont. Step 2: Drawing of Shadow volume rendered in stencil buffer 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes cont. Step 3: Rendering the Shadow stencil buffer holds shadow render a polygon using stencil buffer bits shadow for one light created Repeat for next light from step 1 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Shadow Volumes cont. Pro: greatly improved realism hardware support of stencil buffer Contra: high requirement on fill-rate sharp shadow additional scene management 9/21/2018 CS 752 Interactive Graphics Software

Shadow Volume BSP Trees Instead of calculating shadows in image calculate in object space Break up objects into shadowed and un-shadowed objects Saves time shading pixels More polygons (potentially many more) Precision problems 9/21/2018 CS 752 Interactive Graphics Software

Starting the SVBSP Tree 9/21/2018 CS 752 Interactive Graphics Software

Continuing the SVBSP Tree 9/21/2018 CS 752 Interactive Graphics Software

Finishing the SVBSP Tree Can continue until ALL polygons are in the SVBSP tree Usually put shadow casting polygons in the tree first, and then filter remaining polygons down the tree to see if they are lit or un-lit A polygon that ends up at an in-node is stored there as shadowed but doesn’t force the tree to be expanded 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Summary Projected Polygons Good: Simple, quick, and all hardware can do it. Bad: Can only cast shadows to a plane. Project to Create a Texture Good: Semitransparent, can reuse texture created, and can project shadow onto any surfaces. Bad: Objects either cast or receive shadows, not both. 9/21/2018 CS 752 Interactive Graphics Software

CS 752 Interactive Graphics Software Summary, continued Shadow Maps Good: Anything to anything, constant cost regardless of complexity, map can sometimes be reused. Bad: Only feasible on some hardware, frustum limited. Shadow Volumes Good: Anything can shadow anything, including self- shadowing, and the shadows are crisp. Bad: shadow polygons must be generated and rendered (lots of polygons & fill), CPU intensive. 9/21/2018 CS 752 Interactive Graphics Software