Light Transport Baoquan Chen 2017

Similar documents
Illumination & Shading: Part 1

Computer Graphics. Illumination and Shading

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

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

Illumination and Shading

INF3320 Computer Graphics and Discrete Geometry

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

Sung-Eui Yoon ( 윤성의 )

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

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

CS5620 Intro to Computer Graphics

Virtual Reality for Human Computer Interaction

Illumination Models & Shading

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

Shading and Illumination

Illumination & Shading

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Shading , Fall 2004 Nancy Pollard Mark Tomczak

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

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

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

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

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

Visualisatie BMT. Rendering. Arjan Kok

Illumination and Shading

Illumination and Shading ECE 567

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

CPSC 314 LIGHTING AND SHADING

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Why we need shading?

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Display Issues Week 5

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

All forms of EM waves travel at the speed of light in a vacuum = 3.00 x 10 8 m/s This speed is constant in air as well

Illumination and Shading

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

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

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

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

Reflection and Shading

Lighting/Shading III. Week 7, Wed Mar 3

Shading I Computer Graphics I, Fall 2008

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

CS770/870 Spring 2017 Color and Shading

Virtual Reality for Human Computer Interaction

w Foley, Section16.1 Reading

Comp 410/510 Computer Graphics. Spring Shading

Simple Lighting/Illumination Models

Optics Test Science What are some devices that you use in everyday life that require optics?

Raytracing. COSC 4328/5327 Scott A. King

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

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

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

Light Sources. Spotlight model

Realtime 3D Computer Graphics & Virtual Reality. Shading and Color. Introduction to Lighting and Shading

Shading. CSE 457 Winter 2015

LIGHTING AND SHADING

Illumination & Shading I

Lighting and Shading

Computer Graphics. Illumination and Shading

Illumination & Shading

Shading. Brian Curless CSE 457 Spring 2015

Illumination and Shading

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Introduction to Computer Graphics 7. Shading

CS 4600 Fall Utah School of Computing

CPSC / Illumination and Shading

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

Light and Electromagnetic Waves. Honors Physics

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

Lighting. CSC 7443: Scientific Information Visualization

Lighting. Figure 10.1

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

Color and Shading. Color. Shapiro and Stockman, Chapter 6. Color and Machine Vision. Color and Perception

CS6670: Computer Vision

Lecture 7 Notes: 07 / 11. Reflection and refraction

Lecture 1 Image Formation.

Lecture 4 Advanced Computer Graphics (CS & SE )

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

CSE 681 Illumination and Phong Shading

Graphics and Visualization

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

What is it? How does it work? How do we use it?

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

Computer Graphics MTAT Raimond Tunnel

CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17)

specular diffuse reflection.

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

CS452/552; EE465/505. Intro to Lighting

The Display pipeline. The fast forward version. The Display Pipeline The order may vary somewhat. The Graphics Pipeline. To draw images.

CS 325 Computer Graphics

Pick up Light Packet & Light WS

Transcription:

Light Transport 1

Physics of Light and Color It s all electromagnetic (EM) radiation Different colors correspond to radiation of different wavelengths Intensity of each wavelength specified by amplitude Frequency = 2 /» long wavelength is low frequency» short wavelength is high frequency 2

The Visible Spectrum We perceive EM radiation with λ in the 400-700 nm range 3

Why These Wavelengths? We perceive EM radiation with λ in the 400-700 nm range That s really an accident of nature Sun emits strongly in this wavelength band Earth s atmosphere lets through a lot of light in this band It s higher energy than thermal infrared, so heat (and your own body temperature) doesn t swamp it There is no reason why you couldn t do CG with radio, gamma rays, or even sound Transparency and surface properties would change, of course Diffraction depends on wavelength 4

The Eye The image is formed on the retina Retina contains two types of cells: rods and cones Cones measure color (red, green, blue) Rods responsible for monochrome night-vision 5

The Fovea Cones are most densely packed within a region of the retina called the fovea 6 Three types of cones: S,M,L Corresponds to 3 visual pigments Roughly speaking: - S responds to blue - M responds to green - L responds to red Note that these are not uniform - more sensitive to green than red Colorblindness - deficiency of one cone/pigment type

RGB 1. convenient for display (CRT uses red, green, and blue phosphors) 2. not very intuitive Color Spaces 7

Color Spaces Color Matching R,G,B is mixed to reproduce the perceptual equivalent of any wavelength. A problem exists, however, because sometimes the red light needs to be added to the target before a match can be achieved. This is shown on the graph by having its intensity, R, take on a negative value. 8

Color Spaces R HSV 1. an intuitive color space 2. H is hue - what color is it? S is saturation or purity - how non-gray is it? V is value - how bright is it? 3. H is cyclic therefore it is a non-linear transformation of RGB B G G B 9 R G B V R H S

