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

Similar documents
Shading I Computer Graphics I, Fall 2008

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Comp 410/510 Computer Graphics. Spring Shading

Virtual Reality for Human Computer Interaction

Illumination & Shading

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

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

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

Simple Lighting/Illumination Models

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

Introduction to Computer Graphics 7. Shading

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

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

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

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

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

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

Illumination in Computer Graphics

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

Illumination Models & Shading

Reflection and Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Supplement to Lecture 16

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Lighting and Shading

Computer Graphics. Illumination and Shading

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

Lighting. Figure 10.1

CEng 477 Introduction to Computer Graphics Fall

Computer Graphics. Illumination and Shading

CPSC 314 LIGHTING AND SHADING

w Foley, Section16.1 Reading

CPSC / Illumination and Shading

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

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

CS452/552; EE465/505. Intro to Lighting

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Why we need shading?

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

Visualisatie BMT. Rendering. Arjan Kok

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

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

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

CS 325 Computer Graphics

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

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

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

9. Illumination and Shading

Shading. Brian Curless CSE 557 Autumn 2017

CS770/870 Spring 2017 Color and Shading

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

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Ray-Tracing. Misha Kazhdan

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

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

SESSION 5: INVESTIGATING LIGHT. Key Concepts. X-planation. Physical Sciences Grade In this session we:

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

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

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

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

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

Raytracing. COSC 4328/5327 Scott A. King

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

CS 5625 Lec 2: Shading Models

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

Illumination & Shading: Part 1

Ray Tracing: Special Topics CSCI 4239/5239 Advanced Computer Graphics Spring 2018

Local Reflection Models

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

COMP371 COMPUTER GRAPHICS

Virtual Reality for Human Computer Interaction

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

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Illumination and Shading

Illumination and Shading

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

Shading 1: basics Christian Miller CS Fall 2011

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

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Lighting affects appearance

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

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

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

Light. Electromagnetic wave with wave-like nature Refraction Interference Diffraction

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

Lecture 4: Reflection Models

Illumination. Courtesy of Adam Finkelstein, Princeton University

University of Victoria CSC 305 Shading. Brian Wyvill 2016

Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

Graphics and Visualization

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

Transcription:

Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller

Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism 2

Reading Chapter 5 - Angel Chapter 16 - Foley, van Dam, et al 3

Illumination No lights 4

Illumination No lights in OpenGL 5

Illumination (2) Ambient Lights 6

Illumination (3) Diffuse + specular lights 7

Importance of illumination Visual realism with surface appearance Provides 3D cues, e.g., essential in shape from shading or inference from a photograph or photographs Prados and Faugeras, A Rigorous and Realistic Shape From Shading Method and Some of Its Applications, INRIA Research Report, March 2004. 8

Illumination vs. shading Often collectively referred to as shading, e.g., in text and [Foley et al.] If one has to make a distinction Illumination: calculates intensity at a particular point on a surface Shading: uses these calculated intensities to shade the whole surface or the whole scene 9

Difficulty Visibility is conceptually easy (computationally, still rather expensive) and we can be quite precise The single criterion is whether something lies along the projector The physics (optics, thermal radiation, etc.) behind the interaction between lights and material is much more complex Simulating exact physics is expensive Even if we make simplifying assumptions, e.g., straight light, only consider RGB components, etc. 10

Scattering of light Light strikes surface A Some scattered Some absorbed Some of scattered light strikes B Some scattered Some absorbed Some of this scattered light strikes A, and so on 11

Rendering equation The infinite scattering and absorption of light can be described by the rendering equation The equation sets up an equilibrium situation Cannot be solved analytically in general and need numerical approximations Ray tracing is a special case for perfectly reflecting surfaces Rendering equation is global and includes Shadows Multiple scattering from object to object 12

Global illumination More physical and illuminates the whole scene by taking into account the interchange of light between all surfaces follows the rendering equation Prominent examples: radiosity and ray tracing More visual realism with more faithful simulation of physics, but much slower than local illumination In contrast to pipeline model which shades each polygon independently (leads to local illumination) 13

Local illumination Much more simplified and non-physical Computes the color of a point independently through direct illumination by the light source(s) No explicit account for inter-object reflections Shading calculations depend only on: Material properties, e.g., reflectance of R, G, & B Location and properties of the light source Local geometry and orientation of the surface Location of viewer 14

