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

Similar documents
Simple Lighting/Illumination Models

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

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Lighting and Shading

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

Illumination & Shading: Part 1

Introduction to Computer Graphics 7. Shading

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

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

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

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

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

Comp 410/510 Computer Graphics. Spring Shading

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

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

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Shading I Computer Graphics I, Fall 2008

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Virtual Reality for Human Computer Interaction

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

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

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

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

Illumination & Shading

Visualisatie BMT. Rendering. Arjan Kok

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

CS5620 Intro to Computer Graphics

Sung-Eui Yoon ( 윤성의 )

CSE 681 Illumination and Phong Shading

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

GLOBAL ILLUMINATION. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION

Computer Graphics. Illumination and Shading

Illumination in Computer Graphics

CPSC 314 LIGHTING AND SHADING

Shading. Brian Curless CSE 557 Autumn 2017

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

CS770/870 Spring 2017 Color and Shading

The Rendering Equation. Computer Graphics CMU /15-662

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

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

Raytracing CS148 AS3. Due :59pm PDT

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

w Foley, Section16.1 Reading

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

6. Illumination, Lighting

Illumination and Shading

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

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

Reflection and Shading

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

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

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

CS452/552; EE465/505. Intro to Lighting

Shading 1: basics Christian Miller CS Fall 2011

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

Introduction to Visualization and Computer Graphics

Path Tracing part 2. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Computer Graphics. Illumination and Shading

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

CPSC / Illumination and Shading

Illumination Models & Shading

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

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

CS 4600 Fall Utah School of Computing

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Complex Shading Algorithms

CS 325 Computer Graphics

Shading. Brian Curless CSE 457 Spring 2017

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

CEng 477 Introduction to Computer Graphics Fall

The Rendering Equation and Path Tracing

rendering equation computer graphics rendering equation 2009 fabio pellacini 1

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Ray-Tracing. Misha Kazhdan

Lighting. Figure 10.1

CPSC GLOBAL ILLUMINATION

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

Illumination and Shading

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

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

Topics and things to know about them:

University of Victoria CSC 305 Shading. Brian Wyvill 2016

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Shading, lighting, & BRDF Theory. Cliff Lindsay, PHD

Raytracing. COSC 4328/5327 Scott A. King

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

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

Lighting affects appearance

Lecture 7 Notes: 07 / 11. Reflection and refraction

Introduction to Radiosity

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

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

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

Transcription:

INTRODUCTION TO COMPUTER GRAPHIC S Illumination The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong Andries van Dam October 29, 2009 Illumination Models 1/30

Outline Physical foundations of light Representing reflections The Rendering Equation Analytical intractability Formalizing our approximation Categories of illumination models Evaluating Illumination Models Shading models Beyond CS123 Andries van Dam October 29, 2009 Illumination Models 2/30

How the World Works What is Light? Electromagnetic Radiation Can be thought of as waves which are defined by their wavelength and amplitude We re interested in wavelengths in the visible spectrum Andries van Dam October 29, 2009 Illumination Models 3/30

How the World Works What is Light? Can also be thought of as photons, or packets of energy When an electron in an atom drops from a higher to a lower orbital, a photon is emitted When a photon strikes the atom, if it is absorbed, electrons jump from a lower orbital to a higher one Wavelength corresponds to change in orbital and vice versa Properties of atoms cause different absorption or emission, or sometimes neither Andries van Dam October 29, 2009 Illumination Models 4/30

How the World Works What is Light? Collections of atoms act in concert to absorb or emit photons therefore collections of atoms are compatible with a wider range of wavelengths In metals for example electrons are not attached to particular nuclei, but can instead move about the material In other materials like carbon there are also unattached electrons but they cannot move freely so absorption induces the atoms to vibrate a.k.a. heat up This further explains distinctions in material properties such as color and reflectance Andries van Dam October 29, 2009 Illumination Models 5/30

How the World Works What is Light? Heat energy causes atoms to vibrate As materials become heated the become better emitters of electromagnetic radiation, i.e. they are more likely to emit photons Heat energy as light energy This is why heated iron glows. Andries van Dam October 29, 2009 Illumination Models 6/30

Modeling Light Representing Reflections Reflections can be thought of as absorption and prompt remission of photons Light comes in, a fraction goes out towards observer (remember conservation of energy) This is a function. it takes incoming intensity, incoming wavelength, incoming angle, and outgoing angle of interest it returns outgoing intensity and wavelength we call this a BRDF or bidirectional reflectance distribution function A soybean field. Left: backscattering (sun behind observer). Right: forwardscattering (sun opposite observer) Andries van Dam October 29, 2009 Illumination Models 7/30

Modeling Reflection Lambertian Reflectance An example of such a function is the Lambertian BRDF Lambertian surfaces appear to have the same brightness no matter where you are observing them from - look at the walls around you Such a BRDF can be defined by Lambert s cosine law: I = I p k d cos θ, i.e., I = I p k d (N L) N unit normal of A L unit vector in direction of light k d diffuse reflection coefficient; specifies fraction of I p reflected I p L θ N da A Andries van Dam October 29, 2009 Illumination Models 8/30