Color Spaces CIE XYZ Often it is convenient to work in a 2D color space. This is commonly done by projecting the 3D color space onto the plane X+Y+Z=1, yielding a CIE chromaticity diagram (shown on the right). The projection is defined as: x X X Y Z y X Y Y Z z X Z Y Z A linear transform of RGB used by color scientists 10

Additive vs. Subtractive Color Working with light: additive primaries Red, green and blue components are added by the superposition property of electromagnetism Conceptually: start with black, primaries add light Working with pigments: subtractive primaries Typical inks (CMYK): cyan, magenta, yellow, black Conceptually: start with white, pigments filter out light The pigments remove parts of the spectrum dye color absorbs reflects cyan red blue and green magenta green blue and red yellow blue red and green black all none Inks interact in nonlinear ways--makes converting from monitor color to printer color a challenging problem Black ink (K) used to ensure a high quality black can be printed 11

Surface Reflection When light hits a surface some is absorbed, the rest is reflected and transmitted (never mind for now) The reflected light is what we see Reflection is not simple and varies with material the surface s micro structure defines the details of reflection variations produce anything from bright specular reflection (mirrors) to dull matte finish (chalk) Incident Light Reflected Light Camera Surface 12

Illumination Light Sources emit light EM spectrum (color) Position and direction Surfaces reflect light Geometry (position, orientation, microstructure) Absorption Transmission Reflectance Illumination determined by the interactions between light sources and surfaces 13

Types of Light Sources Ambient: equal light in all directions a hack to model inter-reflections Directional: light rays oriented in same direction good for distance light sources (sunlight) Point: light rays diverge from a single point approximation to a light bulb 14

More Light Sources Spotlight: point source with directional fall-off intensity is maximal along some direction D, falls off away from D specified by color, point, direction, fall-off parameters Area Source: Luminous 2D surface radiates light from all points on its surface generates soft shadows 15

Diffuse Reflection Simplest kind of reflector (also known as Lambertian Reflection) Models a matte surface -- rough at the microscopic level Ideal diffuse reflector incoming light is scattered equally in all directions viewed brightness does not depend on viewing direction brightness does depend on direction of illumination Illumination direction 16

Lambert s Law I light I di ffuse : Light Source Intensity k d I light cos k d I light (N L) k d : Surface reflectance coefficient in [0,1] : Light/Normal angle L N V 17

Examples of Diffuse Illumination Above is the same sphere lit diffusely from different lighting angles 18

Ambient + Diffuse Reflection CG started using the Lambertian model and then added more terms as extra effects were required I d a k a I a k d I light (N L) I a : Ambient light intensity (global) L N V k a : Ambient reflectance (local) This is diffuse illumination plus a simple ambient light term a trick to account for a background light level caused by multiple reflections from all objects in the scene 19

Further Simple Illumination Effects Light attenuation: light intensity falls off with the square of the distance from the source - so we add an extra term for this I d a k with d the light source to surface distance - more complicated formulae are possible and work better Colored lights and surfaces: just have three separate equations for RGB (or CIE, YIQ, etc.) Atmospheric attenuation: a I a f att k ( N L) use viewer-to-surface distance to give extra effects d I light where f att = 1 d 2 the distance is used to blend the object s radiant color with a far color (e.g., a nice hazy gray) 20

Specular Reflection Shiny surfaces change appearance when viewpoint is varied specularities (highlights) are view-dependent caused by surfaces that are microscopically smooth For shiny surfaces part of the incident light reflects coherently an incoming ray is reflected in a single direction (or narrow beam) direction is defined by the incoming direction and the surface normal A mirror is a perfect specular reflector approximate specular reflectors give fuzzy highlights 21

Phong Illumination One function that approximates specular falloff is called the Phong Illumination model k n I k I (cos ) s shiny n shiny specular s light : Angle between reflected light ray R and viewer V : Specular reflectance : Rate of specular falloff no physical basis, yet widespread use in computer graphics L N R V 22

Computing the Reflected Ray L N R V 2N(N L) L N(N L) L L R = 2N(N L) - L Project L onto N Double length of vector Subtract L 23

Phong Illumination Curves The specular exponents are often much larger than 1; values of 100 are not uncommon. k s I specular k s I light (cos ) n shiny : angle between line of sight and perfect reflection : Specular reflectance n shiny : Rate of specular falloff 24

Phong Illumination Moving the light source Changing n shiny 25

Putting It All Together [ I k a I a f att I light k d cos k s (cos ) n ] shiny Combining ambient, diffuse, and specular illumination For multiple light sources Repeat the diffuse and specular calculations for each light source Add the components from all light sources The ambient term contributes only once The different reflectance coefficients can differ. Simple metal : k a and k d share material color, k s is white Simple plastic: k s also includes material color Remember, when cosine is negative lighting term is zero! 26

Some Examples 27