Recall assumption on light Light travels in a straight line Ignore its frequency composition and care about its component-wise intensity (energy) R, G, B Light source: general light sources are difficult to work with because we must integrate light coming from all points on the source 15

Simplified light source models Ideal point light source Modeled by pos+color; shines equally in all directions Can take into account decay with respect to distance Follows perspective projections Parallel projections: distant source = point at infinity Spotlight Restrict light from ideal point source (Global) ambient light General brightness (same amount of light everywhere) A rough model for inter-surface reflections from all light sources 16

Light Effects reflected Light Usually only considering reflected part specular Light transmitted absorbed diffuse ambient Light=refl.+absorbed+trans. Light=ambient+diffuse+specular 17

Light-material interactions Specular reflection: Most light reflected in a narrow range of angles Perfect reflection: minus absorption, all light is reflected about the angle of reflection Diffuse reflection: Reflected light is scattered in all directions Perfect diffuser: follows Lambertian Law and surface looks the same from all directions Translucence and light refraction: Light is refracted (and reflected), e.g., glass, water 18

Geometry of perfect reflection Perfect reflection, a.k.a. mirror reflection n: normal vector l: vector pointing to light source r: ray of reflection ui : angle of incidence ur : angle of reflection Vectors l, n, and r lie in the same plane ui = ur 19

Geometry of refraction Consider a surface transmitting all light t : ray of refraction ul : angle of incidence ut : angle of refraction Vectors l, n, and t all lie in the same plane Snell s Law: ηl, ηt : indices of refraction measure of relative speed of light in the two material (c/cl, c/ct) 20

An ad-hoc local illumination model Phong reflection or local illumination model: the color at a point on a surface is composed of I = ambient + diffuse + specular Introduced by Phong in 1975 and used by OpenGL Not concerned with translucent surfaces Efficient enough to be interactive Rendering results can reasonably approximate physical reality under a variety of lighting conditions and material properties 21

Phong local illumination Phong reflection or local illumination model: the color at a point on a surface is composed of I = ambient + diffuse + specular Ambient component: general brightness due to the light source, regardless of surface orientation and light position or direction Diffuse component: light diffusely reflected off surface Specular component: light specularly reflected off surface There is also a global ambient light Models general brightness of scene regardless of light sources 22

Phong model: the four vectors Phong model uses four vectors to calculate a color for a point p on a surface: l : p to point light source n : normal vector to the plane or surface v : p to eye (view point) or center of projection r : vector of perfect reflection 23

Exercise: computation of vectors How to compute r, given n and l? 24

Exercise: computation of vectors How to compute r, given n and l? Answer: r = 2(n l)n l 25

Exercise: computation of vectors How to compute r, given n and l? Answer: r = 2(n l)n l Why? l + r l + r = (2 cos θ) n l n θ r 26

Perfect diffuse reflections Point of surface appears the same from all views Models dull, rough surface and follows Lambertian Law Equal area, same reflected light n θ l Light I d = k d L d cos = k d L d (n l), 0 /2 I d =0, otherwise Ld : diffuse term of light source kd : material s diffuse reflection coefficient n : normal vector at point (normalized) l : light source vector (normalized) 27

Aside 1: Lambertian reflection explained What we want: Per unit area towards the viewer, how much reflected diffuse light do we see? Unit area towards the viewer 1/ cos units of area on the surface How much light per unit surface area comes from the light source? I cos d da

Aside 2: Lambertian reflection explained Consider a light beam with a cross-sectional area da Surface 1: receives 1 unit of light per unit surface area Surface 2: receives cos(q) unit of light per unit surface area So light received is proportional to cosine of incidence angle q This is independent of the viewer 29

Aside 3: Take into account of Thus, amount of light received per unit surface area is Lambertian Law: Amount of light reflected from a unit differential surface area towards the viewer is directly proportional to cosine of the view angle ϕ i.e., the smaller the angle, the more reflects towards that viewer l L d cos θ n ϕ v eye viewer Putting all together, the amount of light seen by the viewer per unit area is I d = k d L d cos (1/ cos ) cos = k d L d cos 30

