# CEng 477 Introduction to Computer Graphics Fall

Size: px
Start display at page:

## Transcription

1 Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall

2 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated images, we need to apply natural lighting effects to the surfaces of objects. Illumination models are used to calculate the amount of light reflected from a certain position on a surface In other words, they provide ways to compute the color on a pixel of a surface. Using the illumination model for computing the color of every pixel is costly. Therefore surface rendering methods are used to interpolate illumination values computed for certain special pixels (like vertices of a triangle).

3 What determines the color of a position at a surface? Object s material properties Is it a shiny object? What make wood look different than a metalic object? Object s position with respect to the light sources The features of light sources And also with respect to other objects (for example shadows) Color of light, strength of light, etc. The orientation of the viewing plane

4 Illumination Models For computational efficiency computer graphics applications usually employ approximation models of the real physical illumination process. To get more realistic pictures, models that are closer to the actual physical lighting model should be developed. But they are costly and rendering a single frame may take a lot of time. Examples: ray tracing, radiosity

5 Light Sources A light source can be defined with the following parameters: Position Color of the emitted light The emission direction The shape of the light source

6 Point Light Sources Described by a position and a light color Light rays are emitted from the point light source in all directions The position information is used to identify the objects illuminated by the point source.

7 Infinitely Distant Light Sources They can be simulated by a single emission direction vector. This direction is used to calculate the amount of light received at a position.

8 Light Intensity Attenuation As the light emitted from a light source travels through space its intensity decreases. This is called attenuation. Example: a traffic light will not be able to illuminate an object 2km away. The decrease in the light source is inversely proportional to the squared distance from the object. It decreases by 2 1/ d l

9 2 1/ d l Problem with Too much intensity variation for objects that are close to the light source Too little intensity variation for object that are far away Solution: Use the following function instead f atten d l = 1 a 0 a 1 d l a 2 d 2l The constants can be adjusted to produce better attenuation effects. For a light source that is at infinity, we do not need to use attenuation. We can assume all the objects are equidistant from the light source and receive same amount of light.

10 Directional Light Sources and Spotlight Effects A directional light source can be defined by a light direction (Vlight) and an angular limit (θl) Objects outside the light cone will not be illuminated.

11 Determination of objects inside the light cone The cosine of the angle between the light direction vector and object direction is given by: cos α=v obj V light If cos α cos θ then the object is l within the light cone (assuming is between 0 andθ90 l degrees) We can also apply attenuation based on the angular distance α

