9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Exploration of advanced lighting and shading techniques
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.
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.
Week 9 - Friday.  What did we talk about last time?  Area lighting  Environment mapping  Blinn and Newell's method  Sphere mapping  Cubic environmental.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
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.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
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.
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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
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.
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.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Game Programming (Mapping) Spring.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
CS 638, Fall 2001 Today Project Stage 0.5 Environment mapping Light Mapping.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
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.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
CS-378: Game Technology Lecture #8: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
CS-378: Game Technology Lecture #7: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
3/23/04© University of Wisconsin, CS559 Spring 2004 Last Time Antialiasing –Area-weighted sampling Visibility –Painters algorithm –Depth buffer (Z-buffer)
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
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.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Rendering Pipeline Fall, 2015.
CS-378: Game Technology Lecture #7: More Mapping Prof. Okan Arikan
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
Game Programming (Mapping)
3D Graphics Rendering PPT By Ricardo Veguilla.
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
Real-Time Rendering Intro to Shadows
UMBC Graphics for Games
Last Time Presentation of your game and idea Environment mapping
Frame Buffer Applications
Presentation transcript:

9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows

9/20/2001CS 638, Fall 2001 Reflection Review Recall from last lecture: –Rendering reflections requires rendering what is seen in the mirror, and what is seen around the mirror –The stencil buffer is used to avoid writing over the reflection when rendering the regular view, or vice versa Last time we saw how to render the reflected view first: –Render the reflected view –Render the mirror, setting the stencil –Clear the color buffer to clear around the mirror –Render the stuff around the mirror, ignoring the stencil

9/20/2001CS 638, Fall 2001 Rendering Normal View First First pass: –Render the scene without the mirror Second pass: –Clear the stencil, Render the mirror, setting the stencil if the depth test passes Third pass: –Clear the depth buffer with the stencil active, passing things inside the mirror only –Reflect the world and draw using the stencil test. Only things seen in the mirror will be drawn

9/20/2001CS 638, Fall 2001 Normal First Addendum Same problem with objects behind mirror –Same solution Can manage multiple mirrors –Render normal view, then do other passes for each mirror –Only works for non-overlapping mirrors (in view) –But, could be extended with more tests and passes A recursive formulation exists for mirrors that see other mirrors

9/20/2001CS 638, Fall 2001 Frame Buffer Blending When a fragment gets to the frame buffer, it is blended with the existing pixel, and the result goes in the buffer Blending is of the form: –s=source fragment, d = destination buffer, RGBA color –In words: You get to specify how much of the fragment to take, and how much of the destination, and you add the pieces together All done per-channel

9/20/2001CS 638, Fall 2001 Blending Factors The default is: S rgba =(1,1,1,1), D rgba =(0,0,0,0) –Overwrite buffer contents with incoming fragment You can use the colors themselves as blending functions: eg S rgba =(R d,R g,R b,R a ), D rgba =(0,0,0,0) –What use is this? –Hint: What if there is an image in the buffer and the source is a constant gray image? A light map? Common is to use the source alpha: –S rgba =(A s,A s,A s,A s ), D rgba =(1-A s,1-A s,1-A s,1-A s ) –What does this achieve? When might you use it? Note that blending can simulate multi-texturing with multi-pass

9/20/2001CS 638, Fall 2001 Accumulation Buffer The accumulation buffer is not available for writing directly It is more like a place to hold and compute on pixel data Operations: –Load the contents of a color buffer into the accumulation buffer –Accumulate the contents of a color buffer, which means multiply them by a value then add them into the buffer –Return the buffer contents to a color buffer (scaled by a constant) –Add or multiply all pixel values by a given constant It would appear that it is too slow for games –That is, I don’t know of games that use it

9/20/2001CS 638, Fall 2001 Accum. Buffer Algorithms Anti-aliasing: Render multiple frames with the image plane jittered slightly, and add them together –Hardware now does this for you, but this would be higher quality Motion blur: Render multiple frames representing samples in time, and add them together –More like strobing the object Depth of field: Render multiple frames moving both the viewpoint and the image plane in concert –Keep a point – the focal point – fixed in the image plane while things in front and behind appear to shift