Modeling Reflection Specular Reflectance Most materials are not perfectly diffuse This leaves us to define irregular BRDFs, i.e., ones which are viewer-dependent We call this adding the specular property of a material The value of this BRDF is greatest when the outgoing angle is opposite the incoming angle, as in a perfect mirror Think of a patch of water as it ripples Andries van Dam October 29, 2009 Illumination Models 9/30

Modeling Reflections Advanced Techniques There are many more complex and more accurate BRDFs such as Blinn s and Anisotropic. There are even more complicated distribution functions such as BSSDF or bidirectional subsurface scattering function Furthermore researchers collect tables of data for B*DFs of specific materials using devices like the one pictured Andries van Dam October 29, 2009 Illumination Models 10/30

Modeling Light The Rendering Equation Generalized rendering equation formulated by Jim Kajiya, 1986: i.e.: Light energy traveling from point i to j is equal to light emitted from i to j, plus the integral over S (all points on all surfaces) of reflectance from point k to i to j, times the light from k to i, all attenuated by a geometry factor. is the amount of light traveling along the ray from point i to point j. is the amount of light emitted by the surface (luminance) is the Bidirectional Reflectance Distribution Function (BRDF) of the surface. Describes how much of the light incident on the surface at i from the direction of k leaves the surface in direction of j. is a geometry term which involves occlusion, distance, and the angle between the surfaces Andries van Dam October 29, 2009 Illumination Models 11/30

Modeling Light The Intractability The Universe has been simulating the solution to the rendering equation since the beginning of time so it would be ridiculous if we could solve it. It is provably unsolvable (left as an exercise to the reader) this means we have to be clever in trying to approximate the equation to trick the eye luckily the eye is easily fooled There are infinite possible wavelengths we will restrict our discussion to red, green, and blue light because these 3 cover the largest triangle (gamut) in the CIE space The world is, for our purposes, continuous, while we need to display pixels this means we will compute samples of the world at surface elements and translate them into pixel data This leaves us with a discussion of how best to make pretty pictures Andries van Dam October 29, 2009 Illumination Models 12/30

Formalizing our Approximation Surface Elements A Surface Element is a differential area on that surface most surfaces are curved and continuous approximate small regions with pieces of tangent planes imagine breaking a surface up into a finite number of very small pieces. Pieces are still curved, but if they re small enough, you can make them arbitrarily close to being flat Surface normals have the same problem in that they also vary continuously each tangent plane piece that defines a surface element comes with a normal so we have no extra work in Shapes, you broke the sphere up into triangles, with each vertex having an associated normal. The small area around a vertex is a surface element used to calculate illumination. Andries van Dam October 29, 2009 Illumination Models 13/30

Formalizing our Approximation Illumination Lighting, also called illumination or reflection (at least in CS123), is computing the intensity and wavelength seen by a viewer, emitted by the surface at a sample it is a function of geometry of the scene (including the model, the lights, the viewer/camera) and material properties Often computing lighting at every point is too expensive so we interpolate Shading is faking data between samples with known light information via interpolation Illumination of a surface element defines the output of the illumination model evaluated at that sample as seen by the camera Andries van Dam October 29, 2009 Illumination Models 14/30

Illumination Models Local versus Global Models The rendering equation takes into account non local information Thus the most realistic illumination models try to take this global data into account However purely local models can also produce believable results for far smaller costs Andries van Dam October 29, 2009 Illumination Models 15/30

Illumination Models Local Illumination Take only direct lighting information into account when computing a sample Local illumination is an approximation to global illumination Usually involves an ambient term to set a sort of minimum bar for object illumination Andries van Dam October 29, 2009 Illumination Models 16/30

Illumination Models Global Illumination Simulates what happens when other objects and scene elements affect light reaching a surface element Lights and shadows most light striking a surface element comes directly from emissive light sources in the scene (direct illumination) sometimes light from a source is blocked by other objects surface element is then in shadow from that light source Inter-object reflection light bounces off other objects toward our surface element when that light reaches our surface element, it brightens it (indirect illumination) eye object direct illumination indirect illumination light object object light Andries van Dam October 29, 2009 Illumination Models 17/30

Illumination Models Local versus Global Models Local models concentrate on light from direct sources pro: scene can be rendered fast con: pay a price in lost realism; lose interesting effects of light transport because we ignore effects of all other objects in the scene when considering a particular surface element Global models concentrate on capturing the all illumination information pros: shadows, inter-object reflection, refraction, i.e. bending of light at translucent surfaces, volumetric effects of participating media such as air, water, and fog cons: slow Andries van Dam October 29, 2009 Illumination Models 18/30

Computing Illumination Models Polygon Rendering Evaluates at several samples and shade everywhere in between to produce pixels in final image Light Transport Simulation Evaluate at enough samples to produce final image without any guessing Note: the BRDF is often implicit in simple illumination models because they are so faked out and there is no conception of units, just dials to adjust results to look good Andries van Dam October 29, 2009 Illumination Models 19/30

