Lighting and Shading (I)

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

OpenGL Course Notes Chapter 5: Lighting Jim Mims, Spring 2009.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Light Issues in Computer Graphics Presented by Saleema Amershi.
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
Lighting and Shading Wen-Chieh (Steve) Lin
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
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 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.
Illumination.
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 Lighting.
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.
19/17/ :25 UML Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic.
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.
Basic Illumination BRANCH :- ELECTRICAL (C11) Gohil Amit M. ( ) Joshi Jay P. ( ) Barot Mahesh P. ( ) Pandya Bhrugu I.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Advanced Illumination Models Chapter 7 of “Real-Time Rendering, 3 rd Edition”
Illumination.
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.
Local Illumination and Shading
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.
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi
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 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.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
Unit-7 Lighting and Shading
CSE 470 Introduction to Computer Graphics Arizona State University
Fundamentals of Computer Graphics Part 6 Shading
Isaac Gang University of Mary Hardin-Baylor
Chapter IX Lighting.
Illumination and Shading
Advanced Computer Graphics
CS 480/680 Computer Graphics Shading.
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Presentation transcript:

Lighting and Shading (I) 姜明 北京大学数学科学学院 Based on [EA], Chapter 5. 更新时间2019年4月11日星期四6时7分19秒

Why Shading? What we have left out is the interaction between light and the surfaces in our graphics models. Without this interaction, we can only generate images that look flat and fail to show the 3D presentation. A real photo of a lit sphere has many gradations or shades of color, which shows an appearance of being 3D. Our aim is to add shading to a fast pipeline graphics architecture. Shading: 明暗处理,明暗模型,光照模型。

Outline Light and Matter Light Sources The Phong Reflection Model

As in all wave theories of light, the elementary process which produces the optical impression is regarded as being a harmonic wave in space-time (studied in its simplest form in [Born and Wolf, 1999,§ 1.3 and 1.4]). If its frequency is in the range from 4×1014s−1 to 7.5×1014s−1 (approximately) it gives raise to the psychological impression of a definite color. The opposite, however, is not true: colored light of a certain subjective quality may be a composition of harmonic waves of very difference frequency distributions. The actual connection between color and frequency is very involved and will not be studied here, c.f. [Born and Wolf, 1999, § 4.8.1]. Born, M. and Wolf, E. (1999). Principles of Optics. Cambridge University Press, 7th edition.

Light and Matter Radiosity (rendering in [EA]) equation based on conservation of light energy reflected among surfaces, [HA, Section 14.7]. This is an integral equation, which we could use to find the shading of all surfaces in a scene. Ray tracing [HA, Section 14.6]. Unfortunately, neither radiosity or ray tracing can be used to render scene at the rate at which we can pass polygons through the modeling-projection pipeline.

Two independent parts of the problem We follow rays of light from light-emitting (or self-luminous) surfaces (light sources). We model what happens to these rays as they interact with reflecting surfaces in the scene. This is similar to ray tracing, but we consider only single interactions between light sources and surfaces. If a ray of light enters her eye directly from the source, she sees the color of the source. If the ray of light hits a surface that is visible to our viewer, the color she sees is based on the interaction between the source and the surface material. Two independent parts of the problem Model of light sources. Reflection model. In terms of computer graphics, we replace the viewer by the projection plane.

Light and Matter Interactions Specular Surface Diffuse Translucent (半透明) Note: Any given surface can have some of all three properties. http://www.comp.hkbu.edu.hk/~sci3750/lect7-02.ppt

Light Sources A general light source can be characterized by a six-variable illumination function. A physically “correct” model can be complex. For most applications, we use a model that leads to efficient computations, especially when we use it with the pipeline rendering architecture.

Several Basic light Sources Color Sources Ambient Light Point Sources Spotlights Distant Light Sources

Color Sources Our model of the human visual system is based on the three-color theory. We perceive three primaries, rather than a full color distribution. For most applications, we can thus model light sources as having three components – red, green and blue – that a human observer sees. We describe a source through a three-component intensity of luminance function. Each of the components is the intensity of the independent red, green, and blue components. Color-light computation involves three similar but independent calculations. We can use a single scalar equation to represent any of the three color components.

