Shadow Rendering Techniques A point is in the shadow of a light source if it can not be “seen” by the light source, i.e. the line segment that connects.

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

Week 9 - Friday.  What did we talk about last time?  Area lighting  Environment mapping  Blinn and Newell's method  Sphere mapping  Cubic environmental.
Computer graphics & visualization Global Illumination Effects.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Advanced Effects CMSC 435/634. General Approach Ray Tracing – Shoot more rays Rasterization – Render more images.
Illumination Models Radiosity Chapter 14 Section 14.7 Some of the material in these slides may have been adapted from University of Virginia, MIT, Colby.
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
May Visible Surface Detection Shmuel Wimer Bar Ilan Univ., Eng. Faculty Technion, EE Faculty.
1 Dr. Scott Schaefer Shadows. 2/40 Shadows Shadows provide clues about depth Make scenes appear more realistic.
Illumination Model & Surface-rendering Method 박 경 와.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Course Website: Computer Graphics 18: Ray-tracing.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
IMGD 1001: Illumination by Mark Claypool
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
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
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
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
Radiosity 김 성 남. Contents Definition/Goal Basic Radiosity Method Progressive Radiosity Method Mesh substructuring Hierarchical Radiosity Ray.
-Global Illumination Techniques
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Global illumination algorithms Graphics.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
1 10/24/ :01 UML Graphics II Shadows Session 4.
CS 325 Introduction to Computer Graphics 04 / 14 / 2010 Instructor: Michael Eckmann.
Basic Ray Tracing CMSC 435/634.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
Monte-Carlo Ray Tracing and
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.
CSCE 441: Computer Graphics Ray Tracing
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
CS 445 / 645 Introduction to Computer Graphics Lecture 16 Lighting Lighting.
1. Ray Casting Surface intersection Visible surface detection Ray Tracing Bounce the ray Collecting intensity Technique for global reflection and transmission.
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Distributed Ray Tracing. Can you get this with ray tracing?
CS552: Computer Graphics Lecture 33: Illumination and Shading.
CS 376 Introduction to Computer Graphics 04 / 18 / 2007 Instructor: Michael Eckmann.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Basic Ray Tracing CMSC 435/634.
3D Graphics Rendering PPT By Ricardo Veguilla.
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
(c) 2002 University of Wisconsin
Distributed Ray Tracing
(c) 2002 University of Wisconsin
GR2 Advanced Computer Graphics AGR
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Shadow Rendering Techniques A point is in the shadow of a light source if it can not be “seen” by the light source, i.e. the line segment that connects the point and the light source intersects other objects. A point that is in the shadow of a light source is not illuminated by the light source.

Direct Projection Method Projection Plane Light Source Object Projected Shadow P (x, y, z) P' (x', y', z') P L (x L, y L, z L ) N  P' + D = 0

Shadow Map Method xLxL zLzL Shadow Map Shadow Map: Texture that stores depth values when the scene is rendered from the perspective of a light source. xvxv zvzv zLzL P 0 (View Point) P L (Light Source) xLxL

1)Render the scene from the perspective of the light source. Save depth buffer content as shadow map. 2)Render the scene from the original view point. For each point in the scene, transform its position into light source local coordinates and use the transformed position as texture coordinates (s, t, r). 3)Sample shadow map using (s, t) coordinates, compare the result with r coordinate. If it’s less than r, then the point is in the shadow, otherwise it’s not in the shadow. Shadow rendering procedure using shadow map

Shadow Volume Method Light Source Object to cast shadow Shadow Volume Object Outline Shadow Volume: An enclosed region of space that is formed by extruding object outline from the light source.

Z-Pass Shadow Volume Algorithm Light Source 1.For each point in the scene, connect a line segment from this point to the view point; 2.Count the number of front facing and back facing shadow volume faces this line segment intersects: n f and n b ; 3.If n f = n b the point is illuminated, otherwise it is in the shadow. View Point Illuminated Shadowed Shadow Volume Object Outline Z-Path algorithm generates incorrect results when the view point itself is in the shadow.

