Lighting. Figure 10.1

Similar documents
Virtual Reality for Human Computer Interaction

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Shading I Computer Graphics I, Fall 2008

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Comp 410/510 Computer Graphics. Spring Shading

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

Shading. Why we need shading. Scattering. Shading. Objectives

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Illumination & Shading

CHAPTER5. We have learned to build three-dimensional graphical models and to LIGHTING AND SHADING

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Introduction to Computer Graphics 7. Shading

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Module 5: Video Modeling Lecture 28: Illumination model. The Lecture Contains: Diffuse and Specular Reflection. Objectives_template

CS452/552; EE465/505. Intro to Lighting

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

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

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

w Foley, Section16.1 Reading

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Illumination in Computer Graphics

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Visualisatie BMT. Rendering. Arjan Kok

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Why we need shading?

Illumination Models & Shading

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

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Reflection and Shading

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Shading. Brian Curless CSE 557 Autumn 2017

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Today we will start to look at illumination models in computer graphics

CEng 477 Introduction to Computer Graphics Fall

Illumination and Shading

CS 4600 Fall Utah School of Computing

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

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Lighting and Shading

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10

CS5620 Intro to Computer Graphics

CS 325 Computer Graphics

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

Ray Optics. Lecture 23. Chapter 34. Physics II. Course website:

Ray-Tracing. Misha Kazhdan

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Simple Lighting/Illumination Models

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Shading II. CITS3003 Graphics & Animation

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors

CSE 681 Illumination and Phong Shading

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

Virtual Reality for Human Computer Interaction

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

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

Raytracing CS148 AS3. Due :59pm PDT

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

CS 5625 Lec 2: Shading Models

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Understanding Variability

Lighting affects appearance

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

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

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Topics and things to know about them:

Sung-Eui Yoon ( 윤성의 )

Illumination & Shading: Part 1

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Illumination. The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Lighting affects appearance

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

Lecture 4: Reflection Models

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

At the interface between two materials, where light can be reflected or refracted. Within a material, where the light can be scattered or absorbed.

Chapter 32 Light: Reflection and Refraction. Copyright 2009 Pearson Education, Inc.

Interactive Real-Time Raycasting

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

Assignment 2 Ray Tracing

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Homework #2. Shading, Ray Tracing, and Texture Mapping

Photorealism: Ray Tracing

Supplement to Lecture 16

Transcription:

We have learned to build three-dimensional graphical models and to display them. However, if you render one of our models, you might be disappointed to see images that look flat and thus fail to show the three-dimensional nature of the model. This appearance is a consequence of our unnatural assumption that each surface is colored with a single color. Under this assumption, the orthographic projection of a sphere is rendered as a uniformly colored circle, and the rendering of a cube appears as a flat hexagon. If we look at a photograph of a lit sphere, we do not see a uniformly colored circle but rather a circular shape with many gradations or shades of color. It is these gradations that give two-dimensional images the appearance of being threedimensional. When we look at a point on an object, the color that we see is determined by multiple interactions among light sources and reflective surfaces. These interactions can be viewed as a recursive process. Consider the simple scene illustrated in Figure 10.1 Some light from the source that reaches surface A is scattered. Some of this reflected light reaches surface B, and some of it is then scattered back to A, where some of it is again reflected back to B, and so on. Figure 10.1 There are various approximate approaches, such as radiosity and ray tracing, each of which is an excellent approximation to the rendering equation for particular types of surfaces. We follow rays of light from light-emitting (or self-luminous) surfaces that we call light sources. There are two independent parts of the problem. First, we must model the light sources in the scene. Then we must build a reflection model that describes the