Examples: diffuse and ambient Lambertian reflection (Ld = 1; kd = 0.4, 0.55, 0.7, 0.85, 1): Add ambient light (La = Ld = 1; ka = 0, 0.15, 0.3, 0.45, 0.6): 31

Specular Light Light that is reflected from the surface unequally in all directions Models reflections on shiny surfaces I = k s I s cos n = k s I s (E R) n α Eye r N φφ L Light r r r n=inf. n=large n=small 32

Specular reflection examples Graphs of cos n (): L a = L d = 1.0 k a = 0.1 k d = 0.45 k s = 0.1 k s = 0.25 n = 3.0 n = 5.0 n = 10.0 n = 27 n = 200 Roughly, values of n between 100 and 200 correspond to metals and values between 5 and 10 give surface that look like plastic 33

Ambient light component Models general brightness due to light source Light or eye location does not matter Intensity of ambient light is the same at all points Really crude way to account for hard-to-compute lighting effects, e.g., inter-surface reflections, etc. La: ambient light energy (property of light source) ka: ambient reflection coefficient (a material property) ka of ambient reflected; (1 ka) absorbed 34

Phong Illumination Model cont. BRDF for Phong illumination 35

Phong Illumination Model cont. Illustration of ambient, diffuse, and specular components Different angles of incident light 36

Depth Cueing / Illumination Problems with f att = 1/d L 2 (square decay of energy): Too little change when light moves in far-away regions Wild change when object moves closer to light often a factor of 1/d or 1/(d+c) is used a way to simulate fog - linear fade 37

Depth Cueing / Illumination (2) use start f (front) and end b (back) fade distances d = distance from viewer: 38

Depth Cueing / Illumination (3) in OpenGL: use the attenuation coefficient Applied to diffuse and specular terms only 39

Transmission Objects can transmit light! Light may be transmitted specularly (transparent) or diffusely (translucent), like reflected light specular transmission is exhibited by materials such as glass diffuse transmission is exhibited by material which scatter the transmitted light (translucent, e.g. frosted glass, church) 40

Transparency 2 types of transparency - nonrefractive and refractive (more realistic) 41

Non-Refractive Transparency Requires sorting! (BTF vs. FTB) over operator - Porter & Duff 1984 C out = C in (1 )+C C in (i) =C out (i 1) 42

Refractive Transparency Transmitted light may be refracted according to Snell s law! 43

Refractive Transparency η t, η i - indices of refraction (ratio of speed of light in vacuum to the speed of light in the medium) depend on: temperature wavelength of light a good book :) hence - refracted light can have a different color 44

Total internal reflection When light passes from one medium into another whose index of refraction is lower the transmitted angle is larger than the incident angle at one point the light gets reflected - called total internal reflection 45

Optical Manhole Total Internal Reflection For water η w = 4/3 Livingston and Lynch

Refractive Transparency In general - refraction effects are ignored in simple renderers (e.g. scanline z-buffer) most materials in scene are non-transmitting (so it s ok most of the time) Extension to simple model: k t - transmission coefficient of a material I t - intensity of transmitted light 47

Implementation - an example Modify the z-buffer so that it maintains a depth-sorted list of visible surfaces at each pixel (A-buffer) for each polygon: if its in front of nearest opaque surface if its opaque else it becomes the nearest opaque surface (I.e. insert in the list and delete everything behind it) insert by z into the list else ignore it 48

Implementation - an example Blend two polygons like in the nonrefractive version C out = C in (1 )+C 49

Implementation - an example linear approximation doesn t model curved surfaces well. It does not account for the increased thickness of the material at silhouette edges, which reduces transparency. To approximate these effects - use a nonlinear transparency factor: = max + ( min max ) 1 (1 N z ) p 50

Implementation - an example = max + ( min max ) 1 (1 N z ) p α min, α max - minimum and maximum transparencies for the surface N z - is the z component of the surface normal p - is a modeling parameter (transparency power factor) 51

Improved light sources Distant light source Parallel rays of light Light vector l does not change from point to point (efficiency) Spotlight source A cone of light controlled by angle u (u = π for point source) Varying intensity as if for specular reflection using cos n (θ) θ 52

Improved light sources General Spotlight vary the intensity 53