Ambient Light It represents uniform illumination through the scene. Such illumination is achieved through large sources that have diffusers whose purpose is to scatter light in all directions. It can be computed through a complicated physics model. We can postulate an ambient intensity at each point in the environment. Thus, ambient illumination is characterized by an intensity that is identical at every point in the scene.

Point Sources An ideal point source emits light equally in all directions. We can model a point source located at a point by a three-component color vector. The intensity of illumination received from a point source is proportional to the inverse square of the distance between the source and surface.

Scenes rendered with only point sources tend to have high contrast. We can reduce (mitigate) the high-contrast effect from point source illumination by adding ambient light to a scene. Shadows created by a source of finite size. The distance term also contributes to the unpleasantly rough (harsh) rendering with point sources. The inverse-square law is replaced by another formulae.

Spotlights Spotlights are characterized by a narrow range of angles through which light is emitted. We can constructed a simple spotlight from a point source by limiting the angles at which light from the source can be seen – a cone. The distribution of light within the cone is a function of the angle between the direction of the source ls and the direction s from the source to a point on a surface. This function is usually defined as the exponential of the cosine.

Distant Light Sources If the light source is far from the surface, the direction vector from the source to each point on the surface does not change much as we move from point to point. Light from the sun, a parallel source. In OpenGL, a distant light source is described by a direction vector in homogenous coordinates.

The Phong Reflection Model It is efficient, close enough to physical reality to produce good rendering under a variety of lighting conditions and material properties. It supports three types of material-light interactions – ambient, diffuse and specular.

Suppose we a set of point sources. Each source can have separate ambient, diffuse, and specular components for each of the three primary colors. Although this assumption may appear unnatural, we can use it to create realistic shading effects efficiently. We use a local model to simulate effects that can be global in nature. We need 9 parameters to characterize the i-th light source. The distance-attenuation terms have not been applied.

The contribution from each source to a point is by adding the ambient, diffuse and specular contributions. The total intensity is by adding the contributions from all sources and, possibly, a global term. The computations are the same for each source and for each primary color.

Ambient Reflection The intensity of ambient light is the same at each point of the surface. Some of the light is absorbed, and some is reflected. The amount reflected is given by the ambient reflection coefficient,

Diffuse Reflection A perfectly diffuse Surface: Light is reflected equally in all directions. Diffuse The amount of light reflected depends on the material and on the direction of the light relative to the surface. There is no preferred angle of reflection. It appears the same to all viewers. Such surfaces, called Lambertian surfaces, can be modeled mathematically with Lambert’s law.

Illustration of Lambert’s law Total light source energy=E The surface is brightest at noon and dimmest at dawn, because the same amount of light is spread over a larger area and the surface appears dimmer. Lambert’s law: we see only the vertical component of the incoming light. http://www.comp.hkbu.edu.hk/~sci3750/lect7-02.ppt

Specular Reflection Surfaces will look dull with only ambient and diffuse reflections. We need the highlights reflected from shiny objects. When the surface gets smoother, the reflected light is concentrated in a smaller range of angles, centered about the angle of a perfect reflector. Smooth Surface: Light is reflected at an angle near to the incident angle. Specular

Phong proposed an approximate model. For a specular surface, most light is reflected around vector r, corresponding to a reflected angle equal to the angle of incidence. If f is the angle between v and r, The exponent is a shininess coefficient. is the fraction of incoming specular light that is reflected. Large Small

The Shininess Coefficient Values of a between 100 and 200 correspond to metals Values between 5 and 10 give surface that look like plastic cosa f f 90 -90 cosa f f 90 -90

Vectors Used by Phong Lighting Model p is an arbitrary point on a surface. n is the unit normal to the surface at p. l is a unit vector in the direction of the light source. r is a unit vector in the direction of a perfectly (specular) reflection v is a unit vector in the direction of the viewer.

The Complete Phong Model Specular term Diffuse term Ambient term Distance term You can try out the Lighting Applet to see the effect of Phong shading http://www.comp.hkbu.edu.hk/~sci3750/lect7-02.ppt

Illustration of Diffuse Reflection Patrick Min (min@cs.princeton.edu), http://www.cs.princeton.edu/~min/cs426/light.html

Illustration of Specular Reflection Patrick Min (min@cs.princeton.edu), http://www.cs.princeton.edu/~min/cs426/light.html

Illustration of the Complete Phong Model Patrick Min (min@cs.princeton.edu), http://www.cs.princeton.edu/~min/cs426/light.html