Size: px
Start display at page:

## Transcription

3

4

5

6

7 Physics

8 Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω i n: Surface normal L: Radiance ( intensity along a ray ) θ i ω

9 Light Events Reflection Refraction Bidirectional Reflectance Distribution Function (BRDF) Bidirectional transmittance Distribution Function (BTDF) Bidirectional Scattering Distribution Function (BSDF) Scattering Scattering Function

10 Rendering Equation Given any point xin a large environment, let L(x, ω) be the radiance along a ray, we have: f r (ω i,ω ) = dl(ω ) L(ω i )( ω i n)dω i L(x,ω ) = L e (x,ω ) + f r ( x,ω i,ω )L(x,ω i )( ω i n)dω i Ω Le: Emitted intensity (light source) Ω: A hemisphere over x θ i ω

11 Light Transport The rendering equation describes a light transport problem: Each point has an integral equation. Light can be reflected multiple times, so those integral equations are highly related. Solution: global illumination. Methods: ray tracing, radiosity.

12 Example: Caustics

13 Example: Color Bleeding

14 OpenGL Illumination Unfortunately, OpenGL doesn t support global illumination. Instead, it only considers local illumination: light can only be reflected once. Even for local illumination, OpenGL is not physically based. It only provides an approximation. To accurately get multiple reflections, you need to better rendering algorithms. You can approximate some global illumination effects using GPU programmable shaders.

15 OpenGL Illumination Light sources Surface material properties Surface normal Incoming (light) and outgoing (eye) directions

16 Point Light Source GLfloat light_position[] = {1.0, 1.0, 1.0}; gllightfv(gl_light0, GL_POSITION, light_position);

17 Directional Light Source GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0}; gllightfv(gl_light0, GL_POSITION, light_position);

18 Spot Light Source GLfloat light_position[] = {1.0, 1.0, 1.0}; gllightfv(gl_light0, GL_POSITION, light_position); Glfloat spot_position[] = {1.0, 1.0, 1.0}; gllightfv(gl_light0, GL_SPOT_DIRECTION, spot_position); Glfloat EXPONENT=10; gllightfv(gl_light0, GL_SPOT_EXPONENT, EXPONENT); Glfloat cutoff=30; gllightfv(gl_light0, GL_SPOT_CUTOFF, cutoff);

19 OpenGL Light Intensity OpenGL separates surface reflection into three components: Ambient Diffuse Specular Total Therefore, you should define three light intensities. Each of them contributes to a reflection component: Ambient Diffuse Specular

20 OpenGL Light Source //To specify the light position and intensity Glfloat LightPosition []={100, 0.0, 100}; Glfloat LightAmbient []={0.2, 0.2, 0.2}; Glfloat LightDiffuse []={1.0, 1.0, 1.0}; Glfloat LightSpecular []={0.4, 0.4, 0.4}; gllightfv(gl_light1, GL_POSITION, LightPosition); gllightfv(gl_light1, GL_AMBIENT, LightAmbient); gllightfv(gl_light1, GL_DIFFUSE, LightDiffuse); gllightfv(gl_light1, GL_SPECULAR, LightSpecular);

21 OpenGL Light Source For a point light source, the light intensity drops when the light moves away from the source. So OpenGL multiplies the intensity with an attenuation factor: attenuation = 1 A constant + da linear + d 2 A quadratic gllightf(gl_light0, GL_CONSTANT_ATTENUATION, 2.0); gllightf(gl_light0, GL_LINEAR_ATTENUATION, 1.0); gllightf(gl_light0, GL_QUADRATIC_ATTENUATION, 0.5);

22 Default Values No ambient Unit diffuse Unit specular Directional light along z No spot light No attenuation

23 Multiple Light Sources //Specify the position and properties for GL_LIGHT0 glenable(gl_light0); //Specify the position and properties for GL_LIGHT1 glenable(gl_light1); //Create other light sources here. glenable(gl_lighting); //You can turn on and off lights like this: gldisable(gl_light0); glenable(gl_light0); gldisable(gl_lighting); glenable(gl_lighting);

24 OpenGL Light Source The light source is subject to the MODELVIEW matrix as well. You can create the light source in the eye space, so it always attached to the camera. You can create the light source after camera motion, so it is fixed in the world space. You can even apply extra transformation/animation to light source.

25 OpenGL Material OpenGL separates surface reflection into three components: Ambient Diffuse Specular Total Therefore, you should define three material properties. Each of them contributes to a reflection component: Ambient Diffuse Specular

26 Ambient Reflection Ambient Light L ambient = I ambient K ambient Ambient Radiance (Pixel Intensity) Ambient Surface Material Coefficient The object will have a uniform color. It looks similar to the result without lighting. The color is not directly assigned. It s controlled by the light source and surface reflection coefficient.

