# Lighting/Shading III. Week 7, Wed Mar 3

Size: px
Start display at page:

## Transcription

1 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week 7, Wed Mar 3

2 reminders News don't need to tell us you're taking grace days, they're assumed if you turn in late separate for written homework and project exception: HW2 not accepted after 11am Fri solutions posted then so you can use them when studying for midterm 2

3 Midterm Monday 3/8, 1-1:50 topics all material through Rasterization (Wed Feb 10 lecture) format closed book you may have simple (nongraphing) calculators you may have notes on one side of 8.5"x11" sheet of paper must be handwritten by you, cannot be xeroxed/printed you'll keep these notes. for final, can use back side of page as well. logistics must have UBC ID face up backpacks/coats at front of room phones off 3

4 Review: Phong Lighting most common lighting model in computer graphics (Phong Bui-Tuong, 1975) I specular = k s I light (cos") n shiny n shiny : purely empirical constant, varies rate of falloff k s : specular coefficient, highlight color no physical basis, works ok in practice v 4

5 Calculating Phong Lighting compute cosine term of Phong lighting with vectors I specular = k s I light (v r) n shiny v: unit vector towards viewer/eye r: ideal reflectance direction (unit vector) k s : specular component highlight color I light : incoming light intensity v how to efficiently calculate r? 5

6 Calculating R Vector P = N cos θ = projection of L onto N L N θ P 6

7 Calculating R Vector P = N cos θ = projection of L onto N P = N ( N L ) L N θ P 7

8 Calculating R Vector P = N cos θ L N projection of L onto N P = N cos θ L, N are unit length P = N ( N L ) N L θ P 8

9 Calculating R Vector P = N cos θ L N projection of L onto N P = N cos θ L, N are unit length P = N ( N L ) 2 P = R + L 2 P L = R 2 (N ( N L )) - L = R L N θ P P L R 9

10 Phong Lighting Model combine ambient, diffuse, specular components # lights I total = k a I ambient + " I i ( k d (n l i ) + k s (v r i ) nshiny ) i=1 commonly called Phong lighting once per light once per color component reminder: normalize your vectors when calculating! normalize all vectors: n,l,r,v 10

11 Phong Lighting: Intensity Plots 11

12 Blinn-Phong Model variation with better physical interpretation Jim Blinn, 1977 I out (x) = k s (h n) n shiny I in (x);with h = (l + v) /2 h: halfway vector h must also be explicitly normalized: h / h highlight occurs when h near n h l n v 12

13 quadratic falloff Light Source Falloff brightness of objects depends on power per unit area that hits the object the power per unit area for a point or spot light decreases quadratically with distance Area 4πr 2 Area 4π(2r) 2 13

14 Light Source Falloff non-quadratic falloff many systems allow for other falloffs allows for faking effect of area light sources OpenGL / graphics hardware I o : intensity of light source x: object point r: distance of light from x 14

15 lighting models ambient Lighting Review normals don t matter Lambert/diffuse angle between surface normal and light Phong/specular surface normal, light, and viewpoint 15

16 Lighting in OpenGL light source: amount of RGB light emitted value represents percentage of full intensity e.g., (1.0,0.5,0.5) every light source emits ambient, diffuse, and specular light materials: amount of RGB light reflected value represents percentage reflected e.g., (0.0,1.0,0.5) interaction: multiply components red light (1,0,0) x green surface (0,1,0) = black (0,0,0) 16

17 Lighting in OpenGL gllightfv(gl_light0, GL_AMBIENT, amb_light_rgba ); gllightfv(gl_light0, GL_DIFFUSE, dif_light_rgba ); gllightfv(gl_light0, GL_SPECULAR, spec_light_rgba ); gllightfv(gl_light0, GL_POSITION, position); glenable(gl_light0); glmaterialfv( GL_FRONT, GL_AMBIENT, ambient_rgba ); glmaterialfv( GL_FRONT, GL_DIFFUSE, diffuse_rgba ); glmaterialfv( GL_FRONT, GL_SPECULAR, specular_rgba ); glmaterialfv( GL_FRONT, GL_SHININESS, n ); warning: glmaterial is expensive and tricky use cheap and simple glcolor when possible see OpenGL Pitfall #14 from Kilgard s list 17

19 lighting Lighting vs. Shading process of computing the luminous intensity (i.e., outgoing light) at a particular 3-D point, usually on a surface shading the process of assigning colors to pixels (why the distinction?) 19

20 Applying Illumination we now have an illumination model for a point on a surface if surface defined as mesh of polygonal facets, which points should we use? fairly expensive calculation several possible answers, each with different implications for visual quality of result 20

21 Applying Illumination polygonal/triangular models each facet has a constant surface normal if light is directional, diffuse reflectance is constant across the facet why? 21

22 Flat Shading simplest approach calculates illumination at a single point for each polygon obviously inaccurate for smooth surfaces 22

23 Flat Shading Approximations if an object really is faceted, is this accurate? no! for point sources, the direction to light varies across the facet for specular reflectance, direction to eye varies across the facet 23

24 Improving Flat Shading what if evaluate Phong lighting model at each pixel of the polygon? better, but result still clearly faceted for smoother-looking surfaces we introduce vertex normals at each vertex usually different from facet normal used only for shading think of as a better approximation of the real surface that the polygons approximate 24

25 Vertex Normals vertex normals may be provided with the model computed from first principles approximated by averaging the normals of the facets that share the vertex 25

26 Gouraud Shading most common approach, and what OpenGL does perform Phong lighting at the vertices linearly interpolate the resulting colors over faces along edges along scanlines edge: mix of c 1, c 2 C 1 does this eliminate the facets? C 3 interior: mix of c1, c2, c3 C 2 edge: mix of c1, c3 26

27 Gouraud Shading Artifacts often appears dull, chalky lacks accurate specular component if included, will be averaged over entire polygon C 1 C 1 C 3 C 3 C 2 this interior shading missed! C 2 this vertex shading spread over too much area 27

28 Gouraud Shading Artifacts Mach bands eye enhances discontinuity in first derivative very disturbing, especially for highlights 28

29 Mach bands Gouraud Shading Artifacts C 1 C 4 C 3 C 2 Discontinuity in rate of color change occurs here 29

30 Gouraud Shading Artifacts perspective transformations affine combinations only invariant under affine, not under perspective transformations thus, perspective projection alters the linear interpolation! Image plane Z into the scene 30

31 Gouraud Shading Artifacts perspective transformation problem colors slightly swim on the surface as objects move relative to the camera usually ignored since often only small difference usually smaller than changes from lighting variations to do it right either shading in object space or correction for perspective foreshortening expensive thus hardly ever done for colors 31

32 Phong Shading linearly interpolating surface normal across the facet, applying Phong lighting model at every pixel same input as Gouraud shading pro: much smoother results con: considerably more expensive not the same as Phong lighting common confusion Phong lighting: empirical model to calculate illumination at a point on a surface 32

33 Phong Shading linearly interpolate the vertex normals compute lighting equations at each pixel can use specular component N 1 # lights # i=1 I total = k a I ambient + I i k d n" l i ( ( ) + k ( s v " r ) n ) shiny i remember: normals used in diffuse and specular terms N 4 N 2 N 3 discontinuity in normal s rate of change harder to detect 33

34 Phong Shading Difficulties computationally expensive per-pixel vector normalization and lighting computation! floating point operations required lighting after perspective projection messes up the angles between vectors have to keep eye-space vectors around no direct support in pipeline hardware but can be simulated with texture mapping stay tuned for modern hardware: shaders 34

35 Shading Artifacts: Silhouettes polygonal silhouettes remain Gouraud Phong 35

36 Shading Artifacts: Orientation interpolation dependent on polygon orientation view dependence! A B D Rotate -90 o and color same point C B ι A C Interpolate between AB and AD D Interpolate between CD and AD 36

37 Shading Artifacts: Shared Vertices D C H vertex B shared by two rectangles on the right, but not by the one on the left B G first portion of the scanline is interpolated between DE and AC E A F second portion of the scanline is interpolated between BC and GH a large discontinuity could arise 37

38 Shading Models Summary flat shading compute Phong lighting once for entire polygon Gouraud shading compute Phong lighting at the vertices and interpolate lighting values across polygon Phong shading compute averaged vertex normals interpolate normals across polygon and perform Phong lighting across polygon 38

42 Non-Photorealistic Shading cool-to-warm shading k w = 1+ n" l 2,c = k w c w + (1# k w )c c 42

43 Non-Photorealistic Shading draw silhouettes: if draw creases: if (e " n 0 )(e " n 1 ) # 0 (n 0 " n 1 ) # threshold, e=edge-eye vector 43

44 Computing Normals per-vertex normals by interpolating per-facet normals OpenGL supports both computing normal for a polygon b c a 44

45 Computing Normals per-vertex normals by interpolating per-facet normals OpenGL supports both computing normal for a polygon three points form two vectors b c c-b a-b a 45

46 Computing Normals per-vertex normals by interpolating per-facet normals OpenGL supports both computing normal for a polygon three points form two vectors cross: normal of plane gives direction normalize to unit length! (a-b) x (c-b) b which side is up? convention: points in counterclockwise order c c-b a-b a 46

47 Specifying Normals OpenGL state machine uses last normal specified if no normals specified, assumes all identical per-vertex normals glnormal3f(1,1,1); glvertex3f(3,4,5); glnormal3f(1,1,0); glvertex3f(10,5,2); per-face normals glnormal3f(1,1,1); glvertex3f(3,4,5); glvertex3f(10,5,2); 47

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

### University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

University of British Columbia CPSC 314 Computer Graphics Sep-Dec 2010 Tamara Munzner (guest lecturing) Lighting/Shading Lighting 2 Rendering Pipeline Geometry Database Model/View Transform. Lighting Perspective

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

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Shading, Advanced Rendering Week 7, Wed Feb 28 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 Reading for Today and Tomorrow

### Lighting/Shading I, II, III. Week 3, Tue May 24

University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Lighting/Shading I, II, III Week 3, Tue May 24 http://www.ugrad.cs.ubc.ca/~cs314/vmay2005 News P1 demos if you missed

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

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

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

### Page 1. News. Lighting/Shading I, II, III. Week 3, Tue May 24. Homework 2 Clarification. Clarification: N2D General Formulation. Reading: Next Time

University of British Columbia CSC 314 Computer Graphics May-June 2005 Tamara Munzner News 1 demos if you missed them 3:30-4:30 today Lighting/Shading I, II, III Week 3, Tue May 24 http://www.ugrad.cs.ubc.ca/~cs314/vmay2005

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ω

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

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

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

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

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

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

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

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

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

### Scan Conversion- Polygons

Scan Conversion- olgons Flood Fill Algorithm Chapter 9 Scan Conversion (part ) Drawing olgons on Raster Displa Input polgon with rasterized edges = (x,) point inside Goal: Fill interior with specified

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

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

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

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

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

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

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

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

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

### CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading Emmanuel Agu Recall: Setting Light Property Define colors and position a light GLfloat light_ambient[] = {0.0, 0.0, 0.0, 1.0}; GLfloat

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.

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

Illumination and Shading Illumination and Shading z Illumination Models y Ambient y Diffuse y Attenuation y Specular Reflection z Interpolated Shading Models y Flat, Gouraud, Phong y Problems CS4451: Fall

### Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej

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

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:

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

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

### How do we draw a picture?

1 How do we draw a picture? Define geometry. Now what? We can draw the edges of the faces. Wireframe. We can only draw the edges of faces that are visible. We can fill in the faces. Giving each object

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

### CEng 477 Introduction to Computer Graphics Fall

Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall 2007 2008 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated

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

Lecture 9 Graphics pipeline (rasterization and shading) Graphics pipeline - part 1 (recap) Perspective projection by matrix multiplication: x pixel y pixel z canonical 1 x = M vpm per M cam y z 1 This

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

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

### 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 & Shading Light Sources Empirical Illumination Shading Lecture 15 CISC440/640 Spring 2015 Illumination Models Computer Graphics Jargon: Illumination - the transport luminous flux from light

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

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

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

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

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

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

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

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

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

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

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

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

### Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

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

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

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

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

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

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

### Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong

### OpenGL Lighting Computer Graphics Spring Frank Palermo

OpenGL Lighting 15-462 Computer Graphics Spring 2009 Frank Palermo OpenGL is just a bunch of hacks. -Adrien Treuille What Adrien Means... What Adrien means is that OpenGL was designed to produce reasonable-looking

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

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

### 蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification

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

Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

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

Shading II 1 Objectives Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading Flat Smooth Gouraud 2 Phong Lighting Model A simple model

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

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,

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

CSE 167: Introduction to Computer Graphics Lecture #6: Colors Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Homework project #3 due this Friday, October 18

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

### Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

### Chapter 7 - Light, Materials, Appearance

Chapter 7 - Light, Materials, Appearance Types of light in nature and in CG Shadows Using lights in CG Illumination models Textures and maps Procedural surface descriptions Literature: E. Angel/D. Shreiner,

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

Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

### Shading. Brian Curless CSE 457 Spring 2017

Shading Brian Curless CSE 457 Spring 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 1: basics Christian Miller CS Fall 2011

Shading 1: basics Christian Miller CS 354 - Fall 2011 Picking colors Shading is finding the right color for a pixel This color depends on several factors: The material of the surface itself The color and

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

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

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

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

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