09/18/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.

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 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.
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.
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.
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.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
Computer Graphics Shadows
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.
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.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
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.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Chapter 6 Special Effects 강 신 진강 신 진
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.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
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.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Multi-pass Rendering. © 2002 James K. Hahn, N.H. Baek2 Multi-pass Rendering Repeat: image  Rendering pass  result imageRepeat: image  Rendering pass.
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 #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)
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Computer graphics & visualization Shadows / Transparency.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
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,
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.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
CS 445 / 645: Introductory Computer Graphics Review.
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.
Basic Ray Tracing CMSC 435/634.
Rendering Pipeline Fall, 2015.
Week 2 - Friday CS361.
Game Programming (Mapping)
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
3D Graphics Rendering PPT By Ricardo Veguilla.
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
UMBC Graphics for Games
Last Time Presentation of your game and idea Environment mapping
Frame Buffer Applications
Presentation transcript:

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Today Reflections Shadows part 1

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Planar Reflections (Flat Mirrors) Use the stencil buffer, color buffer and depth buffer Basic idea: –We need to draw all the stuff around the mirror –We need to draw the stuff in the mirror, reflected, without drawing over the things around the mirror Key point: You can reflect the viewpoint about the mirror to see what is seen in the mirror, or you can reflect the world about the mirror

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Reflecting Objects If the mirror passes through the origin, and is aligned with a coordinate axis, then just negate appropriate coordinate Otherwise, transform into mirror space, reflect, transform back MirrorWall

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Small Problem Reflecting changes the apparent vertex order as seen by the viewer –Why is this a problem? Reflecting the view has the same effect, but this time it also shifts the left-right sense in the frame buffer –Works, just harder to understand what’s happening

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Rendering Reflected First First pass: –Render the reflected scene without mirror, depth test on Second pass: –Disable the color buffer, Enable the stencil buffer to always pass but set the buffer, Render the mirror polygon –Now, set the stencil test to only pass points outside the mirror –Clear the color buffer - does not clear points inside mirror area Third Pass: –Enable the color buffer again, Disable the stencil buffer –Render the original scene, without the mirror –Depth buffer stops from writing over things in mirror

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Reflection Example The stencil buffer after the second pass The color buffer after the second pass – the reflected scene cleared outside the stencil

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Reflection Example The color buffer after the final pass

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Making it Faster Under what circumstances can you skip the second pass (the stencil buffer pass)? These are examples of designing for efficient rendering

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Making it Faster Under what circumstances can you skip the second pass (the stencil buffer pass)? –Infinite mirror plane (effectively infinite) –Solid object covering mirror plane These are examples of designing for efficient rendering

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Reflected Scene First (issues) Objects behind the mirror cause problems: –Will appear in reflected view in front of mirror –Solution is to use clipping plane to cut away things on wrong side of mirror Curved mirrors by reflecting vertices differently Doesn’t do: –Reflections of mirrors in mirrors (recursive reflections) –Multiple mirrors in one scene (that aren’t seen in each other)

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Rendering Normal 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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,G d,B d,A d ), 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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 –Lots of copying data too and fro

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Why Shadows? Shadows tell us about the relative locations and motions of objects

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Shadows and Motion

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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)

09/18/03CS679 - Fall Copyright Univ. of Wisconsin 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:

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Drawing the Shadow We now have a matrix that transforms an object into its shadow Drawing the shadow: –Draw the ground and the object –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)

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Point Light Shadows Blinn ’88 gives a matrix that works for local point light sources –Takes advantage of perspective transformation (and homogeneous coordinates) Game Programming Gems has an approximation that does not use perspective matrices, Chapter 5.7

09/18/03CS679 - Fall Copyright Univ. of Wisconsin Todo By Monday, Sept 22: Lock in Stage 1