Lighting Principles Lighting simulates how objects reflect light material composition of object light s color and position global lighting parameters» ambient light» two sided lighting available in both color index and RGBA mode 28

How OpenGL Simulates Lights Phong lighting model Computed at vertices Lighting contributors Surface material properties Light properties Lighting model properties 29

Surface Normals Normals define how a surface reflects light glnormal3f( x, y, z ) Current normal is used to compute vertex s color Use unit normals for proper lighting» scaling affects a normal s length glenable( GL_NORMALIZE ) or glenable( GL_RESCALE_NORMAL ) 30

Material Properties Define the surface properties of a primitive glmaterialfv( face, property, value ); GL_DIFFUSE GL_SPECULAR GL_AMBIENT GL_EMISSION Base color Highlight Color Low-light Color Glow Color GL_SHININESS Surface Smoothness separate materials for front and back 31

Light Properties gllightfv( light, property, value ); light specifies which light» multiple lights, starting with GL_LIGHT0 glgetintegerv( GL_MAX_LIGHTS, &n ); properties» colors» position and type» attenuation 32

An Example: OpenGL Materials Glfloat white8[] = {.8,.8,.8, 1.}, white2 = {.2,.2,.2, 1.}, black = {0., 0., 0.}; GLfloat mat_shininess[] = {50.}; /* Phong exponent */ glmaterialfv(gl_front_and_back, GL_AMBIENT, black); glmaterialfv(gl_front_and_back, GL_DIFFUSE, white8); glmaterialfv(gl_front_and_back, GL_SPECULAR, white2); glmaterialfv(gl_front_and_back, GL_SHININESS, mat_shininess); 33

An Example: OpenGL Lighting GLfloat white[] = {1., 1., 1., 1.}; GLfloat light0_position[] = {1., 1., 5., 0.}; /* directional light (w=0) */ gllightfv(gl_light0, GL_POSITION, light0_position); gllightfv(gl_light0, GL_DIFFUSE, white); gllightfv(gl_light0, GL_SPECULAR, white); glenable(gl_light0); glenable(gl_normalize); /* normalize normal vectors */ gllightmodeli(gl_light_model_two_side, GL_TRUE); /* two-sided lighting*/ glenable(gl_lighting); 34

Transmission with Refraction Refraction: the bending of light due to its different velocities through different materials Refractive index: light travels at speed c/n in a material of refractive index n c is the speed of light in a vacuum varies with wavelength hence rainbows and prisms MATERIAL INDEX OF REFRACTION Air/Vacuum 1 Water 1.33 Glass about 1.5 Diamond 2.4 35

Snell s Law Light bends when passing from a material of index n 1 to one of index n 2 Snell s law gives the angle of refraction: n 1 sin 1 = n 2 sin 2 where 1 and 2 are the angles from perpendicular When traveling into a denser material (larger n), light bends to be more perpendicular (e.g. air to water) and vice versa When traveling into a less dense material total internal reflection occurs if 1 >sin -1 (n 2 /n 1 ) 36

Where do we Illuminate? To this point we have discussed how to compute an illumination model at a single point on a surface. But, at which points on the surface is the illumination model applied? Where and how often it is applied has a noticeable effect on the result. Illuminating can be a costly process involving the computation of and normalizing of vectors to multiple light sources and the viewer. 37

Flat Shading The simplest shading method applies only one illumination calculation at one point for each primitive. Which one? Usually the centroid. For a convex facet the centriod is given as follows: centroid 1 vertices vertices p i i 1 This technique is called constant or flat shading. It is often used on polygonal primitives. Facts: For point light sources the direction to the light source varies over the facet For specular reflections the direction to the eye varies over the facet Facet facts are clearly visible 38

Gouraud Shading The Gouraud Shading method applies the illumination model on a subset of surface points and interpolates the intensity of the remaining points on the surface. In the case of a polygonal mesh the illumination model is usually applied at each vertex and the colors in the triangles interior are linearly interpolated from these vertex values during polygon rasterization. Facet artifacts are still visible. 39

Gouraud Shading Gouraud shading interpolates illumination values at each vertex using screen-space interpolation. Screen-space interpolation is wrong! However, you usually will not notice because the transition in colors is very smooth. There are some cases where the errors in Gourand shading become obvious. When switching between different levels-of-detail representations At "T" joints. 40

Phong Shading In Phong shading (not to be confused with Phong's illumination model), the surface normal is linearly interpolated across polygonal facets, and the Illumination model is applied at every point. A Phong shader assumes the same input as a Gouraud shader, which means that it expects a normal for every vertex. The illumination model is applied at every point on the surface being rendered, where the normal at each point is the result of linearly interpolating the vertex normals defined at each vertex of the triangle. Phong shading will usually result in a very smooth appearance, facet artifacts can only be seen along silhouettes. 42

Comparison faceted shading Gouraud shading Phong shading 43