Objectives. Shading II. Distance Terms. The Phong Reflection Model

Similar documents
Shading II. CITS3003 Graphics & Animation

Shading II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors

Shading. Why we need shading. Scattering. Shading. Objectives

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

Comp 410/510 Computer Graphics. Spring Shading

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Introduction to Computer Graphics 7. Shading

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Illumination & Shading

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

CS 4600 Fall Utah School of Computing

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

CS452/552; EE465/505. Lighting & Shading

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Why we need shading?

Illumination in Computer Graphics

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Shading I Computer Graphics I, Fall 2008

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

CS452/552; EE465/505. Intro to Lighting

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

Introduction to Computer Graphics with WebGL

CS Illumination and Shading. Slide 1

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Reflection and Shading

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Today we will start to look at illumination models in computer graphics

Illumination & Shading I

Graphics for VEs. Ruth Aylett

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CHAPTER5. We have learned to build three-dimensional graphical models and to LIGHTING AND SHADING

Graphics for VEs. Ruth Aylett

Supplement to Lecture 16

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Specular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017

Graphics and Visualization

Shading 1: basics Christian Miller CS Fall 2011

Assignment #2. (Due date: 11/6/2012)

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Simple Lighting/Illumination Models

Illumination and Shading

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

CHAPTER 1 Graphics Systems and Models 3

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Photorealism: Ray Tracing

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

w Foley, Section16.1 Reading

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Shading. Brian Curless CSE 557 Autumn 2017

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

Lighting. Figure 10.1

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Math (Spring 2009): Lecture 5 Planes. Parametric equations of curves and lines

Curves and Surfaces Computer Graphics I Lecture 10

CS 418: Interactive Computer Graphics. Basic Shading in WebGL. Eric Shaffer

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Curves and Surfaces Computer Graphics I Lecture 9

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

CS Computer Graphics: Ray Tracing Detail, Part 3

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Raytracing. COSC 4328/5327 Scott A. King

Shading. Brian Curless CSE 457 Spring 2017

Lecture 9: Transformations. CITS3003 Graphics & Animation

Virtual Reality for Human Computer Interaction

Illumination & Shading: Part 1

Computer Graphics I Lecture 11

CS Computer Graphics: Ray Tracing Detail, Part 3

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

CS770/870 Spring 2017 Color and Shading

M jrs M jgs M jbs Intensity of light reflected from surface j when illuminated by source i: I ijr

8.1 Geometric Queries for Ray Tracing

Deferred Rendering Due: Wednesday November 15 at 10pm

Lighting and Shading

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

CSE 681 Illumination and Phong Shading

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

University of Victoria CSC 305 Shading. Brian Wyvill 2016

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

A simple OpenGL animation Due: Wednesday, January 27 at 4pm

INF3320 Computer Graphics and Discrete Geometry

Complex Shading Algorithms

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

LIGHTING AND SHADING

6. Illumination, Lighting

Transcription:

Shading II Objectives Introduce distance terms to the shading model. More details about the Phong model (lightmaterial interaction). Introduce the Blinn lighting model (also known as the modified Phong model). Consider computation of the normal vectors of some simple surfaces. CITS3003 Graphics & Animation 2 Distance Terms 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 for both point sources and spotlights The constant (a) and linear (bd) terms soften the effect of the point source Note: the distance term should not be applied to the ambient term. 3 The Phong Reflection Model Recall that the Phong Model: Is a simple model that can be computed rapidly Has three terms - Diffuse term - Specular term - Ambient term Uses the four vectors below to calculate a colour for an arbitrary point p on a surface: - Vector l (to light source) - Vector v (to viewer or camera) - Vector n (Normal vector at p) - Vector r (Perfect reflector of l with respect to n) 4 1