12 Angular Attenuation Given the two unit vectors Vlight and Vobj, we can define angular attenuation as f l. angatten= 1. 0, 0. 0, { if source is not a spotlight if V obj V light =cos α cos θ l object is outside the spotlight cone al V obj V light, otherwise

13 Surface Lighting Effects The light reflected from the surface of an object depends on several factors Degree of reflectivity of the object (shiny vs. dull surfaces) Surface texture properties Color reflectance coefficients (e.g. color of the object)

14 Basic Illumination Model The basic illumination model we will learn in this course includes three components Ambient Light Diffuse Reflection Specular Reflection

15 Ambient Light Reflected light from the environment and the nearby objects cause other objects to illuminate Also called background light Constant color reflected from all points on the surface. Tells us how bright the surface will look like when no light source can directly reach the surface When used alone, does not produce very interesting pictures Ambient lighting only

16 Modeling Ambient Light We can use an ambient intensity parameter Ia that describes the level of ambient light in a scene. Every object in the scene will be illuminated by this amount independent of the surface orientation and viewer location. But different surfaces may reflect different amount of ambient light based on their absorbance/reflectance properties. We can model this by a constant factor for each surface: ka I a

17 Diffuse reflection The light that is reflected in all directions is called diffuse reflection. The reflected light is independent of the viewing position (equally bright from all viewing directions) But the light position with respect to the surface orientation is important to determine the light reflected from the surface. When an object is illuminated with white light the original color of the object is what we see as the diffuse reflection. If a blue object is illuminated with red light, it will appear black.

18 Modeling Diffuse Reflection Orientation of the surface determines the amount of light incident on the surface Given the angle θ between the surface normal and the incident light direction, we can write the diffuse reflection equation as: I l, diff =k d I l,incident =k d I l cos θ

19 Combining Ambient and Diffuse I l, diff = { k a I a k d I l N L, if N L 0 ka I a, if N L 0 L= P source P surface P source P surface

20 Ambient Light vs. Diffuse Reflection Ambient lighting only With diffuse lighting

21 Specular reflection Light reflected from a certain spot on the object is concentrated and appears as a lot brighter compared to other spots. This is due to specular reflection and is an important property of shiny objects. Specular reflection is both dependent on the light direction, surface orientation, and viewer position.

22 Modeling Specular Reflection Let us try to picture specular reflection The specular reflection angle equals angle of incidence The specular reflection is visible only at directions close to R. Shiny surfaces like mirrors have a narrow specular reflection range (given as parameter ns, specular reflection exponent.)

23 Modeling Specular Reflection I l, spec = { ns k s I l V R, if V R 0 and N L , if V R 0 and N L 0

24 Diffuse vs. Specular Reflection Diffuse Reflection Diffuse and Specular Reflection

25 Combining all together Considering objects that can emit light and multiple light sources in the scene n I =I surfemission I ambdiff f l, radaten f l, angaten I l, diff I l, spec l=1 Also, note that, if you consider different colors of light and surfaces, you should use similar equations (possibly with different parameters) and apply it to each color component (R,G,B).

26 Ambient, Diffuse, and Specular Reflections Together

27 Summary The light reflected off the surface of an object is composed ambient, diffuse and specular components. Ambient component is independent of the surface orientation and viewer position Diffuse component is independent of the viewer position but depends on the relative orientation of the light source and the surface In specular reflection the position of the viewer is also important

28 Polygon Rendering Methods Surface representations: Usually polygon mesh approximations. Simpler calculations HW support Curved surfaces versus polyhedra: If smooth surface is desired use interpolation If you want to display polyhedra use constant intensity surface rendering

29 Polygon Rendering Methods Constant intensity rendering: No interpolation. Also called flat shading Intensity interpolation rendering: Gouraud shading Based on intensity interpolation of vertices. Normal vector interpolation rendering: Phong shading Based on interpolation of normal vectors of vertices.

30 Cheapest method: Calculate the surface normal and other illumination parameters for any chosen point on the surface and fill the polygon with that intensity. Usefull especially in fast previews. L So that: All illumination parameters are constant through the polygon surface. N Viewer is at infinity V L Light source is at infinity N V Assumes: V NV N L L Constant Intensity Rendering

31 Intensity interpolation (Gouraud Shading) Approximation of smooth surface by polygon rendered with interpolated intensities. For each vertex of polygon: Unit Normal at the vertex is taken as average of all adjacent surface normals. Calculate the intensity at the vertex by using an illumination model. Interpolate the intensity values at vertices to calculate the interior pixel intensities of the polygon. n k=1 N k N Vert = n k=1 N k

32 Intensity interpolation (Gouraud Shading) 3 Polygon rendering can be combined with scan conversion. 1 Two stage interpolation: First, interpolate border pixels, I Then interpolate interior pixels from borders pixels. I 4= I p= y 4 y 2 y1 y2 x 5 x p x 5 x 4 I 1 I 4 y 1 y 4 y 1 y 2 x p x4 x 5 x 4 I2 I5 4 PScan line5 2

33 Example 3 Scan line 1 4 p 5 2 P1 = 1,2, P2 = 5,0, P 3 = 3,4, P 4 = 3,1, P 5 = 4,1, N 1 = 0,1,0, N 2 = 0,0,1, N 3 = 0,0. 7,0. 7 V = 0,0,1, L= 0,0. 7,0. 7 K a =0. 1, I a =0.5, K d =0. 5, K s =0. 2, ns =1, I L =0.6 Find : I 4, I 5, I P with Gouraud shading P= 3. 5,1

34 Example First Step: Find the illumination amount at the vertices: I1, I2, and I3 ns I=K a I a +K d N L I L +K s V R I L, R=2 N L N L R1 =2 0. 7N1 L= 0,1. 4,0 0,0. 7,0. 7 = 0,0. 7, 0. 7 I 1 = =0. 26 R2 =2 0. 7N2 L= 0, 0,1. 4 0,0. 7,0. 7 = 0, 0. 7,0. 7 I 2 = =0. 34 R3 =2 1N 3 L= 0,1. 4,1. 4 0,0. 7,0. 7 = 0,0. 7,0. 7 I 3 = =0. 43 Scan line p 5 P1 = 1,2, P2 = 5,0, P 3 = 3,4, P 4 = 3,1, P 5 = 4,1, P= 3. 5,1 N 1= 0,1,0, N 2 = 0,0,1, N 3 = 0,0. 7,0. 7 V = 0,0,1, L= 0,0. 7,0. 7 K a =0. 1, I a =0.5, K d =0. 5, K s =0. 2, n s =1, 2 I L =0. 6

35 Example Second step: Find the illumination amount at the vertices: I4, I5, and Ip 3 using I1, I2, and I3. y 4 y 2 I 4= = y 1 y 2 I 1 y 1 y 4 y 1 y 2 I = = I 5= y 5 y2 y 3 y 2 I 3 y 3 y 5 y 3 y 2 Scan line I = = = IP= x 5 x P x 5 x 4 I 4 x P x 4 x 5 x 4 I IP= = = p 5 2 I 1 =0. 26 I 2 =0. 34 I 3 =0. 43

36 A more efficient approach Incremental calculation: I y= I x= 3 I 1 I 2 y 1 y 2 I x I x e 1 s x e x s I y+ 1 =I y + I y I x+ 1 =I x + I x y+1 y xs x x+1 xe 2

37 Gouraud Shading Fast and acceptable quality Problem: Unnatural highlight shapes Intensity streaks (mach bands)

38 Gouraud versus Phong Shading Intensity interpolation with lower number of polygons. Gouraud 10x10 polygons Gouraud 30x30 polygons Phong 10x10 polygons

39 Normal Interpolation Rendering Phong rendering or shading. Idea similar to Gouraud but surface normals are interpolated for each pixel. Calculate unit normals at vertices from adjacent surface normals For each pixel of the polygon: Interpolate the normal from the vertex normals Calculate the intensity by applying an illumination model. Better results than Gouraud, but much expensive.

40 Phong surface rendering Normal vector interpolation with scanlines N 4= N P= y 4 y 2 y 1 y 2 x 5 x P x 5 x 4 N 1 y 1 y 4 y 1 y 2 N 4 N2 x P x 4 x 5 x 4 N5 I P =K a I a K d N P L +K s R P V 1 Scan line ns I 3 4 p 5 2 L Expensive since it requires calculation of intensity for each pixel. Accelarations based on Taylor expansion exists but still very expensive compared to Gouraud.

41 Example 3 Scan line 1 4 p 5 2 P1 = 1,2, P2 = 5,0, P 3 = 3,4, P 4 = 3,1, P 5 = 4,1, N 1 = 0,1,0, N 2 = 0,0,1, N 3 = 0,0. 7,0. 7 V = 0,0,1, L= 0,0. 7,0. 7 K a =0. 1, I a =0.5, K d =0. 5, K s =0. 2, ns =1, I L =0.6 Find : I P with Phong shading P= 3. 5,1

42 Example First Step: Find the normal vectors at points 4, 5, and p: N4, N5, and Np 3 y 4 y2 y1 y 4 N 4= y 1 y 2 N 1 y1 y 2 N2 =0. 5 0,1, ,0,1 = 0,0. 5,0. 5, unit vector N 4 = 0,0. 7,0. 7 y 5 y 2 y 3 y 5 N 5= N 3 N2 y3 y2 y 3 y 2 = ,0. 7, ,0,1 = 0,0. 18,0. 93, unit vector N 5 = 0,0.19,0.98 x 5 x P x P x 4 N P= N 4 N5 x 5 x 4 x 5 x 4 =0. 5 0,0. 7, ,0. 19,0. 98 = 0,0. 45, 0.84, unit vector N P = 0,0. 47,0. 88 Scan line 1 4 p 5 P1 = 1,2, P2 = 5,0, P 3 = 3,4, P 4 = 3,1, P 5 = 4,1, P= 3. 5,1 N 1= 0,1,0, N 2 = 0,0,1, N 3 = 0,0. 7,0. 7 V = 0,0,1, L= 0,0. 7,0. 7 K a =0. 1, I a =0.5, K d =0. 5, K s =0. 2, n s =1, 2 I L =0. 6

43 Example Second step: Find the illumination amount at point p, Ip,using Np 3 ns I=K a I a +K d N L I L +K s V R I L, R=2 N L N L R p = N p L = 0,0. 89, ,0.7,0. 7 = 0,0.19,0.96 I p = =0.45 We found Ip as 0.33 with Gouraud shading previously Scan line 1 4 p 5 2 N p = 0,0.47, 0.88 V = 0,0,1, L= 0,0. 7,0. 7 K a =0. 1, I a =0. 5, K d =0. 5, K s =0. 2, n s =1, I L =0. 6

44 OpenGL Illumination and Surface-Rendering Functions

45 OpenGL Lighting Functions OpenGL provides functions for setting up point light sources and spotlights, selecting surface reflection coefficients choosing values for several parameters in the basic illumination model OpenGL supports constant intensity rendering (flat shading) and Gouraud surface rendering (smooth shading) OpenGL does not support Phong shading.

46 Light Sources: GL_MAX_LIGHTS Up to eight light sources can be included in a standard OpenGL implementation Some implementations may allow more than 8 This maximum number is a limitation on the number of light sources by which a single object is illuminated. When light attenuation and direction are accounted for, you may find that any given piece of geometry in your scene is only illuminated by a small handful of lights If you have multiple light emitting objects, and your goal is to view the emission (not the effect of these lights on other objects) they can be modeled by texture mapping.

47 Light Sources Properties of a light source such as position, type, color, attenuation, and spotlight effects can be specified with the following OpenGL function: gllight* (lightname, lightproperty, propertyvalue); Each light source is referenced by its identifier which is one of GL_LIGHT0, GL_LIGHT1,..., GL_LIGHT7 A light source is enabled with: glenable (lightname);

48 Lighting Lighting is enabled globally in an OpenGL program with the following command: glenable (GL_LIGHTING);

49 Light Properties gllight* (lightname, lightproperty, propertyvalue); lightproperty can be one of: GL_POSITION GL_CONSTANT_ATTENUATION GL_AMBIENT GL_LINEAR_ATTENUATION GL_DIFFUSE GL_QUADRATIC_ATTENUATION GL_SPECULAR GL_SPOT_DIRECTION GL_SPOT_CUTOFF GL_SPOT_EXPONENT

50 Light-Source Position and Type GL_POSITION property constant is used to specify both the position and type of a light source Two types of lights Local light sources that are near the objects Light sources at infinity Remark: The type of a light source is independent of the 3d position we assign to a light source. It is determined by a fourth parameter value.

51 Light Sources: Local vs. Infinite For a local light source, the emitted light radiates in all directions and the position of the light is used in the lighting calculations I.e., the light direction changes for every object In OpenGL, it is referred to as Positional Light For a light source at infinity, the emitted light radiates in one direction only and this direction is applied to all objects in the scene I.e., the light direction is constant for every object The direction is given from the light source position to the coordinate origin In OpenGL, it is referred to as Directional Light

52 Example Positional light Directional light

53 Applying transformations A light source is like an object in the scene and included in the scene description Geometric transformation matrices and viewing transformation matrices are applied to light positions as applied to other objects If you want to fix your light position relative to the objects in your scene, you need to set the light position after you specify geometric and viewing transformations If we want the light move as the view point moves, set its position before glulookat(...)

54 Light Source Colors You can specify three different color properties to a light source This is unrealistically flexible compared to real world lights which have one color We can specify the ambient, diffuse, and specular components of a light source with different colors.

55 Example GLfloat blackcolor [] = {0.0, 0.0, 0.0, 1.0}; GLfloat whitecolor [] = {1.0, 1.0, 1.0, 1.0}; gllightfv (GL_LIGHT3, GL_AMBIENT, blackcolor); gllightfv (GL_LIGHT3, GL_DIFFUSE, whitecolor); gllightfv (GL_LIGHT3, GL_SPECULAR, whitecolor);

56 Example Black ambient White diffuse White specular Black ambient Red diffuse Blue specular

57 Radial-Intensity Attenuation In other words: distance base decrease in the lighting amount OpenGL provides functions to set the constants in the following equation f atten d l = 1 a 0 a 1 d l a 2 d 2l gllightf (GL_LIGHT3, GL_CONSTANT_ATTENUATION, 1.5); gllightf (GL_LIGHT3, GL_LINEAR_ATTENUATION, 0.75); gllightf (GL_LIGHT3, GL_QUADRATIC_ATTENUATION, 0.4); By default a0=1.0, a1=0.0, a2=0.0, which means no attenuation.

58 Directional Local Light Sources a.k.a Spotlights In order to limit the light to a cone shaped region of space The direction of the spotlight, the angular extent of the spotlight and the angular attenuation factor can be specified GLfloat dirvector [] = {1.0, 0.0, 0.0}; gllightf (GL_LIGHT3, GL_SPOT_DIRECTION, dirvector); V light gllightf (GL_LIGHT3, GL_SPOT_CUTOFF, 30.0); θl gllightf (GL_LIGHT3, GL_SPOT_EXPONENT, 2.5); cos l α= V obj V light l a a

59 Example

### Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Ambient reflection Phong reflection is a local illumination model. It only considers the reflection of light that directly comes from the light source. It does not compute secondary reflection of light

### Ligh%ng and Shading. Ligh%ng and Shading. q Is this a plate or a ball? q What color should I set for each pixel?

Ligh%ng and Shading Ligh%ng and Shading Is this a plate or a ball? What color should I set for each pixel? 1 Physical Reality As light hits the surface: Part is absorbed Part is reflected Visible light

### Computer Graphics. Illumination and Shading

() Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω

### Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Reading Required: Angel 6.1-6.5, 6.7-6.8 Optional: Shading OpenGL red book, chapter 5. 1 2 Introduction So far, we ve talked exclusively about geometry. What is the shape of an obect? How do I place it

### CS5620 Intro to Computer Graphics

So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading

Illumination Models & Shading Lighting vs. Shading Lighting Interaction between materials and light sources Physics Shading Determining the color of a pixel Computer Graphics ZBuffer(Scene) PutColor(x,y,Col(P));

### Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Reading Required: Angel 6.1-6.3, 6.5, 6.7-6.8 Optional: Shading Angel 6.4 OpenGL red book, chapter 5. 1 2 Introduction An abundance of photons So far, we ve talked exclusively about geometry. Properly

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

Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

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

Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

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

Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

Computergrafik Thomas Buchberger, Matthias Zwicker Universität Bern Herbst 2008 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation

### Graphics and Visualization

International University Bremen Spring Semester 2006 Recap Hierarchical Modeling Perspective vs Parallel Projection Representing solid objects Displaying Wireframe models is easy from a computational

### CS Computer Graphics: Illumination and Shading I

CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

### CS Computer Graphics: Illumination and Shading I

CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

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

Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

### Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

### INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry Visual appearance Christopher Dyken and Martin Reimers 23.09.2009 Page 1 Visual appearance Real Time Rendering: Chapter 5 Light Sources and materials Shading

### Illumination & Shading: Part 1

Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

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

llumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade in

Computergrafik Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global

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

Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL 1 Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

### Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Representation of Light and Color Do we need to represent all I! to represent a color C(I)? Representation

### Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 55 Shading Guoying Zhao 2 / 55 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

### CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:

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

Introduction to Computer Graphics Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces Outline Computational tools Reflection models Polygon shading Computation tools Surface normals Vector

CS 543: Computer Graphics Illumination & Shading I Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu

Illumination and Shading Illumination (Lighting)! Model the interaction of light with surface points to determine their final color and brightness! The illumination can be computed either at vertices or

### Shading , Fall 2004 Nancy Pollard Mark Tomczak

15-462, Fall 2004 Nancy Pollard Mark Tomczak Shading Shading Concepts Shading Equations Lambertian, Gouraud shading Phong Illumination Model Non-photorealistic rendering [Shirly, Ch. 8] Announcements Written

### Light Sources. Spotlight model

lecture 12 Light Sources sunlight (parallel) Sunny day model : "point source at infinity" - lighting - materials: diffuse, specular, ambient spotlight - shading: Flat vs. Gouraud vs Phong light bulb ambient

### Lighting. CSC 7443: Scientific Information Visualization

Lighting Why Lighting? What light source is used and how the object response to the light makes difference Ocean looks bright bluish green in sunny day but dim gray green in cloudy day Lighting gives you

### Shading I Computer Graphics I, Fall 2008

Shading I 1 Objectives Learn to shade objects ==> images appear threedimensional Introduce types of light-material interactions Build simple reflection model Phong model Can be used with real time graphics

### Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Do we need to represent all I! to represent a color C(I)? No we can approximate using a three-color

### Comp 410/510 Computer Graphics. Spring Shading

Comp 410/510 Computer Graphics Spring 2017 Shading Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather

### Visualisatie BMT. Rendering. Arjan Kok

Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Color Rendering Illumination 2 Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract

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

15-462 Computer Graphics I Lecture 7 Lighting and Shading February 12, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Light Sources Phong Illumination Model

### Shading. CSE 457 Winter 2015

Shading CSE 457 Winter 2015 Reading Required: Angel chapter 5. Optional: OpenGL red book, chapter 5. 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in their local coordinate

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material

### CS 325 Computer Graphics

CS 325 Computer Graphics 04 / 02 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Illumination modelling Ambient, Diffuse, Specular Reflection Surface Rendering / Shading models Flat

### Shading. Brian Curless CSE 457 Spring 2015

Shading Brian Curless CSE 457 Spring 2015 1 Reading Required: Angel chapter 5. Optional: OpenGL red book, chapter 5. 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in

### ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating

### Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism

### Illumination Models and Surface-Rendering Methods. Chapter 10

Illumination Models and Surface-Rendering Methods Chapter 10 Illumination and Surface- Rendering Given scene specifications object positions, optical properties of the surface, viewer position, viewing

Illumination and Shading Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/14/07 1 From last time Texture mapping overview notation wrapping Perspective-correct interpolation Texture

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

Computer Graphics Shading Based on slides by Dianna Xu, Bryn Mawr College Image Synthesis and Shading Perception of 3D Objects Displays almost always 2 dimensional. Depth cues needed to restore the third

### CS Surface Rendering

CS10101001 Surface Rendering Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Surface rendering How do we choose a color

### Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

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

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting & shading? Sphere

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

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting

Illumination & Shading Goals Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can be used with real time graphics hardware Why we need Illumination

Why we need shading? Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like But we want Light-material interactions cause each point to have a different

### Chapter 3. Illumination Models and Surface-Rendering Methods. Department of Computer Science and Engineering

Chapter 3 Illumination Models and Surface-Rendering Methods 3-1 3.1 Overview For a realistic display of a scene the lighting effects should appear naturally. An illumination model, also called a lighting

### Illumination Models. To calculate the color of an illuminated position on the

llumination Models 5 th Week, 2008 Sun-Jeong Kim Realistic Scene in CG Perspective projection of objects + natural lighting effects to the visible surface Light reflections, transparency, surface texture,

### CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17)

CSCI 4620/8626 Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17) Last update: 2016-04-19 Realism! Realistic displays of a scene use! Perspective projections of objects! Application

### Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Projections and Hardware Rendering Brian Curless CSE 557 Fall 2014 1 Reading Required: Shirley, Ch. 7, Sec. 8.2, Ch. 18 Further reading: Foley, et al, Chapter 5.6 and Chapter 6 David F. Rogers and J. Alan

### University of Victoria CSC 305 Shading. Brian Wyvill 2016

University of Victoria CSC 305 Shading Brian Wyvill 2016 The illuminating Hemisphere Energy and Intensity Energy is the intensity integrated over the solid angle through which it acts. Intensity is not

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

1 llumination Today we will start to look at illumination models in computer graphics Why do we need illumination models? Different kinds lights Different kinds reflections Basic lighting model 2 Why Lighting?

Shading w Foley, Section16.1 Reading Introduction So far, we ve talked exclusively about geometry. w What is the shape of an object? w How do I place it in a virtual 3D space? w How do I know which pixels

### Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016 Solar Spectrum Human Trichromatic Color Perception Color Blindness Present to some degree in 8% of males and about 0.5% of females due to mutation

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

CSE 167: Introduction to Computer Graphics Lecture #7: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015 Announcements Thursday in-class: Midterm Can include material

### Light Transport Baoquan Chen 2017

Light Transport 1 Physics of Light and Color It s all electromagnetic (EM) radiation Different colors correspond to radiation of different wavelengths Intensity of each wavelength specified by amplitude

### CPSC / Illumination and Shading

CPSC 599.64 / 601.64 Rendering Pipeline usually in one step modelling of geometry transformation into world coordinate system placement of cameras and light sources transformation into camera coordinate

9. Illumination and Shading Approaches for visual realism: - Remove hidden surfaces - Shade visible surfaces and reproduce shadows - Reproduce surface properties Texture Degree of transparency Roughness,

### Computer Graphics. Illumination and Shading

Rendering Pipeline modelling of geometry transformation into world coordinates placement of cameras and light sources transformation into camera coordinates backface culling projection clipping w.r.t.

### Lights, Colour and Materials In OpenGL

Illumination Models Lights, Colour and Materials In OpenGL Illumination models are used to generate the colour of an object s surface at a given point on that surface. The factors that govern the illumination

### CS Illumination and Shading. Slide 1

CS 112 - Illumination and Shading Slide 1 Illumination/Lighting Interaction between light and surfaces Physics of optics and thermal radiation Very complex: Light bounces off several surface before reaching

### Lighting Models. CS116B Chris Pollett Mar 21, 2004.

Lighting Models CS116B Chris Pollett Mar 21, 2004. Outline Overview Light Sources Surface Lighting Effect Basic Illumination Models Overview An illumination model (lighting model) is used to calculate

### From Graphics to Visualization

From Graphics to Visualization Introduction Light Sources Surface Lighting Effects Basic (Local ) Illumination Models Polgon-Rendering Methods Texture Mapping Transparenc and Blending Visualization Pipeline

### Sung-Eui Yoon ( 윤성의 )

CS380: Computer Graphics Illumination and Shading Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Course Objectives (Ch. 10) Know how to consider lights during rendering models

### Lighting. Figure 10.1

We have learned to build three-dimensional graphical models and to display them. However, if you render one of our models, you might be disappointed to see images that look flat and thus fail to show the

### CS770/870 Spring 2017 Color and Shading

Preview CS770/870 Spring 2017 Color and Shading Related material Cunningham: Ch 5 Hill and Kelley: Ch. 8 Angel 5e: 6.1-6.8 Angel 6e: 5.1-5.5 Making the scene more realistic Color models representing the

### Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading

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

CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading Suppose we build a model of a sphere using many polygons and color

### Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

Color and Light CSCI 4229/5229 Computer Graphics Summer 2008 Solar Spectrum Human Trichromatic Color Perception Are A and B the same? Color perception is relative Transmission,Absorption&Reflection Light

### Shading. Brian Curless CSE 557 Autumn 2017

Shading Brian Curless CSE 557 Autumn 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

### Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

Shading Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller/Fuhrmann Reading Chapter 5.5 - Angel Chapter 6.3 - Hughes, van Dam, et al Machiraju/Zhang/Möller/Fuhrmann 2 Shading Illumination

Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

### Introduction to Computer Graphics 7. Shading

Introduction to Computer Graphics 7. Shading National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: Hearn and Baker, Computer Graphics, 3rd Ed., Prentice Hall Ref: E.Angel, Interactive

### Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

### OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment

### Lecture 4 Advanced Computer Graphics (CS & SE )

Lecture 4 Advanced Computer Graphics (CS & SE 233.420) Topics Covered Animation Matrices Viewing Lighting Animating Interactive Programs Consider planet.c Want to animate rotating the Earth around the

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 Announcements Project 2 due Friday, Oct. 24 th Midterm Exam

DH2323 DGI15 INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION LIGHTING AND SHADING Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters

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

LIGHTING 1 OUTLINE Learn to light/shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can

CT4510: Computer Graphics Illumination and Shading BOCHANG MOON Photorealism The ultimate goal of rendering is to produce photo realistic images. i.e., rendered images should be indistinguishable from

### CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CENG 477 Introduction to Computer Graphics Ray Tracing: Shading Last Week Until now we learned: How to create the primary rays from the given camera and image plane parameters How to intersect these rays

Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics

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

Shading Intro Shading & Lighting Move from flat to 3-D models Orthographic view of sphere was uniformly color, thus, a flat circle A circular shape with many gradations or shades of color Courtesy of Vincent

Shading Why we need shading Objectives Learn to shade objects so their images appear three-dimensional Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something

### CPSC 314 LIGHTING AND SHADING

CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex

### Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate

### Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

### Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Mach band effect The Mach band effect increases the visual unpleasant representation of curved surface using flat shading. A B 320322: Graphics and Visualization 456 Mach band effect The Mach band effect