9/20/2001CS 638, Fall 2001 Why Shadows? Shadows tell us about the relative locations and motions of objects

9/20/2001CS 638, Fall 2001 Shadows and Motion Example movies came from:

9/20/2001CS 638, Fall 2001 Facts about Shadows Shadows can be considered as areas hidden from the light source –Suggests the use of hidden surface algorithms A shadow on A due to B can be found by projecting B onto A with the light as the center of projection –Suggests the use of projection transformations For scenes with static lights and geometry, the shadows are fixed –Can pre-process such cases –Cost is in moving lights or objects Point lights have hard edges, and area lights have soft edges

9/20/2001CS 638, Fall 2001 Ground Plane Shadows Shadows cast by point light sources onto planes are an important case that is relatively easy to compute –Shadows cast by objects (cars, players) onto the ground Accurate if shadows don’t overlap –Can be fixed, but not well (x p,y p,z p ) (x sw,y sw,z sw ) L(directional light)

9/20/2001CS 638, Fall 2001 Ground Shadow Math The shadow point lies on the line from the light through the vertex: The shadow is on the ground, z sw =0, so  =z p /z l, giving: Matrix form:

9/20/2001CS 638, Fall 2001 Drawing the Shadow We now have a matrix that transforms an object into its shadow Drawing the shadow: –Draw the polygon –Multiply the shadow matrix into the model transformation –Redraw the object in gray with blending on Tricks: –Lift the shadow a little off the plane to avoid z-buffer quantization errors (can be done with extra term in matrix) –Works for other planes by transforming into plane space, then shadow, then back again –Take care with vertex ordering for the shadow (it reverses)

9/20/2001CS 638, Fall 2001 Point Light Shadows Blinn ’88 gives a matrix that works for local point light sources –Takes advantage of perspective transformation (and homogeneous coordinates) Book has an approximation that does not use perspective matrices, Chapter 5.7

9/20/2001CS 638, Fall 2001 Shadows in Light Maps Static shadows can be incorporated into light maps –When creating the map, test for shadows by ray-casting to the light source - quite efficient Area light sources should cast soft shadows –Interpolating the texture will give soft shadows, but not good ones, and you loose hard shadows –Sampling the light will give better results: Cast multiply rays to different points on the area light, and average the results –Should still filter for best results

9/20/2001CS 638, Fall 2001 Soft Shadow Example From Watt and Policarpo

9/20/2001CS 638, Fall 2001 Shadow Shape Perception Perceptual studies (or anecdotal evidence) suggests that the shape of a shadow is not important –In other words, people correctly associate shadows with the objects that cast them even if the shapes don’t correspond Movie with incorrect shadows from

9/20/2001CS 638, Fall 2001 Quick Dirty Shadows Blend a dark polygon into the frame-buffer in the place where the shadow should be –Cast a ray from light source, through object center, and see where it hits something –Blend a fixed shape polygon in at that location (with depth) Why dirty? –Use a fixed shape - shadow won’t match object –Use a single ray-cast to determine shadow location - no partial shadow and wrong parts of shadow may be drawn Good for things like car games for under-car shadow –Fast action and near planar receiving surfaces

9/20/2001CS 638, Fall 2001 Drawing Quick Dirty Shadows Z equal with hit polygon Z-buffer quantization errors Z above hit polygon Apparent shadow too big ViewerLight

9/20/2001CS 638, Fall 2001 Drawing Quick Dirty Shadows No depth test –Check that shadow can be seen by viewer (cast ray) –Just blend polygon in Again, shadow is too large and may be in wrong place –Test corners of shadow for visibility? –OK if polygons are flatter

9/20/2001CS 638, Fall 2001 Projective Shadows Create a texture that is the shape of the shadowing object as seen by the light Project this texture onto the other objects –That is, find texture coordinates on the other objects that pull the right shadow/non-shadow pixel out of the texture Read Chapter 5.8 of “Game Programming Gems” –I expect you to know how it works, but not the formulas –Note, it doesn’t mention the texture matrix, which can avoid the need to explicitly compute texture coordinates for objects Problem: Texture appears in places it shouldn’t, and it’s hard to avoid it