27 Diffuse Reflection Diffuse reflection assumes that the light is equally reflected in every direction. In other words, if the light source and the object has fixed positions in the world space, the camera motion doesn t affect the appearance of the object. The reflection only depends on the incoming direction. It is independent of the outgoing (viewing) direction. Real objects with only a diffuse reflection property are called: Lambertian Surfaces, for example, clay.

28 Diffuse Reflection Lambert s law says that the outgoing radiance depends on the cosine of the incident angle. Because the irradiance (photons per unit surface area) becomes smaller (as in the rendering function before). da da θ i da da/cosθ i

29 Diffuse Reflection Diffuse Light L diffuse = I diffuse K diffuse cosθ i Diffuse Radiance Diffuse Surface Material Coefficient θ i Brighter Darker

30 An Example Kdiffuse Kambient

31 Specular Reflection Some materials, such as plastic and metal, can have shiny highlight spots. This is due to a glossy mirrorlike reflection. Materials have different shininess/glossiness.

32 Specular Reflection For a mirror, the light is reflected into a single direction. θ i N θ i Specular reflection assumes that the glossy surface is not even, so the light is reflected into a small cone. N If your viewing direction is close to the mirror direction, you receive high radiance. θ i ϕ

33 Specular Reflection Given L, N and V, we first calculate the mirror reflection direction: R=2(L N)N-L Then we have: L specular = I specular K specular cos n φ ϕ is the angle between V and R. cosφ = V R n indicates surface shininess. L θ i N ϕ V R

34 An Example K specular Shininess n

35 Total Reflection Illumination from a single light source i: L ambient = I ambient K ambient L diffuse = I diffuse K diffuse cosθ i L specular = I specular K specular cos n φ i L total i = L ambient i + L diffuse i + L specular Illumination from multiple light source: 0 L total = L globalamibient + L total 1 + L total 2 + L total +L

36 OpenGL Material OpenGL defines material properties like this: glmaterialfv("face, "property, value ) Face: GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK Property: GL_AMBIENT, GL_DIFFUSE, Value: A vector array

37 For Example Glfloat mat_amb_diff[]={1.0, 0.5, 0.8, 10.0}; Glfloat mat_specular[]={1.0, 1.0, 1.0, 1.0}; Glfloat shiniess []={5.0}; glmaterialfv(gl_front, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff); glmaterialfv(gl_front, GL_SPECULAR, mat_specular); glmaterialfv(gl_front, GL_SHININESS, shininess); Specular highlights are usually in the light source s color. Ambient and diffuse can be defined together or separately. If you don t mind dark shadow, just ignore ambient. Shininess is from 0 (dull) to 128 (shiny).

38 Light Model gllightmodelfv(property, value); Enable two sided lighting Property=GL_LIGHT_MODEL_TWO_SIDE If value=0, only GL_FRONT is rendered; If value=1, both GL_FRONT and GL_BACK are rendered Global ambient color Property=GL_LIGHT_MODEL_AMBIENT Value is a color array And more

39 Surface Normal Normals are used in calculating reflection. Normals are also used to decide the surface front and back side. (x, y, z) It s normal is normalized(x, y, z) E 20 =V 2 -V 0 N = E 10 E 20 E 10 E 20 V 2 V 0 E 10 =V 1 -V 0 V 1

40 Surface Normal We can define a triangle normal for the whole triangle. The result is a surface made of triangles. for(int i=0; i<t_number; i++) { glnormal3f( ); glbegin(gl_triangles); glvertex3f( ); glvertex3f( ); glvertex3f( ); glend(); }