Z-Fail Shadow Volume Algorithm Light Source 1.For each point in the scene, cast a ray from this point to infinity that runs away from the view point; 2.Count the number of front facing and back facing shadow volume faces this ray intersects: n f and n b ; 3.If n f = n b the point is illuminated, otherwise it is in the shadow. View Point Illuminated Shadowed Shadow Volume Object Outline Z-Fail algorithm generates correct results when the view point itself is in the shadow.

Generate Shadow Volume Faces Orientation of a polygon surface with respect to light source P PLPL N L Polygon Surface Light Source P L Light source position PA point on polygon surface L = P L  P Direction to light vector NPolygon surface normal N  L > 0, The polygon surface faces toward the light source (front facing) N  L  0, The polygon surface faces away from the light source (back facing)

Determine object outlines with respect to light source Polygon Surfaces Light Source Polygon Edge For each polygon edge: 1.Find the two polygon surfaces that share this edge. 2.Determine the orientations of these two surfaces with respect to the light source. 3.If one is facing toward the light and the other is facing away from the light, then this polygon edge is an outline.

Extrude a point away from light source P P'P' PLPL d P L Light source position PPoint to be extruded P' Extruded point dExtrusion distance

Shadow Volume Generation Algorithm Front Face (unchanged) Light Source Outline Edge 1.All polygon surfaces that face toward the light source form the top cap of the shadow volume. 2.For all polygon surfaces that face away from the light source, extrude their vertices and the new extruded polygons form the bottom cap of the shadow volume. 3.Find all polygon edges that are outlines and extrude these outlines into quadrilaterals. These quadrilaterals form the side of the shadow volume. Back Face (extruded) Quadrilateral (Extruded from Outline)

Shadow Volume Using Stencil Buffer 1.Render the scene with all light sources turned off. 2.Clear Stencil Buffer 3.Turn off depth buffer and color buffer writes. 4.Render all shadow volume faces facing away from the viewer. Increase stencil buffer value by one for each point that fails the depth test. 5.Render all shadow volume faces facing towards the viewer. Decease stencil buffer value by one for each point that fails the depth test. 6.Turn on depth buffer and color buffer writes. 7.Render the scene again with light source turned on and only where the stencil buffer value is zero. 8.Repeat 2, 3, 4, 5, 6, 7 for each light source.

Radiosity Illumination Model Use physical laws that govern radiant energy transfer between objects. Radiant Energy Terms Total Radiant Energy E Radiant Flux (Radiant Power): Radiant energy transmitted per unit time Radiosity : Radiant flux per unit area of a surface Intensity : Radiant flux in a certain radiant direction per unit solid angle per unit projected area  : Angle between radiant direction and surface normal

Radiosity for Lambertian Reflector x y N   dd dB Radiant Direction

Form Factor Form Factor F jk : Fractional amount of radiant energy from surface j that reaches surface k. Surface j Surface k NjNj dd dB j NkNk dA j dA k jj kk r

Properties of form factors For planar surface and convex surface

Basic Radiosity Model The object surfaces must form an enclosed space that has no energy exchange with outside world. Assume each surface is either a Lambertian reflector, a emitter, or a combination of both. Divide each surface into small surface polygons (surface patches) and calculate form factors. Solve radiosity equations. B i Radiosity of surface i E i Energy emission rate per unit area of surface i  i Reflectivity of surface i i = 1, 2, 3, …, n Radiosity equations k = 1, 2, 3, …, n

or Solve the above equations for B i

Ray-Tracing Methods Basic Ray-Tracing Algorithm Projection Reference Point Pixel Center Pixel Ray Projection Plane

