11/24/2016 16:45 Graphics II 91.547 Shadow Maps Reflections Session 5.

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.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Course Note Credit: Some of slides are extracted from the course notes of prof. Mathieu Desburn (USC) and prof. Han-Wei Shen (Ohio State University). CSC.
Projective Texture Mapping
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Part I: Basics of Computer Graphics
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
Chapter 6. More on Color and Material Presented by Garrett Yeh.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
Introduction to OpenGL. What is OpenGL OpenGL is a low-level software interface to graphics hardware No commands for performing windowing tasks or obtaining.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
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.
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
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Geometric Objects and Transformations Chapter 4. Points, Scalars and Vectors  Points - position in space  Scalars - real numbers, complex numbers obey.
1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.
COMP 175: Computer Graphics March 24, 2015
COMP SCI 352 Computer Graphics and Animation. Computer Graphics2 My name is … My name is … How to find me How to find me Course Policies Course Policies.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Chapter 6 Special Effects 강 신 진강 신 진
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 10/24/ :01 UML Graphics II Shadows Session 4.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Computer graphics & visualization Shadows / Transparency.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
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.
RENDERING : Global Illumination
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Photorealistic Rendering vs. Interactive 3D Graphics
3D Graphics Rendering PPT By Ricardo Veguilla.
Jim X. Chen George Mason University
Michael Tanaya , Hua ming Chen
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Texture and Shadow Mapping
Frame Buffer Applications
Presentation transcript:

11/24/ :45 Graphics II Shadow Maps Reflections Session 5

21/24/ :45 Shadow Maps Eye Point Light Source Objects

31/24/ :45 Shadow Maps: The algorithm 1. Transform the scene objects to the light source coordinates (x’,y’,z’). 2. Disable color buffer writing and render the scene objects into the z - buffer 3. Copy this buffer into a “shadow z - buffer” 4. Transform the scene back to the eye coordinates (x,y,z). 5. Render the scene. At each pixel, if a point on a surface is deemed to be visible, it is transformed into light source coordinates: (x,y,z) -> (x’,y’,z’). The x’ and y’ coordinates are used to index into the shadow z-buffer and z’ is compared with the z value in the buffer. If z’ is greater than this value, the point is in shadow and it is rendered as if the light is turned off. 6. Repeat for other light sources, and accumulate color

41/24/ :45 Shadow Maps Tradeoffs 0 Excellent for situations when shadowing and shadowed objects are both complex 0 Some graphics systems do not provide necessary primitives or buffers 0 Aliasing is a problem -Possible solutions =Use high - resolution shadow z buffer =Jitter shadow texture to smooth out edges 0 Difficult to find appropriate projection when light source is in the middle of scene objects

51/24/ :45 Finite light sources produce “soft shadows” Finite size light source Shadowing object

61/24/ :45 Simulating finite size light source by Multiple point sources: “dithering” Light source moves in grid Shadowing Object (polygon) Plane of projection Shadows are “accumulated”

71/24/ :45 The Accumulation Buffer Color Planes Accumulation Buffer Color data

81/24/ :45 Accumulation buffer use: void glAccum(glenum op,glFloat value); op: GL_ACCUM reads each pixel from buffer currently selected for reading and multiplies RGBA values by value and adds the result to accumulation buffer. GL_LOAD reads each pixel from the buffer currently selected for reading, multiplies RGBA values by value and replaces values in accumulation buffer. GL_RETURN takes values from the accumulation buffer, mutiplies them by value, and places them in the color buffer. GL_ADD, GL_MULT adds or multiplies the value of each pixel in the accumulation buffer by value and returns it to the accumulation buffer.

91/24/ :45 Accumulation Buffer op = GL_ACCUM Value X  Color Planes Accumulation Buffer

101/24/ :45 Accumulation Buffer op = GL_LOAD Value X Color Planes Accumulation Buffer

111/24/ :45 Accumulation Buffer op = GL_RETURN Value X Color Planes Accumulation Buffer

121/24/ :45 Accumulation Buffer op = GL_MULT Value X Accumulation Buffer

131/24/ :45 Projection Shadows Code example. 120 goto 240

141/24/ :45 Reflections Direct ray Reflected ray Eye point Plane of Reflection

151/24/ :45 Reflection Transformations: across major planes of symmetry Y- Z PlaneX - Z PlaneX - Y Plane

161/24/ :45 Reflection transformations: the general case X - Z plane Arbitrary plane

171/24/ :45 Reflection Transformations: the general case - constructing the transformation Inverse transformationReflection across X - Z Plane Transformation to move reflecting plane to X - Z plane

181/24/ :45 Reflections: Visibility Issues Finite Size Reflecting Object Eyepoint Real Cone Real Ball Reflected Cone Reflected Ball Not Visible

191/24/ :45 Reflections: Visibility Issues Finite Size Reflecting Object Eyepoint Real Cone Should be obstructed by reflecting object “Reflected Cone” Should not be visible

201/24/ :45 Solution to visibility issues: use stencil and z buffer The algorithm: 1. Disable the depth test 2. Set stencil operation to replace with 1 3. Draw the reflecting polygon 4. Set the stencil operation to only draw where stencil=1 5. Multiply reflecting transformation onto modelview matrix 6. Enable depth test, render objects. Clip objects that are on opposite side of the reflecting plane from eyepoint. 7. Disable stencil test 8. Remove reflection transformation from modelview 9. Disable writing to color buffer 10. Draw the reflecting polygon 11. Enable writing to color buffer 12. Render the scene (unreflected)

211/24/ :45 Projection Shadows Code example. 120 goto 240

221/24/ :45 Rendered with Ray Tracing

231/24/ :45 Arbitrarily shaped reflective object. Eye point

241/24/ :45 Sphere Map

251/24/ :45

261/24/ :45 Calculation of Texture Coordinates For each vertex, the reflected vector direction is given by: Let m be defined as: The texture coordinates are given by:

271/24/ :45 Sphere Mapping: The OpenGL Algorithm 1. Bind the texture containing the sphere map. 2. Set sphere mapping texture coordinate generation: glTexGen(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGen(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); 3. Enable texture coordinate generation: glEnable(TEXTURE_GEN_S) 4. Draw the object, providing correct normals on a per- face or per-vertex basis.

281/24/ :45 Obtaining the Sphere Map Manually Camera Reflective Sphere at object location

291/24/ :45 Generating a Sphere Map: Image Cube Algorithm

301/24/ :45 Four of the six cube environment projections

311/24/ :45 Sphere map generated by Image cube faces