Shading the Light Source Part In the Phong Model, we add the shading results from all the light sources together. Each light source has separate diffuse, specular, and ambient terms to allow for maximum flexibility even though this form does not have a physical justification. Each term has its own red, green and blue components. Hence, there are 9 coefficients for each point source: I dr, I dg, I db, I sr, I sg, I sb, I ar, I ag, I ab Shading Material Properties Surfaces of objects have their material properties to compute with the light source properties, i.e., - There are nine absorption coefficients k dr, k dg, k db, k sr, k sg, k sb, k ar, k ag, k ab - and a shininess coefficient a 5 6 Shading 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 I d l n + k s I s v r α + k a I a For each colour component we add contributions from all light sources There are 3 such equations: one for red, one for green, and one for blue. 7 The Phong Shading Model Computing the perfect reflector r To compute the shading value I on the previous slide, we need to know those vectors in the model. The normal vector n is determined by the local orientation at point p. Vector l and v are specified by the application. We can compute r from l and n - We want: Angle of incidence θ i = angle of reflection θ r. - The three vectors l, n, and r must be coplanar. - It is easy to verify that r = 2 (l n ) n l Letter l, not 1. 8 2

The Modified Phong Model or Blinn Lighting Model The specular term in the Phong model is problematic because it requires the calculation of a new reflection vector r for each vertex and then the dot product with v. Blinn suggested an approximation using the halfway vector that is more efficient This is referred to as the modified Phong reflection model or the Blinn-Phong shading model (the terminology varies in many textbooks, the term lighting is also used instead of reflection and shading ). 9 The Blinn-Phong Model the Halfway Vector Instead of computing r, the h vector which is a normalized vector halfway between l and v is used: h = ( l + v )/ l + v 10 The Blinn-Phong Model using the halfway vector Having got the halfway vector h, we replace v r α by (n h ) β where β is chosen to match the shininess of the material Note that halfway angle is half of angle between r and v if vectors are coplanar The resulting model is known as the modified Phong or Blinn lighting model. The model can be written as (without the distance term): I = k d I d (l n) + k s I s n h β + k a I a The Blinn lighting model is the default shading model in OpenGL 11 Colour plate 17 from the book: Array of Utah teapots with different material properties. Examples 12 3

Computation of Normal Vector n Whether we use the Phong model or the Blinn model, we need to also determine the normal vector n at each point p. But how do we determine n in general? For simple surfaces like spheres there are formulas, but how we determine n differs depending on underlying representation of surface. OpenGL leaves the determination of normals to the application. 13 for a Plane Equation of plane: ax + by + cz + d = 0 From Chapter 3 we know that a plane is determined by n o three points p 0, p 1, p 2 or by p 2 o a normal n and p 0 The normal vector can be p obtained by: n = (p 2 p 0 ) (p 1 p 0 ) We then normalize n to a unit vector. p 0 14 p 1 for a Sphere If we have an implicit representation of a sphere (with unit radius and centre at the origin): f x, y. z = 0 x 2 + y 2 + z 2 1 = 0 The normal vector n at a point p is given by gradient of f at p, i.e., n = f, f, f T = p x y z for a Sphere If we have a parametric representation of a sphere: x = x(u, v) = cos u sin v y = y(u, v) = cos u cos v z = z(u, v) = sin u The tangent plane is determined by the vectors p/ u = [ x/ u, y/ u, z/ u] T p/ v = [ x/ v, y/ v, z/ v] T The normal vector is given by the cross product n = p/ u p/ v 15 16 4

the General Case We can also compute the normal vectors of for other simple surfaces: - Quadrics - Parametric polynomial surfaces E.g., Bezier surface patches (Chapter 10) References Interactive Computer Graphics A Top-Down Approach with Shader-Based OpenGL by Edward Angel and Dave Shreiner, 6 th Ed, 2012 Sec. 5.3. The Phong Reflection Model Sec. 5.4. Computation of Vectors In general, the 3D surface data generated by most 3D scanners contain both vertex coordinates and vertex normals. 17 18 5