1.Cast pixel ray from projection reference point through pixel center. 2.Each time a pixel ray intersects an object surface, it splits into two secondary rays: a reflection ray and a refraction ray. (No refraction ray for opaque object.) 3.Repeat step 2 for each pixel ray. Each intersected surface is added to a binary ray-tracing tree. 4.A pixel ray is terminated when the ray intersects no surfaces, intersects a light source that is not a reflecting surface, or the ray- tracing tree reaches maximum allowable depth. Ray Casting Procedure

S1S1 S2S2 S3S3 S4S4 R1R1 T1T1 R2R2 R3R3 T3T3 R4R4 Projection Reference Point S1S1 S2S2 S3S3 S4S4 T1T1 R1R1 R2R2 R3R3 T3T3 R4R4 Paths of pixel raysRay-tracing tree

Pixel Intensity Calculation The ray-tracing tree is processed in bottom-up order. (Trace each pixel ray backward.) For each pixel ray at the bottom of the tree, its intensity is assigned a background intensity value if it does not intersect a light source. Otherwise the intensity is assigned to the light source intensity. At each surface intersection, the intensities from reflection ray, refraction ray and intensity contributions from all the light sources are accumulated for the parent ray. Pixel ray intensity is attenuated by the distance it travels. The pixel intensity is obtained at the root of the tree.

N R L V H Light Source Incoming ray Reflected ray Shadow ray Refracted ray T u uUnit vector in pixel ray direction VUnit vector in direction to viewer RUnit vector in reflected ray direction TUnit vector in refracted ray direction NSurface normal LUnit vector in shadow ray direction (direction to light source) HHalfway vector IRIR ITIT I

k t : Transparency coefficient

Advantage of Ray-Tracing Algorithm Ray-tracing can produce highly realistic scenes. It automatically detects visible surfaces, renders shadows, transparency effects and generates perspective projection views. Disadvantage of Ray-Tracing Algorithm Ray-tracing calculation is highly complex and takes considerable more time to complete than basic illumination and shading models. It is not yet implemented in hardware and is not suitable for real time rendering (simulations, games, etc.) at this time. Most calculation time of ray-tracing algorithm is spent on ray-surface intersection calculations

Methods to Speed up Ray-Tracing Calculations Bounding Volume Enclose a group of objects within a bounding volume (sphere or box). If a pixel ray does not intersect the surface of the bounding volume, then it does not intersect the objects inside the bounding volume. Bounding SphereBounding Box Bounding Volume Tree Enclose several smaller bounding volumes with a larger bounding volume to form a hierarchical tree structure. The intersection test is done by processing the tree in top-down order.

Space Subdivision Methods Obtain bounding box for the entire scene Divide the bounding box into a number of sub regions (cells). Sub regions are usually rectangular solids. Each cell is associated with a list of objects it contains. For each pixel ray, trace the cells it intersects and only perform intersection tests for objects within these cells. Pixel ray

Distributed Ray-Tracing Use stochastic sampling method that randomly distributes rays according to various parameters. Jittering Divide a pixel area into regular grid of subpixels. Generate jittered positions by randomly perturbing the center of each subpixel by a small amount. Anti-aliasing Effect Fire subpixel rays through the jittered subpixel positions and average the intensity of these rays to obtain pixel intensity.

Out-of-focus Effect Place a lens in front of projection plane. Distribute subpixel rays through aperture area of the lens. Projection Reference Point Projection Plane Object Plane Lens

Gloss Effect Gloss: Specular highlight that is blurred. Distribute reflection rays around the specular reflection direction. N R Incoming rayReflected rays u

Translucency Effect Translucency: Light passing through the material is scattered so that objects behind the material appear blurred. Distribute refraction rays around the ideal refraction direction. N T Incoming ray Refracted rays u

Soft Shadows under Extended Light Source Extended Light Source Object UmbraPenumbra Umbra: Completely dark region Penumbra: Partially illuminated region

Motion Blur Effect Distribute rays over time. Motion Blur: Moving objects appear blurred on film. Distribute shadow rays over the area of the light source. N L Shadow rays Extended Light Source