interactions between materials and light. To get an overview of the process, we can start following rays of light from a point source, as shown in Figure 10.2. Figure 10.2 Light and Surfaces Interactions : The interactions between light and materials can be classified into the three groups depicted in Figure 10.3. 1. Specular surfaces : appear shiny because most of the light that is reflected or scattered is in a narrow range of angles close to the angle of reflection. Mirrors are perfectly specular surfaces; the light from an incoming light ray may be partially absorbed, but all reflected light emerges at a single angle, obeying the rule that the angle of incidence is equal to the angle of reflection. 2. Diffuse surfaces : are characterized by reflected light being scattered in all directions. Walls painted with matte or flat paint are diffuse reflectors, as are many natural materials, such as terrain viewed from an airplane or a satellite. Perfectly diffuse surfaces scatter light equally in all directions and thus appear the same to all viewers. 3. Translucent surfaces : allow some light to penetrate the surface and to emerge from another location on the object. This process of refraction characterizes glass and water. Some incident light may also be reflected at the surface.

Figure 10.3 Light Sources : If we consider a source such as the one shown in Figure 10.4, we can look at it as an object with a surface. Each point (x, y, z) on the surface can emit light that is characterized by the direction of emission ( ) and the intensity of energy emitted at each wavelength. Thus, a general light source can be characterized by a six-variable illumination function I(x, y, z ), Figure 10.5. Figure 10.4 Figure 10.5 For most applications, we can thus model light sources as having three components red, green, and blue and can use each of the three color sources to obtain the corresponding color component that a human observer sees. Thus, we can describe a color source through a three-component intensity or illumination function:

1. Ambient Light In many situations, such as in classrooms or kitchens, the lights have been designed and positioned to provide uniform illumination throughout the room. Often such illumination is achieved through large sources that have diffusers whose purpose is to scatter light in all directions. We could create an accurate simulation of such illumination, at least in principle, by modeling all the distributed sources and then integrating the illumination from these sources at each point on a reflecting surface. We can look at the desired effect of the sources: to achieve a uniform light level in the room. This uniform lighting is called ambient light. Ambient light depends on the color of the light sources in the environment. For example, a red light bulb in a white room creates red ambient light. 2. Point Sources An ideal point source emits light equally in all directions. We can characterize a point source located at a point p0 by a three-component color function We use I (p0 ) to refer to any of the components. The intensity of illumination received from a point source located at p0 at a point p is proportional to the inverse square of the distance from the source. Hence, at a point p (Figure 10.6), any component of the intensity of light received from the point source is given by function of the form Figure 10.6

3. Spotlights Spotlights are characterized by a narrow range of angles through which light is emitted. We can construct a simple spotlight from a point source by limiting the angles at which light from the source can be seen. We can use a cone whose apex is at p s, which points in the direction Is, and whose width is determined by an angle, as shown in Figure 10.7. If = 180, the spotlight becomes a point source. Figure 10.6 4. Distant Light Sources Most shading calculations require the direction from the point on the surface to the light source position. As we move across a surface, calculating the intensity at each point, we should recompute this vector repeatedly a computation that is a significant part of the lighting calculation. However, if the light source is far from the surface, the vector does not change much as we move from point to point, just as the light from the sun strikes all objects that are in close proximity to one another at the same angle. Figure 10.7

LIGHT SOURCES IN OPENGL OpenGL supports the four types of light sources point, spotlight, ambient, and distant that we described previously and allows at least eight light sources in a program. Each must be individually specified and enabled. Although there are many parameters that must be specified, they are exactly the parameters required by the modified-phong lighting model. The OpenGL functions: Specify the required vector and scalar parameters, respectively. There are four vector parameters that we can set: the position (or direction) of the light source and the amount of ambient, diffuse, and specular light associated with the source. For example, suppose that we wish to specify the first source GL_LIGHTO and to locate it at the point (1.0, 2.0, 3.0). We specify its position as a point in homogeneous coordinates as follows : With the fourth component set to zero, the point source becomes a distant source with direction vector. For our single light source, if we want a white specular component and red ambient and diffuse components, we can use the following code:

Note that we must enable both lighting and the particular source. We can also add a global ambient term that is independent of any of the sources. For example, if we want a small amount of white light, even when all light sources are turned off or disabled, we can use the following code: