David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke

Slides:



Advertisements
Similar presentations
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Advertisements

1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
Illumination and Shading
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Osvetljevanje in senčenje (lighting - shading)
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading III Week.
Computer Graphics - Class 10
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Lighting and Shading Wen-Chieh (Steve) Lin
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Illumination and Shading
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Illumination.
CS 445 / 645: Introductory Computer Graphics
Computer Graphics Lighting.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
COMP 261 Lecture 14 3D Graphics 2 of 2. Doing better than 3x3? Translation, scaling, rotation are different. Awkward to combine them. Use homogeneous.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Visibility Calculations and Occlusion Culling.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
CS 445 / 645 Introduction to Computer Graphics Lecture 14 Lighting Lighting.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 15 Shading Shading.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Illumination and Shading Sang Il Park Sejong University.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
Chapter 14 Shading Models.
CSC461: Lecture 23 Shading Computation
Computer Graphics Material Colours and Lighting
Computer Graphics (Fall 2003)
Chapter 14 Shading Models.
Lighting Calculations
Presentation transcript:

David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke

David Luebke3/16/2016 Administrivia Assignment 6: line.c, gfx.c, lookat() description

David Luebke3/16/2016 Recap: Lambert’s Cosine Law l Ideal diffuse surfaces reflect according to Lambert’s cosine law: The energy reflected by a small portion of a surface from a light source in a given direction is proportional to the cosine of the angle between that direction and the surface normal l These are often called Lambertian surfaces l Note that the reflected intensity is: –Independent of the viewing direction –Dependent on the surface orientation with regard to the light source

David Luebke3/16/2016 Recap: Lambert’s Law

David Luebke3/16/2016 Recap: Computing Diffuse Reflection l The angle between the surface normal and the incoming light is the angle of incidence: I diffuse = k d I light cos  l In practice we use vector arithmetic: I diffuse = k d I light (n l) nl 

David Luebke3/16/2016 Recap: Specular Reflection l Shiny surfaces exhibit specular reflection –Polished metal –Glossy car finish l A light shining on a specular surface causes a bright spot known as a specular highlight l Where these highlights appear is a function of the viewer’s position, so specular reflectance is view-dependent

David Luebke3/16/2016 Recap: The Optics of Reflection l Reflection follows Snell’s Laws: –The incoming ray and reflected ray lie in a plane with the surface normal –The angle that the reflected ray forms with the surface normal equals the angle formed by the incoming ray and the surface normal:  l =  r

David Luebke3/16/2016 Recap: Non-Ideal Specular Reflectance l An illustration of this angular falloff: l How might we model this falloff?

David Luebke3/16/2016 Recap: Phong Lighting l The most common lighting model in computer graphics was suggested by Phong: The n shiny term is a purely empirical constant that varies the rate of falloff l Though this model has no physical basis, it works (sort of) in practice

David Luebke3/16/2016 Calculating Phong Lighting The cos term of Phong lighting can be computed using vector arithmetic: –V is the unit vector towards the viewer Common simplification: V is constant (implying what?) –R is the ideal reflectance direction An aside: we can efficiently calculate R

David Luebke3/16/2016 Calculating The R Vector l This is illustrated below:

David Luebke3/16/2016 Blinn & Torrance Variation l Blinn introduced a variation of the Phong model: Here H is a vector bisecting the incoming light direction and viewing direction:

David Luebke3/16/2016 Blinn & Torrance Variation What does H represent? (Hint: think of H as the normal of a plane) A: the orientation of a plane which will maximally reflect light from L towards V l Why bother with this variation?

David Luebke3/16/2016 Phong Examples These spheres illustrate the Phong model as L and n shiny are varied:

David Luebke3/16/2016 The Phong Lighting Model l Our final empirically-motivated model for the illumination at a surface includes ambient, difuse, and specular components: l Commonly called Phong lighting –Note: once per light –Note: once per color component –Do k a, k d, and k s vary with color component?

David Luebke3/16/2016 Phong Lighting: Intensity Plots

David Luebke3/16/2016 Applying Illumination l We now have an illumination model for a point on a surface l Assuming that our surface is defined as a mesh of polygonal facets, which points should we use? l Keep in mind: –It’s a fairly expensive calculation –Several possible answers, each with different implications for the visual quality of the result

David Luebke3/16/2016 Applying Illumination l With polygonal/triangular models: –Each facet has a constant surface normal –If the light is directional, the diffuse reflectance is constant across the facet –If the eyepoint is infinitely far away (constant V ), the specular reflectance of a directional light is constant across the facet

David Luebke3/16/2016 Flat Shading l The simplest approach, flat shading, calculates illumination at a single point for each polygon: l If an object really is faceted, is this accurate? l No: –For point sources, the direction to light varies across the facet –For specular reflectance, direction to eye varies across the facet

David Luebke3/16/2016 Flat Shading l We can refine it a bit by evaluating the Phong lighting model at each pixel of each polygon, but the result is still clearly faceted: l To get smoother-looking surfaces we introduce vertex normals at each vertex –Usually different from facet normal –Used only for shading (as opposed to what?) –Think of as a better approximation of the real surface that the polygons approximate (draw it)

David Luebke3/16/2016 Vertex Normals l Vertex normals may be –Provided with the model –Computed from first principles –Approximated by averaging the normals of the facets that share the vertex

David Luebke3/16/2016 Gouraud Shading l This is the most common approach –Perform Phong lighting at the vertices –Linearly interpolate the resulting colors over faces –This is what OpenGL does l Demo at l Does this eliminate the facets?

David Luebke3/16/2016 Phong Shading l Phong shading is not the same as Phong lighting, though they are sometimes mixed up –Phong lighting: the empirical model we’ve been discussing to calculate illumination at a point on a surface –Phong shading: linearly interpolating the surface normal across the facet, applying the Phong lighting model at every pixel n Same input as Gouraud shading n Usually very smooth-looking results: n But, considerably more expensive

David Luebke3/16/2016 An Aside: Transforming Normals l Irritatingly, the matrix for transforming a normal vector is not the same as the matrix for the corresponding transformation on points –In other words, don’t just treat normals as points:

David Luebke3/16/2016 Transforming Normals l Some not-too-complicated affine analysis shows : –If A is a matrix for transforming points, then (A T ) -1 is the matrix for transforming normals l When is this the same matrix? l What is homogeneous representation of a vector (as opposed to a point?) l Can use this to simplify the problem: only upper 3x3 matrix matters, so use only it l More detail in F&vD Appendix A.5