Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.

Slides:



Advertisements
Similar presentations
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Advertisements

Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
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
Illumination Model & Surface-rendering Method 박 경 와.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Computer Graphics - Class 10
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
SET09115 Intro Graphics Programming
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
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.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
19/17/ :25 UML Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
Computer Graphics I, Fall 2010 Shading in OpenGL.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
Lecture 9: Lighting and Shading 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
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
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
Lighting and Shading Part 2. Global Ambient Light There are at least 8 OpenGL lights and 1 Global Ambient Setting the Global Ambient globalAmbient[] =
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
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
Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics.
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
Chapter 14 Shading Models.
CSE 470 Introduction to Computer Graphics Arizona State University
Isaac Gang University of Mary Hardin-Baylor
Computer Graphics 4Practical Lesson
Illumination and Shading
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Computer Graphics (Fall 2003)
Chapter 14 Shading Models.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Computer Graphics Shading in OpenGL
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science
Lighting Calculations
Presentation transcript:

Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College PowerPoint Instructor’s Resource

Lighting and Shading Making images with a more naturalistic appearance

Two Parts to This Chapter Lighting –Defining lights and materials to compute the colors for objects Shading –Defining how colors change across a polygon as it is displayed

Lighting Model We will use the local lighting model: all light comes from lights defined within the scene Light is seen to have three components: –Ambient light –Diffuse light –Specular light All light uses the RGB color model

Ambient Light This is light that is simply present in the scene, without reference to any source Ambient light models the overall light that is reflected among objects It is represented by a simple color value

Diffuse Light Diffuse light is light that comes directly from a light source and is then sent to the viewer by the object Its color depends on the nature of the object –The light is absorbed by the object’s material and only certain wavelengths are re-radiated

Specular Light Specular light is light that is reflected from a light source directly by an object It does not interact with the object and is generally the color of the light source The main characteristic of specular light is that it makes things look shiny

Each Light Has a position in space Has a color for each kind of light –Ambient color –Diffuse color –Specular color May have other properties –Spotlight –Directional light

Light Processes -- Ambient Light is simply present but involves objects Total ambient light A is a scene-defined ambient value L 0 plus the sum of the individual ambient lights Individual light contributions come from ambient light L A and material ambient value C A

Light Processes -- Diffuse Diffuse light depends on the direction of light because of area seen by light

Light Processes -- Diffuse (2) The area visible to light depends on the cosine of the angle to the light -- the dot product of the light and normal vectors The eye direction does not matter! With light diffuse value L D and materials diffuse value C D total diffuse light D is given by

Light Processes -- Specular Specular light depends on the angle between the eye and the reflection of a light

Light Processes -- Specular (2) Specular light also depends on the shininess M of the surface; this is modeled by a cosine function Since the cosine is the dot product ER, for light specular value L S, material value C S, and material shininess M, we have

Colored Lights A white cube, shown with three lights of different colors, illustrates how the light determines the color

Normals Normals are part of the geometry in the scene graph shape node Can be computed as the cross product of two adjacent edges If several polygons meet at a vertex, the normals for each polygon can be averaged Normals can also be computed exactly from directional derivatives if the object geometry is analytic

Effect of Shininess Higher values of the shininess coefficient M lead to smaller and brighter shiny spots From lower (left) to higher(right) values, we have

Defining Materials To define the material properties for your objects, you simply define the color for each lighting component and the value of the shininess These are all RGBA colors Materials are part of the appearance in the shape node

How Do You Use Lighting? In order to use lighting, you must have two things –You must have normals for each vertex of your objects –You must define the material for each object When you enable lighting, the lighting calculations we saw above will be done to create the color for each object

Light Properties Position - point in space Color - RGB values for each light component Directional (option) - direction of light Spotlight (option) - direction and cutoff Attenuation (option) - dropoff of values with distance

Lights in the Scene Graph As far as the scene graph is concerned, a light is just another piece of geometry However, the position and direction of a light are affected by any transformations in effect when they are set, so the usual practice is to define lights at the top of the scene graph, before any modeling transformations

Lights and Visual Communication You can enable or disable lights as you want to provide emphasis or to show things in different ways

Lights and Visual Communication (2) Using lighting can be effective in communicating information, as this lighted map of South Africa shows

Shading Computing the color of each part of a graphic object, especially a polygon We have properties at each vertex, and shading uses these to compute the color at each pixel in the object OpenGL offers only flat and smooth shading Other kinds are possible with more work

Flat and Smooth Shading Flat shading simply applies a single color to an entire polygon –Color can be set or can be computed from shading Smooth shading interpolates vertex colors across the polygon –Vertex colors can be set or computed

Shading Examples Flat shading on each polygon Smooth shading on each polygon

Shading Tradeoff Smooth shading on larger polygons vs flat shading on smaller polygons Tradeoff is both time and appearance

Other Shading Models Phong shading: interpolate the normals across a polygon and compute the color for each pixel directly Smooth (left) and Phong (right) compared

Anisotropic Shading Our original lighting model required that the reflection was the same in all directions In some real materials it is not, and anisotropic shading deals with that

Other Techniques Bump mapping

Global Illumination For simple computer graphics, we usually only deal with local illumination and let all light come only from lights Global illumination considers not only how light comes into a scene, but also how light is reflected within a scene More complex, but more realistic Two main algorithms: radiosity and photon mapping

A Radiosity Example

A Photon Mapping Example