# CEng 477 Introduction to Computer Graphics Fall

Save this PDF as:

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

### 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ω

### 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 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

### 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

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

### 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

### 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

### 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

### 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

### 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

### 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 & 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

### Computer Graphics Lighting

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

### 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

### 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

### 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

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

### 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

### 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

### Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Lighting and Shading Slides: Tamar Shinar, Victor Zordon Why we need shading Suppose we build a model of a sphere using many polygons and color each the same color. We get something like But we want 2

Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when

Illumination and Shading Light sources emit intensity: assigns intensity to each wavelength of light Humans perceive as a colour - navy blue, light green, etc. Exeriments show that there are distinct I

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

Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:

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

CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:

### CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #7: Color and Shading Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #3 due this Friday,

### Lighting/Shading II. Week 7, Mon Mar 1

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading II Week 7, Mon Mar 1 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 News Homework 3 out today Homework

### Illumination and Reflection in OpenGL CS 460/560. Computer Graphics. Shadows. Photo-Realism: Ray Tracing. Binghamton University.

Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

### CSE 681 Illumination and Phong Shading

CSE 681 Illumination and Phong Shading Physics tells us What is Light? We don t see objects, we see light reflected off of objects Light is a particle and a wave The frequency of light What is Color? Our

### Interpolation using scanline algorithm

Interpolation using scanline algorithm Idea: Exploit knowledge about already computed color values. Traverse projected triangle top-down using scanline. Compute start and end color value of each pixel

### CS452/552; EE465/505. Lighting & Shading

CS452/552; EE465/505 Lighting & Shading 2-17 15 Outline! More on Lighting and Shading Read: Angel Chapter 6 Lab2: due tonight use ASDW to move a 2D shape around; 1 to center Local Illumination! Approximate

### So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

11 11.1 Basics So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. Global models include incident light that arrives

### To start, open or build a simple solid model. The bracket from a previous exercise will be used for demonstration purposes.

Render, Lights, and Shadows The Render programs are techniques using surface shading, surface tones, and surface materials that are then presented in a scene with options for lights and shadows. Modifications

### CS 5625 Lec 2: Shading Models

CS 5625 Lec 2: Shading Models Kavita Bala Spring 2013 Shading Models Chapter 7 Next few weeks Textures Graphics Pipeline Light Emission To compute images What are the light sources? Light Propagation Fog/Clear?

### Photorealism: Ray Tracing

Photorealism: Ray Tracing Reading Assignment: Chapter 13 Local vs. Global Illumination Local Illumination depends on local object and light sources only Global Illumination at a point can depend on any

### Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Computer Graphics 1 Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering 1 The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons

### UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

UNIT 7 LIGHTING AND SHADING 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M Ans: Phong developed a simple model that can be computed rapidly It considers three

### Illumination. Illumination CMSC 435/634

Illumination CMSC 435/634 Illumination Interpolation Illumination Illumination Interpolation Illumination Illumination Effect of light on objects Mostly look just at intensity Apply to each color channel

### Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

CS 431/636 Advanced Rendering Techniques Ø Dr. David Breen Ø Korman 105D Ø Wednesday 6PM 8:50PM Presentation 6 5/16/12 Questions from ast Time? Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling

### Open Game Engine Exchange Specification

Open Game Engine Exchange Specification Version 1.0.1 by Eric Lengyel Terathon Software LLC Roseville, CA Open Game Engine Exchange Specification ISBN-13: 978-0-9858117-2-3 Copyright 2014, by Eric Lengyel

### Surface Reflection Models

Surface Reflection Models Frank Losasso (flosasso@nvidia.com) Introduction One of the fundamental topics in lighting is how the light interacts with the environment. The academic community has researched

### Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000

### CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely

### Introduction to 3D Graphics

