Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi

Slides:



Advertisements
Similar presentations
Computer Graphics I, Fall 2010 Shading II.
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
CS 480/680 Computer Graphics Shading 2 Dr. Frederick C Harris, Jr.
Local Reflection Model Jian Huang, CS 594, Fall 2002.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
Torrance Sparrow Model of Reflectance + Oren Nayar Model of Reflectance.
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
University of Texas at Austin CS395T - Advanced Image Synthesis Spring 2006 Don Fussell Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular.
Rendering (彩現 渲染).
Shading II CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
IMGD 1001: Illumination by Mark Claypool
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
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.
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,
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.
CS 445 / 645: Introductory Computer Graphics
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
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.
Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.
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.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
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.
Advanced Illumination Models Chapter 7 of “Real-Time Rendering, 3 rd Edition”
Diffuse Reflections from Rough Surfaces Lecture #5
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.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi Guest Lecturer: Aner Benartzi.
02/2/05© 2005 University of Wisconsin Last Time Reflectance part 1 –Radiometry –Lambertian –Specular.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
COMPUTER GRAPHICS CS 482 – FALL 2015 OCTOBER 27, 2015 SCATTERING LIGHT SCATTERING PHYSICALLY BASED SCATTERING SUBSURFACE SCATTERING AMBIENT OCCLUSION.
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
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
Physically-based Illumination Models (2) CPSC 591/691.
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
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
Computer Graphics Lecture 26 Mathematics of Lighting and Shading Part II Taqdees A. Siddiqi
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular model
CSE 470 Introduction to Computer Graphics Arizona State University
Isaac Gang University of Mary Hardin-Baylor
Computer Graphics Material Colours and Lighting
CS 480/680 Computer Graphics Shading.
Presentation transcript:

Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi

The Phong’s Specular Light Equation

Phong's equation for specular lighting is

The more the view direction, v, is aligned with the reflection direction, r, the brighter the specular light will be. Note the introduction of the ms term (shininess value), which is a power term that attempts to approximate the distribution of specular light reflection.

This can be seen in the next Figure, which shows values of for values of ‘m’ ranging from 1 to 128. As we can see, the specular highlights get narrower for higher values, but they don't get any brighter.

Figure: Phong's specular term for various values of the "shininess" term. Note that the values never get above 1.

To calculate r we can use the following equation: f l and n are normalized, then the resulting r is normalized and the equation can be simplified as:

And just as we did for diffuse lighting, if the dot product is negative, then the term is ignored.

Figure: A specular term just shows the highlights.

The Lighting Equation

Now that we have computed the various light contributions to our final color value, we can add them up to get the final color value.

Note that the final color values will have to be made to fit in the [0,1] range for the final rgb values.

Our final scene with ambient, diffuse, and specular light contributions (with one white light above and to the left of the viewer) looks like Figure 1.

Figure 1: A combination of ambient, diffuse, and specular illumination.

Next we will discuss some refinements and alternative ways of calculating the various coefficients of the lighting equation.

Light Attenuation

Light in the real world loses its intensity as the inverse square of the distance from the light source to the surface being illuminated

An empirical model was developed that seems to give satisfactory results. This is the attenuation model that's used in OpenGL and DirectX

The attenuation factor is calculated by the following equation:

The fatten factor is the attenuation factor. The distance d between the light and the vertex is always positive.

where the kc, kl, and kq parameters are the constant, linear, and quadratic attenuation constants, respectively

The lighting equation with the attenuation factor looks like this.

Figure 2 shows a sample of what attenuation looks like. This image is the same as the one shown in Figure 1, but with light attenuation added.

Figure 2: A scene with light attenuation. The white sphere is the light position.

Schlick's Simplification for the Specular Exponential Term

Real-time graphics programmers are always looking for simplifications. We’ve probably gathered that there's no such thing as the "correct" lighting equation, just a series of hacks to make things look right with as little computational effort as possible

Schlick [SCHLICK 1994] suggested a replacement for the exponential term since that's a fairly expensive operation. If we define part of our specular light term as follows:

where S is either the Phong or Blinn-Phong flavor of the specular lighting equation, then Schlick's simplification is to replace the preceding part of the specular equation with:

which eliminates the need for an exponential term. At first glance, a plot of Schlick's function looks very similar to the exponential equation (Figure 3).

Figure 3: Schlick's term for specular looks very much like the more expensive Phong term.

Schlick's simplification works. The blue values are Schlick's, and the red are the exponential plot. As the view and light angles get closer (i.e., get closer to zero on the x axis), we can see that the values of the curves are quite close.

Figure 4: Schlick's vs. Phong's specular terms.

Oren—Nayar Diffuse Reflection

One of the problems of the standard Lambertian model is that it considers the surface as a smooth diffuse surface.