Illumination Models Phong Simple, NOT physically-based Does attempt to simulate some of the most important observable effects of common light interactions Specifies characteristics of surfaces ambient component: accounts for non-specific global light diffuse component: accounts for the color of the object under normal conditions using lamberts cosine law I = I p k d (N L) specular component: accounts for highlights on shiny objects Specular reflection proportional (R V) n as n increases, highlight is more concentrated, surface appears glossier Andries van Dam October 29, 2009 Illumination Models 20/30

Illumination Models Computing Results Variables λ = color component (e.g. R, G, and B) i = intensity of light as measured at surface i a = the amount of ambient light used in the scene k = material's efficiency at reflecting light (attenuation coefficient) k a is the ambient attenuation coefficient for this object's material (we would expect ka ~ kd) O = innate color of object's material at specific point on surface Ambient component effect on surface constant regardless of orientation, no geometric information total hack (crudest possible approximation to interobject reflection), but makes all objects a little visible Diffuse component uses Lambert's diffuse-reflection cosine law i dir (light's intensity) and l (light's direction) vary for each light source k d is the diffuse attenuation coefficient O d = innate color of object's diffuse material property at specific point on surface Andries van Dam October 29, 2009 Illumination Models 21/30

Illumination Models Computing Results We can add a specular hack to increase accuracy Energy from a single light reflected by a single surface element can be computed I λ = I aλ k a O dλ + f att I pλ [k d O dλ (N L) + k s O sλ (R V) n ] k s - specular coefficient, fraction of light reflected O sλ - object specular color (not necessarily the same as O dλ ) For multiple point lights, simply sum contributions Andries van Dam October 29, 2009 Illumination Models 22/30

Representing Lights Density of energy (light) decreases by inverse square of the distance from the surface, due to spherical radiation pattern 1 I = f *( I k )( N L ), where f = att p d att 2 ( d ) L d L path length from light to object This makes surfaces with equal k d ( N L ) vary in appearance if they are at different distances from the light important if two surfaces overlap: Formula often creates harsh effect we do not often see objects illuminated by point lights! f att = min(, 1 ) 2 Instead use: c + 1 c 2 d + L c 3 ( d L ) where c 1, c 2, c 3 are experimentally-defined constants. This is a heuristic! (nice word for a hack) Andries van Dam October 29, 2009 Illumination Models 23/30 1

Blinn-Phong Illumination Model Variation on Phong specular term that is computationally more efficient. Uses Half angle between viewer and light instead of angle between surface normal and light Computing the half angle requires a square root Computing the normal to light angle requires a different computation for each triangle in the scene Take your pick! Blinn-Phong yields different results, but the units are bogus anyway and it is easier to use it to produce visually pleasing images Specular term δ e = viewpoint r = reflected image of light source l = vector from the light source n = surface normal h = the half vector, i.e., average of vectors e and -l δ = angle between h and n n = specular coefficient Andries van Dam October 29, 2009 Illumination Models 24/30

Illumination Models Computing Results Look closely at the specular term: We can compute this term recursively shoot a ray from eye through a pixel on the screen calculate intersection of ray with a primitive in the scene shoot a ray from the intersection point to calculate the contribution of other objects in the lighting applying our simple illumination model at intersection point can even be done in hardware thanks to modern gpus We call this Ray Tracing Ray tracing is a pseudo global model that you will be implementing soon (in software) Andries van Dam October 29, 2009 Illumination Models 25/30

Shading Models Flat We define a normal at each polygon (not at the vertices) Lighting: Evaluate the BRDF the center of each polygon using the associated normal Shading: Every sample point on that polygon is taken to have that result Andries van Dam October 29, 2009 Illumination Models 26/30

Shading Models Gouraud We define a normal at each vertex Lighting: Evaluate the BRDF at each vertex using the associated normal Shading: For every sample point on the polygon we interpolate the color values at vertices of the polygon computed in the lighting step Andries van Dam October 29, 2009 Illumination Models 27/30

Shading Models Phong We define a normal at each vertex Lighting: Evaluate the BRDF at each vertex using the associated normal Shading: For every sample point on the polygon we interpolate the normals at vertices of the polygon and compute the color using the BRDF which we use to determine the color (explained in polygonal rendering lecture soon) Andries van Dam October 29, 2009 Illumination Models 28/30

Advanced Techniques Photon Mapping Photon mapping is a more accurate approximation of the rendering equation that uses statistical methods to improve sampling Balances accuracy and speed Henrik Wann Jensen wrote the book on it. Literally (as you will find out if you take CS224) Andries van Dam October 29, 2009 Illumination Models 29/30

Advanced Techniques Others Metropolis Light Transport the most accurate feasible technique too slow for most purposes Radiosity Make sure to come to lecture on Novemeber 12 th Andries van Dam October 29, 2009 Illumination Models 30/30