Shading II CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
Computer Graphics Shading Lecture 13 John Shearer
Computer Graphics I, Fall 2010 Shading II.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
CS 480/680 Computer Graphics Shading 2 Dr. Frederick C Harris, Jr.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
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.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Computer Graphics - Class 10
Shading in OpenGL CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Lighting and Shading Wen-Chieh (Steve) Lin
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2006 Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
LIGHTING Part One - Theory based on Chapter 6. Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Illumination.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Shading I Shandong University Software College Instructor: Zhou Yuanfeng
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Chapter 6: Shading Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Illumination & Reflectance Dr. Amy Zhang. Outline 2  Illumination and Reflectance  The Phong Reflectance Model  Shading in OpenGL.
1 Chapter 6 Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Lighting and Shading.
Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.
Game Object Appearance. The Three Faces of Designing GO Appearance The Artistic Face: ◦ aesthetic – beautiful and ugly ◦ done by artists The Communication.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Illumination.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Introduction to Computer Graphics with WebGL
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
Shading. For Further Reading Angel 7 th Ed: ­Chapter 6 2.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
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
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 55 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V.
Shading To determine the correct shades of color on the surface of graphical objects.
Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive Computer.
Rendering Curves and Surfaces
Vectors, Normals, & Shading
CSE 470 Introduction to Computer Graphics Arizona State University
CS5500 Computer Graphics April 10, 2006.
Isaac Gang University of Mary Hardin-Baylor
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Shading II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Shading II CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel

Objectives Continue discussion of shading. Introduce modified Phong model. Consider computation of required vectors. CS4395: Computer Graphics 2

Recap: Ambient Light Ambient light is the result of interactions between (large) light sources and the environmental objects. Amount and color depend on the color of the light(s) and the material properties of the object. Add k a I a to diffuse and specular terms. CS4395: Computer Graphics 3 reflection coeff intensity of ambient light

Effect of Distance The light from a point source that reaches a surface is inversely proportional to the square of the distance between them. We can add a factor of the form: 1/(a + bd +cd 2 ) to the diffuse and specular terms. The constant and linear terms soften the effect of the point source. CS4395: Computer Graphics 4

Recap: Light Sources Phong Model: add the results from each light source. Each light source has separate diffuse, specular, and ambient terms: provides flexibility even though it does not have a physical justification. Separate red, green and blue components. Hence, 9 coefficients for each point source: – I dr, I dg, I db, I sr, I sg, I sb, I ar, I ag, I ab CS4395: Computer Graphics 5

Recap: Material Properties Material properties match light source properties: – Nine absorbtion coefficients: k dr, k dg, k db, k sr, k sg, k sb, k ar, k ag, k ab – Shininess coefficient . CS4395: Computer Graphics 6

Adding up the Components For each light source and each color component, the Phong model can be written (without the distance terms) as: I = k d L d l · n + k s L s (v · r )  + k a L a For each color component we add contributions from all sources. CS4395: Computer Graphics 7

Modified Phong Model The specular term in the Phong model is problematic because it requires the calculation of a new reflection vector and view vector for each vertex. Blinn suggested an approximation using the halfway vector that is more efficient. CS4395: Computer Graphics 8

The Halfway Vector h is normalized vector halfway between l and v: CS4395: Computer Graphics 9 h = ( l + v )/ | l + v |

Using the halfway vector Replace (v · r )  by (n · h )   is chosen to match shininess. Halfway angle is half of angle between r and v if vectors are coplanar. Resulting model is known as the modified Phong or Blinn lighting model: specified in OpenGL standard. CS4395: Computer Graphics 10

Example Only differences in these teapots are the parameters in the modified Phong model. CS4395: Computer Graphics 11

Computation of Vectors l and v are specified by the application. Can compute r from l and n. Problem is determining n. Computation of n differs depending on underlying representation of surface. OpenGL leaves determination of normal to application: – Exception for GLU quadrics and Bezier surfaces (Chapter 11). CS4395: Computer Graphics 12

Plane Normals Equation of plane: ax+by+cz+d = 0 From Chapter 4 we know that plane is determined by three points p 0, p 2, p 3 or normal n and p 0 Normal can be obtained by: CS4395: Computer Graphics 13 n = (p 2 -p 0 ) × (p 1 -p 0 )

Normal to Sphere Implicit function f(x,y.z)=0 Normal given by gradient. Sphere f(p)=p·p-1 n = [ ∂ f/ ∂ x, ∂ f /∂ y, ∂ f/ ∂ z] T =p CS4395: Computer Graphics 14

Parametric Form For sphere: Tangent plane determined by vectors: Normal given by cross product: CS4395: Computer Graphics 15 x=x(u,v)=cos u sin v y=y(u,v)=cos u cos v z= z(u,v)=sin u ∂p/∂u = [∂x/∂u, ∂y/∂u, ∂z/∂u]T ∂p/∂v = [∂x/∂v, ∂y/∂v, ∂z/∂v]T n = ∂p/∂u × ∂p/∂v

General Case We can compute parametric normals for other simple cases: – Quadrics. – Parametric polynomial surfaces: Bezier surface patches (Chapter 11). CS4395: Computer Graphics 16