Chapter IX Lighting.

Slides:



Advertisements
Similar presentations
SI23 Introduction to Computer Graphics
Advertisements

5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
Computer Vision Radiometry. Bahadir K. Gunturk2 Radiometry Radiometry is the part of image formation concerned with the relation among the amounts of.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Computer Graphics - Class 10
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Course Website: Computer Graphics 16: Illumination.
Lighting & Shading.
LIGHTING Part One - Theory based on Chapter 6. Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
LIGHTING JEFF CHASTINE 1. WHAT IS LIGHT? A very complex process Find a dark area – how is it being lit? Light bounces (mirrors, shiny objects) Light refracts.
CS 445 / 645: Introductory Computer Graphics
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
CSE 381 – Advanced Game Programming GLSL Lighting.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim.
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Unit-7 Lighting and Shading
School of Computer Science
Lighting.
Chapter IX Bump Mapping
Chapter V Illumination and Shaders
Chapter XVI Texturing toward Global Illumination
Lighting – Light Sources
Isaac Gang University of Mary Hardin-Baylor
Chapter XIV Normal Mapping
ICG 2018 Fall Homework1 Guidance
Advanced Computer Graphics
Simple Illumination CSE 681.
Computer Graphics Material Colours and Lighting
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Presentation transcript:

Chapter IX Lighting

Phong Lighting Model Lighting or illumination refers to the technique that handles the interaction between lights and objects. The most popular lighting method is based on the Phong model. It is widely adopted in commercial games and lays foundations of various advanced lighting techniques. The Phong model is composed of four terms: diffuse specular ambient emissive

Phong Lighting Model - Diffuse Term There can be various light types such as point and directional light sources. For now let’s take the simplest, the directional light source, where the light vector (l) is constant for a scene. The diffuse term is based on Lambert's law. Reflections from ideally diffuse surfaces (Lambertian surfaces) are scattered with equal intensity in all directions. So, the amount of perceived reflection is independent of the view direction, and is just proportional to the amount of incoming light.

Phong Lighting Model - Diffuse Term (cont’d) Suppose a white light (1,1,1). If an object lit by the light appears yellow, it means that the object reflects R and G and absorbs B. We can easily implement this kind of filtering through material parameter, i.e., if it is (1,1,0), then (1,1,1)(1,1,0)=(1,1,0) where  is component-wise multiplication. The diffuse term: In general, the texture provides md. R G B R G B intensity 1 1 1 intensity .5 .5 .5 1x1=1 1x1=1 1x0=0 .5x.5=.25 .5x1=.5 .5x.5=.25 (1,1,0) (.5,1,.5)

Phong Lighting Model - Specular Term The specular term is used to make a surface look shiny via highlights, and it requires view vector (v) and reflection vector (r) in addition to light vector (l). Computing the reflection vector

Phong Lighting Model - Specular Term (cont’d) Whereas the diffuse term is view-independent, the specular term is highly view-dependent. For a perfectly shiny surface, the highlight at p is visible only when  equals 0. For a surface that is not perfectly shiny, the maximum highlight occurs when  equals 0, but falls off sharply as  increases. The rapid fall-off of highlights is often approximated by (rv)sh, where sh denotes shininess. The specular term: Unlike md, ms is usually a gray-scale value rather than an RGB color. It enables the highlight on the surface to end up being the color of the light source. cosρ cos2ρ cos64ρ

Phong Lighting Model – Ambient and Emissive Terms The ambient light describes the light reflected from the various objects in the scene, i.e., it accounts for indirect lighting. As the ambient light has bounced around so much in the scene, it arrives at a surface point from all directions, and reflections from the surface point are also scattered with equal intensity in all directions. The last term of the Phong model is the emissive term me that describes the amount of light emitted by a surface itself.

Phong Lighting Model The Phong model sums the four terms!!

Per-fragment Lighting Consider two points on an object's surface, each of which makes up a distinct fragment. The fragment shader computes lighting using l, n, r, and v. Since we assume a directional light, l is constant for all surface points. It is provided for the fragment shader as a uniform. In contrast, n, r, and v vary across the object's surface. A distinct pair of n and v is given to each execution of the fragment shader, which then computes r (r=2n(n·l)-l).

Per-fragment Lighting (cont’d) Because l is a world-space vector, n should also be defined in the world space. For this, the vertex shader world-transforms the object-space normal of each vertex and passes the world-space normal to the rasterizer. The rasterizer interpolates the vertex normals to provide n for each fragment. To a and b, each of which is assumed to make up a distinct fragment, the rasterizer assigns normals, na and nb, by interpolating n1 and n2.

Per-fragment Lighting (cont’d) For the fragments, a and b, we also need world-space view vectors denoted by va and vb, respectively. For this, the vertex shader transforms the object-space position of each vertex to the world space and connects it to the camera position, EYE, defined in the world space. The per-vertex world-space view vectors are v1 and v2. They are passed to the rasterizer and interpolated to produce va and vb.

Per-fragment Lighting (cont’d) Given n and v provided by the rasterizer and l provided as a uniform by the GL program, the fragment shader first computes the reflection vector, i.e., r=2n(n·l)-l, and finally implements the Phong model. Note that l, n, r, and v are all defined in the world space..

Per-fragment Lighting The vertex shader.

Per-fragment Lighting (cont’d) The fragment shader.

Per-fragment Lighting (cont’d) The fragment shader.