Introduction to 3D Graphics Using OpenGL 3D 1/46 Classical Polygon Graphics (H/W) Pipeline Mesh objects with 3D polygons (triangles or quads usually) Apply material properties to each object (for reflectance

### - Rasterization. Geometry. Scan Conversion. Rasterization

Computer Graphics - The graphics pipeline - Geometry Modelview Geometry Processing Lighting Perspective Clipping Scan Conversion Texturing Fragment Tests Blending Framebuffer Fragment Processing - So far,

### COMP environment mapping Mar. 12, r = 2n(n v) v

Rendering mirror surfaces The next texture mapping method assumes we have a mirror surface, or at least a reflectance function that contains a mirror component. Examples might be a car window or hood,

### 3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

### Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Learn the basic design of a graphics system Introduce

### CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75

### Lighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following:

Chapter 5 Lighting Chapter Objectives After reading this chapter, you'll be able to do the following: Understand how real-world lighting conditions are approximated by OpenGL Render illuminated objects

### Announcement. Lighting and Photometric Stereo. Computer Vision I. Surface Reflectance Models. Lambertian (Diffuse) Surface.

Lighting and Photometric Stereo CSE252A Lecture 7 Announcement Read Chapter 2 of Forsyth & Ponce Might find section 12.1.3 of Forsyth & Ponce useful. HW Problem Emitted radiance in direction f r for incident

### Surface Rendering. Surface Rendering

Surface Rendering Surface Rendering Introduce Mapping Methods - Texture Mapping - Environmental Mapping - Bump Mapping Go over strategies for - Forward vs backward mapping 2 1 The Limits of Geometric Modeling

### Shading, lighting, & BRDF Theory. Cliff Lindsay, PHD

Shading, lighting, & BRDF Theory Cliff Lindsay, PHD Overview of today s lecture BRDF Characteristics Lights in terms of BRDFs Classes of BRDFs Ambient light & Shadows in terms of BRDFs Decomposing Reflection

### Photorealistic 3D Rendering for VW in Mobile Devices

Abstract University of Arkansas CSCE Department Advanced Virtual Worlds Spring 2013 Photorealistic 3D Rendering for VW in Mobile Devices Rafael Aroxa In the past few years, the demand for high performance

### General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

### Shading Languages. Seminar Computer Graphics. Markus Kummerer

Shading Languages Markus Kummerer ABSTRACT Shading Languages provide a highly flexible approach for creating visual structures in computer imagery. The RenderMan Interface provides an API for scene description,

### Recall: Basic Ray Tracer

1 Recall: Ray Tracing Generate an image by backwards tracing the path of light through pixels on an image plane Simulate the interaction of light with objects Recall: Basic Ray Tracer Trace a primary ray

### Color and Shading. Color. Shapiro and Stockman, Chapter 6. Color and Machine Vision. Color and Perception

Color and Shading Color Shapiro and Stockman, Chapter 6 Color is an important factor for for human perception for object and material identification, even time of day. Color perception depends upon both

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

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

### Draw Guide. Chapter 7 Working with 3D Objects

Draw Guide Chapter 7 Working with 3D Objects Copyright This document is Copyright 2011 2014 by the LibreOffice Documentation Team. Contributors are listed below. You may distribute or modify it under the

### Working with the BCC Bump Map Generator

Working with the BCC Bump Map Generator Bump mapping is used to create three dimensional detail on an image based on the luminance information in the image. The luminance value of each pixel of the image

### graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

### critical theory Computer Science

Art/Science Shading, Materials, Collaboration Textures Example title Artists In the recommend real world, two the main following: factors determine the appearance of a surface: basic understanding what

### BETWEEN PHOTO-REALISM AND NON-PHOTO REALISTIC RENDERING MODELING URBAN AREAS FOR REAL TIME VR

BETWEEN PHOTO-REALISM AND NON-PHOTO REALISTIC RENDERING MODELING URBAN AREAS FOR REAL TIME VR Guenter Pomaska Bielefeld University of Applied Sciences, Faculty of Architecture and Civil Engineering, Germany

### Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Rendering Algorithms: Real-time indirect illumination Spring 2010 Matthias Zwicker Today Real-time indirect illumination Ray tracing vs. Rasterization Screen space techniques Visibility & shadows Instant

### Why Do We Care About Lighting? Computer Graphics Lighting. The Surface Normal. Flat Shading (Per-face) Setting a Surface Normal in OpenGL

Lightig Why Do We Care About Lightig? Lightig dis-ambiguates 3D scees This work is licesed uder a Creative Commos Attributio-NoCommercial- NoDerivatives 4.0 Iteratioal Licese Mike Bailey mjb@cs.oregostate.edu

### Chapter 4- Blender Render Engines

Chapter 4- Render Engines What is a Render Engine? As you make your 3D models in, your goal will probably be to generate (render) an image or a movie as a final result. The software that determines how

### Volume Shadows Tutorial Nuclear / the Lab

Volume Shadows Tutorial Nuclear / the Lab Introduction As you probably know the most popular rendering technique, when speed is more important than quality (i.e. realtime rendering), is polygon rasterization.

### Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadow Algorithms CSE 781 Winter 2010 Han-Wei Shen Why Shadows? Makes 3D Graphics more believable Provides additional cues for the shapes and relative positions of objects in 3D What is shadow? Shadow:

### OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives

### More Texture Mapping. Texture Mapping 1/46

More Texture Mapping Texture Mapping 1/46 Perturbing Normals Texture Mapping 2/46 Perturbing Normals Instead of fetching a texture for color, fetch a new perturbed normal vector Creates the appearance

### COM337 COMPUTER GRAPHICS Other Topics

COM337 COMPUTER GRAPHICS Other Topics Animation, Surface Details, Global Illumination Kurtuluş Küllü based on the book by Hearn, Baker, and Carithers There are some other important issues and topics that

### Notes on Computer Graphics and OpenGL. Thomas Strathmann

Notes on Computer Graphics and OpenGL Thomas Strathmann February 2, 2011 Preface The purpose of this document is to server as a sort of logbook in which I put down all the interesting math and assorted

### Working with the BCC Brick Generator

Working with the BCC Brick Generator Brick is a versatile generator of tiled surfaces with realistic texture and lighting controls. The bricks can act as a Þlter on a layer or generate a brick surface

### Lecture 4: Reflection Models

Lecture 4: Reflection Models CS 660, Spring 009 Kavita Bala Computer Science Cornell University Outline Light sources Light source characteristics Types of sources Light reflection Physics-based models

### The Law of Reflection

If the surface off which the light is reflected is smooth, then the light undergoes specular reflection (parallel rays will all be reflected in the same directions). If, on the other hand, the surface

### Realtime Shading of Folded Surfaces

Realtime Shading of Folded Surfaces B.Ganster R. Klein M. Sattler R. Sarlette {ganster, rk, sattler, sarlette}@cs.uni-bonn.de University of Bonn Institute of Computer Science II Computer Graphics Römerstrasse

### Visualization Toolkit(VTK) Atul Kumar MD MMST PhD IRCAD-Taiwan

Visualization Toolkit(VTK) Atul Kumar MD MMST PhD IRCAD-Taiwan Visualization What is visualization?: Informally, it is the transformation of data or information into pictures.(scientific, Data, Information)

### Computer graphic -- Programming with OpenGL 2

Computer graphic -- Programming with OpenGL 2 OpenGL OpenGL (Open Graphics Library) a cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is typically used to interact

### CS201 Computer Vision Lect 4 - Image Formation

CS201 Computer Vision Lect 4 - Image Formation John Magee 9 September, 2014 Slides courtesy of Diane H. Theriault Question of the Day: Why is Computer Vision hard? Something to think about from our view

### Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th 1. a. Show that the following sequences commute: i. A rotation and a uniform scaling ii. Two rotations about the same axis iii. Two

### Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

Foundations of omputer Graphics Online Lecture 10: Ray Tracing 2 Nuts and olts amera Ray asting Outline amera Ray asting (choose ray directions) Ravi Ramamoorthi Outline in ode Image Raytrace (amera cam,

### Introduction. Part I: Measuring the Wavelength of Light. Experiment 8: Wave Optics. Physics 11B

Physics 11B Experiment 8: Wave Optics Introduction Equipment: In Part I you use a machinist rule, a laser, and a lab clamp on a stand to hold the laser at a grazing angle to the bench top. In Part II you

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

Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Continue discussion of shading Introduce modified Phong model

### Computer Graphics and Visualization. What is computer graphics?

CSCI 120 Computer Graphics and Visualization Shiaofen Fang Department of Computer and Information Science Indiana University Purdue University Indianapolis What is computer graphics? Computer graphics

### Wednesday, 26 January 2005, 14:OO - 17:OO h.

Delft University of Technology Faculty Electrical Engineering, Mathematics, and Computer Science Mekelweg 4, Delft TU Delft Examination for Course IN41 5 1-3D Computer Graphics and Virtual Reality Please

Using Shaders for Lighting Mike Bailey mjb@cs.oregonstate.edu Lighting Definitions L N R E N = Normal L = Light vector E = Eye vector R = Light reflection vector ER = Eye reflection vector Color = LightColor