41 Surface Normal But the mesh represents a smooth surface. We define a normal for each vertex, by taking the normalized average of its adjacent triangle normals. for(int i=0; i<t_number; i++) { glbegin(gl_triangles); glnormal3f( ); //XN0 glvertex3f( ); //X0 glnormal3f( ); //XN1 glvertex3f( ); //X1 glnormal3f( ); //XN2 glvertex3f( ); //X2 glend(); }

42 Lighting and Shading Each pixel corresponds to a visible 3D point. We need to calculate the pixel intensity for that 3D point, based on the reflection model. Given a 2D Pixel Location Inverse Projection Selection Ray Intersection Test A 3D point on a primitive Reflection Calculation Ray Tracing Given a 3D primitive Projection A 2D primitive Rasterization ti A number of pixels The Graphics Pipeline

43 Lighting and Shading OpenGL does reflection calculation only for each vertex (unless using GPU shaders). Given a 3D primitive Projection A 2D primitive (with 3D info) Rasterization A number of pixels (with 3D info) Fragment Shader Pixels with intensities OpenGL + GPU Given a 3D polygon Lighting A 3D polygon, with intensity info Projection A 2D polygon, with intensity info Interpolation/Raserization Pixels with intensities OpenGL

44 OpenGL Shading Now given a 2D polygon with intensity information on each vertex, how to get the value for each pixel? Flat shading Gouraud Shading* Phong Shading* Given a 3D polygon Lighting A 3D polygon, with intensity info Projection A 2D polygon, with intensity info Interpolation/Raserization Pixels with intensities *: Both were proposed by researchers at the University of Utah in 1970s.

45 Flat Shading Flat shading uses one vertex information for the whole primitive. glshademodel(gl_flat) What s the difference? Vertex Normal + Flat Shading Triangle Normal + Smooth Shading

46 Flat Shading VS. Smooth Shading Flat shading has this discontinuous artifact. This is fast, since only needs one calculation per polygon. Only useful when the polygons are very small. Smooth shading avoid the discontinuous artifact. Slower More realistic.

47 Smooth Shading OpenGL uses a smooth Gouraud shading technique. The basic idea is to calculate the color intensity at each vertex, and then interpolate over the polygon. To use smooth shading: glshademodel(gl_smooth) Vertex Normal + Flat Shading Vertex Normal + Smooth Shading

48 Review: Linear Interpolation Given a line segment with two end points (P and Q) and a sample point R, we can interpolate a value function V over the line as: V r = Q R V p + P R V q P Q V p P V r =? R V q Q

49 OpenGL Interpolation OpenGL does 2D interpolation in a scanline way. The result is identical to the interpolation using barycentric coordinates. But the scanline method is faster. Why? For every scanline

50 Gouraud Shading Gouraud shading calculates the color per vertex. It has artifacts too. To solve it, use smaller polygons. dark dark dark dark or bright? dark

51 Phong Shading Instead of interpolating the color (light intensity), Phong shading interpolates surface normals, and then calculates the 3D reflection per 2D pixel. OpenGL doesn t support it, since 3D information needs to be carried through the whole pipeline. GPU supports it. You can use OpenGL shading language (GLSL). It s still under the projection+scanline framework, but its result is comparable to ray tracing. Flat Shading Gouraud Shading Phong Shading

52 Summary The projection+scanline graphics pipeline is also called rasterization based rendering. Examples: OpenGL, Pixar Renderman, GPU Fast, but difficult to handle global illumination Widely used in games Alternatively, ray tracing is based on the inverseprojection+ray intersection framework Examples: POV Ray, new Pixar Renderman, PBRT Slow, but handles global illumination Used for offline rendering, such as movie effects

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

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

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

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

### CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

http://www.ann.jussieu.fr/~frey/papers/scivi/cook%20r.l.,%20a%20reflectance%20model%20for%20computer%20graphics.pdf CS 148, Summer 2012 Introduction to Computer Graphics and Imaging f(~v 2 ) A 3 A 1 f(~v

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

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

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

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

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

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.

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

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:

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

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

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

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

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

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

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

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

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

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

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

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

### Surface Rendering Methods

Surface Rendering Methods 6 th Week, 2008 Sun-Jeong Kim Polygon Rendering Methods Determining the surface intensity at every projected pixel position using an illumination model Light-material interactions

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

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

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

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

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

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

### 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! The illumination can be computed either at vertices or

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

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

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

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

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

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week 7, Wed Mar 3 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 reminders News don't need to tell

### CS 4600 Fall Utah School of Computing

Lighting CS 4600 Fall 2015 Utah School of Computing Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

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

### TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

1(84) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(84) Lecture 5 3D graphics part 3 Illumination Illumination applied: Shading Surface detail: Mappings

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

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

### 6. Illumination, Lighting

Jorg s Graphics Lecture Notes 6. Illumination, Lighting 1 6. Illumination, Lighting No ray tracing in OpenGL! ray tracing: direct paths COP interreflection: soft shadows, color bleeding. umbra, penumbra,

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

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

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

### Final Project: Real-Time Global Illumination with Radiance Regression Functions

Volume xx (200y), Number z, pp. 1 5 Final Project: Real-Time Global Illumination with Radiance Regression Functions Fu-Jun Luan Abstract This is a report for machine learning final project, which combines

### Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Global Illumination CS334 Daniel G. Aliaga Department of Computer Science Purdue University Recall: Lighting and Shading Light sources Point light Models an omnidirectional light source (e.g., a bulb)

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

### Display Issues Week 5

CS 432/637 INTERACTIVE COMPUTER GRAPHICS Display Issues Week 5 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives Consider

Lighting and Shading Today: Local Illumination Solving the rendering equation is too expensive First do local illumination Then hack in reflections and shadows Local Shading: Notation light intensity in,

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

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

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

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

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

### Objectives. Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out

Objectives Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out 1 Steps in OpenGL shading Enable shading and select

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

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

### S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T Copyright 2018 Sung-eui Yoon, KAIST freely available on the internet http://sglab.kaist.ac.kr/~sungeui/render

### INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

INFOGR Computer Graphics J. Bikker - April-July 2016 - Lecture 10: Shading Models Welcome! Today s Agenda: Introduction Light Transport Materials Sensors Shading INFOGR Lecture 10 Shading Models 3 Introduction

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

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

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

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

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

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

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

### Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Computation of Vectors To calculate

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