The classic example of this is a full moon.

it's pretty obvious that this doesn't follow the Lambertian distribution—if it did, the edges of the moon would be in near darkness

Figure 5: The full moon is an good example of something that doesn't show Lambertian diffuse shading.

The effect we're looking at is called backscattering.

Backscattering is when a rough surface bounces around a light ray and then reflects the ray in the direction the light originally came from

Note that there is a similar but different effect called retroreflection

Retroreflection is the effect of reflecting light towards the direction from which it came, no matter the orientation of the surface

This is the same effect that we see on bicycle reflectors. However, this is due to the design of the surface features (made up of vshaped or spherical reflectors) rather than a scattering effect.

when the light direction is closer to the view direction, we get the effect of forward scattering

Forward scattering is just backscattering from a different direction

Figures 6 and 7 show the same surfaces demonstrating backscattering and forward scattering.

Both the dirt field in Figure 6 and the soybean field in Figure 7 can be considered rough diffuse reflecting surfaces.

Figure 6: The same dirt field showing widely differing reflection properties.

Figure 7: A soybean field showing differing reflection properties.

Notice how the backscattering image shows a near uniform diffuse illumination, whereas the forward scattering image shows a uniform dull diffuse illumination.

The Oren—Nayar diffuse shading model looks like this.

Where

ρ/π is a surface reflectivity property, which we can replace with our surface diffuse color. E0 is a light input energy term, which we can replace with our light diffuse color.

And the θi term is just our familiar angle between the vertex normal and the light direction. Making these exchanges gives us

which looks a lot more like the equations we've used. There are still some parameters to explain.

σ is the surface roughness parameter. It's the standard deviation in radians of the angle of distribution of the microfacets in the surface roughness model. The larger the value, the rougher the surface.

θr is the angle between the vertex normal and the view direction.

φr - φi is the circular angle (about the vertex normal) between the light vector and the view vector.

α is max(θi, θr). β is min (θi, θr).

Note that if the roughness value is zero, the model is the same as the Lambertian diffuse model. Oren and Nayar also noted that we can replace the value 0.33 in coefficient A with 0.57 to better account for surface interreflection.

RECAP Phong's equation for specular lighting is

Figure: Phong's specular term for various values of the "shininess" term. Note that the values never get above 1.

To calculate r we can use the following equation: If l and n are normalized, then the resulting r is normalized and the equation can be simplified as:

And just as we did for diffuse lighting, if the dot product is negative, then the term is ignored.

Figure: A specular term just shows the highlights.

Note that the final color values will have to be made to fit in the [0,1] range for the final rgb values.

Figure 1: A combination of ambient, diffuse, and specular illumination.

Light Attenuation

Light in the real world loses its intensity as the inverse square of the distance from the light source to the surface being illuminated

The attenuation factor is calculated by the following equation:

The fatten factor is the attenuation factor. The distance d between the light and the vertex is always positive.

where the kc, kl, and kq parameters are the constant, linear, and quadratic attenuation constants, respectively

The lighting equation with the attenuation factor looks like this.

Figure 2: A scene with light attenuation. The white sphere is the light position.

Schlick [SCHLICK 1994] suggested a replacement for the exponential term since that's a fairly expensive operation. If we define part of our specular light term as follows:

where S is either the Phong or Blinn-Phong flavor of the specular lighting equation, then Schlick's simplification is to replace the preceding part of the specular equation with:

Figure 3: Schlick's term for specular looks very much like the more expensive Phong term.

Figure 4: Schlick's vs. Phong's specular terms.

Oren—Nayar Diffuse Reflection

One of the problems of the standard Lambertian model is that it considers the surface as a smooth diffuse surface.

Backscattering is when a rough surface bounces around a light ray and then reflects the ray in the direction the light originally came from

Retroreflection is the effect of reflecting light towards the direction from which it came, no matter the orientation of the surface

when the light direction is closer to the view direction, we get the effect of forward scattering

Figure 6: The same dirt field showing widely differing reflection properties.

Figure 7: A soybean field showing differing reflection properties.

Where

ρ/π is a surface reflectivity property, which we can replace with our surface diffuse color. E0 is a light input energy term, which we can replace with our light diffuse color.

And the θi term is just our familiar angle between the vertex normal and the light direction. Making these exchanges gives us

which looks a lot more like the equations we've used. There are still some parameters to explain.

σ is the surface roughness parameter. It's the standard deviation in radians of the angle of distribution of the microfacets in the surface roughness model. The larger the value, the rougher the surface.

θr is the angle between the vertex normal and the view direction.

φr - φi is the circular angle (about the vertex normal) between the light vector and the view vector.

α is max(θi, θr). β is min (θi, θr).

Computer Graphics Lecture 30