University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Color II, Lighting/Shading.

Slides:



Advertisements
Similar presentations
13- 1 Chapter 13: Color Processing 。 Color: An important descriptor of the world 。 The world is itself colorless 。 Color is caused by the vision system.
Advertisements

1 Color Kyongil Yoon VISA Color Chapter 6, “Computer Vision: A Modern Approach” The experience of colour Caused by the vision system responding.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Introduction to Computer Graphics ColorColor. Specifying Color Color perception usually involves three quantities: Hue: Distinguishes between colors like.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
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 British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Color Week 5, Fri Feb.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading I Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Vision/Color II, Virtual.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
School of Computing Science Simon Fraser University
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Vision/Color Week 5, Mon.
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 414 Computer Graphics © Tamara Munzner 1 Color 2 Week 10, Fri 7 Nov 2003.
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 Lighting Week 5, Mon 29 Sep 2003 recap: picking, light sources lighting.
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,
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
CS559-Computer Graphics Copyright Stephen Chenney Color Recap The physical description of color is as a spectrum: the intensity of light at each wavelength.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
9/14/04© University of Wisconsin, CS559 Spring 2004 Last Time Intensity perception – the importance of ratios Dynamic Range – what it means and some of.
CS 445 / 645: Introductory Computer Graphics
SCI 200 Physical Science Lecture 9 Color Mixing Rob Daniell July 28, 2011.
CS 376 Introduction to Computer Graphics 01 / 26 / 2007 Instructor: Michael Eckmann.
Chapter 3: Colorimetry How to measure or specify color? Color dictionary?
Computer Science 631 Lecture 7: Colorspace, local operations
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Color. Contents Light and color The visible light spectrum Primary and secondary colors Color spaces –RGB, CMY, YIQ, HLS, CIE –CIE XYZ, CIE xyY and CIE.
CS 445 / 645 Introduction to Computer Graphics Lecture 14 Lighting Lighting.
Color Theory ‣ What is color? ‣ How do we perceive it? ‣ How do we describe and match colors? ‣ Color spaces.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
CSC361/ Digital Media Burg/Wong
CS6825: Color 2 Light and Color Light is electromagnetic radiation Light is electromagnetic radiation Visible light: nm. range Visible light:
Announcements Office hours today 2:30-3:30 Graded midterms will be returned at the end of the class.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading I Week.
Illumination and Shading
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
Introduction to Computer Graphics
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Raster Graphics and Color Greg Humphreys University of Virginia CS 445, Fall 2003.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
Local Illumination and Shading
David Luebke 1 2/5/2016 Color CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
David Luebke2/23/2016 CS 551 / 645: Introductory Computer Graphics Color Continued Clipping in 3D.
Lighting/Shading University of British Columbia
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.
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Color University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Color Measurement and Reproduction Eric Dubois. How Can We Specify a Color Numerically? What measurements do we need to take of a colored light to uniquely.
1 of 32 Computer Graphics Color. 2 of 32 Basics Of Color elements of color:
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Computer Graphics: Illumination
CS 551 / 645: Introductory Computer Graphics
Slides taken from Scott Schaefer
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Color II, Lighting/Shading I Week 7, Mon Feb 25

2 News I’m back! including office hours Wed/Fri after lecture in lab this week Fri 2/29: Homework 2 due 1pm sharp Fri 2/29: Project 2 due 6pm extra TA office hours in lab this week to answer questions Tue 2-4 (usual lab 1-2) Thu 2-4 (usual lab 10-11) Fri 2-4 (usual lab 12-1) reminder: midterm next Fri Mar 7

3 News Homework 1 returned today average 84 Project 1 face-to-face grading done average 96 stragglers contact Cody, ASAP penalty for noshows, nosignups the glorious P1 Hall of Fame!

4 Review: Trichromacy and Metamers three types of cones color is combination of cone stimuli metamer: identically perceived color caused by very different spectra

5 Review: Measured vs. CIE Color Spaces measured basis monochromatic lights physical observations negative lobes transformed basis “imaginary” lights all positive, unit area Y is luminance, no hue X, Z hue, no luminance

6 CIE Gamut and Chromaticity Diagram 3D gamut chromaticity diagram hue only, no intensity

7 CIE “Horseshoe” Diagram Facts all visible colors lie inside the horseshoe result from color matching experiments spectral (monochromatic) colors lie around the border the straight line between blue and red contains the purple tones colors combine linearly (i.e. along lines), since the xy-plane is a plane from a linear space

8 CIE “Horseshoe” Diagram Facts a point C can be chosen as a white point corresponding to an illuminant usually this point is of the curve swept out by the black body radiation spectra for different temperatures relative to C, two colors are called complementary if they are located along a line segment through C, but on opposite sides (i.e C is an affine combination of the two colors) the dominant wavelength of the color is found by extending the line from C through the color to the edge of the diagram some colors (i.e. purples) do not have a dominant wavelength, but their complementary color does

9 CIE Diagram Blackbody curve Illumination: Candle 2000K Light bulb 3000K (A) Sunset/ sunrise 3200K Day light 6500K (D) Overcast day 7000K Lightning >20,000K

10 Color Interpolation, Dominant & Opponent Wavelength Complementary wavelength

11 RGB Color Space (Color Cube) define colors with (r, g, b) amounts of red, green, and blue used by OpenGL hardware-centric describes the colors that can be generated with specific RGB light sources RGB color cube sits within CIE color space subset of perceivable colors scaled, rotated, sheared cube

12 Device Color Gamuts use CIE chromaticity diagram to compare the gamuts of various devices X, Y, and Z are hypothetical light sources, not used in practice as device primaries

13 Gamut Mapping

14 Additive vs. Subtractive Colors additive: light monitors, LCDs RGB model subtractive: pigment printers CMY(K) model

15 HSV Color Space more intuitive color space for people H = Hue S = Saturation V = Value or brightness B or intensity I or lightness L Value Saturation Hue

16 HSI/HSV and RGB HSV/HSI conversion from RGB hue same in both value is max, intensity is average HSI: HSV: if (B > G), H = H

17 YIQ Color Space color model used for color TV Y is luminance (same as CIE) I & Q are color (not same I as HSI!) using Y backwards compatible for B/W TVs conversion from RGB is linear green is much lighter than red, and red lighter than blue Q I

18 HSV Does Not Encode Luminance luminance Y of YIQ 0.299R G B luminance takes into effect that eye spectral response is wavelength- dependent value/intensity/brightness I/V/B of HSI/HSV/HSB 0.333R G B lose information!

19 Luminance and Gamma Correction humans have nonlinear response to brightness luminance 18% of X seems half as bright as X thus encode luminance nonlinearly: perceptually uniform domain uses bits efficiently high quality with 8 bits, instead of 14 bits if linear monitors, sensors, eye all have different reponses CRT monitors inverse nonlinear, LCD panels linear characterize by gamma displayedIntensity = a  (maxIntensity) gamma correction displayedIntensity = (maxIntensity) = a (maxIntensity) gamma for CRTs around 2.4

20 RGB Component Color (OpenGL) simple model of color using RGB triples component-wise multiplication (a0,a1,a2) * (b0,b1,b2) = (a0*b0, a1*b1, a2*b2) why does this work? because of light, human vision, color spaces,...

21 Lighting I

22 Rendering Pipeline Geometry Database Geometry Database Model/View Transform. Model/View Transform. Lighting Perspective Transform. Perspective Transform. Clipping Scan Conversion Scan Conversion Depth Test Depth Test Texturing Blending Frame- buffer Frame- buffer

23 Projective Rendering Pipeline OCS - object/model coordinate system WCS - world coordinate system VCS - viewing/camera/eye coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device/display/screen coordinate system OCS O2W VCS CCS NDCS DCSmodelingtransformationviewingtransformation projectiontransformation viewporttransformation perspective divide objectworld viewing device normalized device clipping W2VV2C N2D C2N WCS

24 Goal simulate interaction of light and objects fast: fake it! approximate the look, ignore real physics local model: interaction of each object with light vs. global model: interaction of objects with each other local global

25 Illumination in the Pipeline local illumination only models light arriving directly from light source no interreflections or shadows can be added through tricks, multiple rendering passes light sources simple shapes materials simple, non-physical reflection models

26 Light Sources types of light sources glLightfv(GL_LIGHT0,GL_POSITION,light[]) directional/parallel lights real-life example: sun infinitely far source: homogeneous coord w=0 point lights same intensity in all directions spot lights limited set of directions: point+direction+cutoff angle

27 Light Sources area lights light sources with a finite area more realistic model of many light sources not available with projective rendering pipeline (i.e., not available with OpenGL)

28 Light Sources ambient lights no identifiable source or direction hack for replacing true global illumination (diffuse interreflection: light bouncing off from other objects)

29 Diffuse Interreflection

30 Ambient Light Sources scene lit only with an ambient light source Light Position Not Important Viewer Position Not Important Surface Angle Not Important

31 Directional Light Sources scene lit with ambient and directional light Light Position Not Important Viewer Position Not Important Surface Angle Important

32 Point Light Sources scene lit with ambient and point light source Light Position Important Viewer Position Important Surface Angle Important

33 Light Sources geometry: positions and directions coordinate system used depends on when you specify standard: world coordinate system effect: lights fixed wrt world geometry demo: alternative: camera coordinate system effect: lights attached to camera (car headlights) points and directions undergo normal model/view transformation illumination calculations: camera coords

34 Types of Reflection specular (a.k.a. mirror or regular) reflection causes light to propagate without scattering. diffuse reflection sends light in all directions with equal energy. glossy/mixed reflection is a weighted combination of specular and diffuse.

35 Specular Highlights

36 Reflectance Distribution Model most surfaces exhibit complex reflectances vary with incident and reflected directions. model with combination + + = specular + glossy + diffuse = reflectance distribution

37 Surface Roughness at a microscopic scale, all real surfaces are rough cast shadows on themselves “mask” reflected light: shadow Masked Light

38 Surface Roughness notice another effect of roughness: each “microfacet” is treated as a perfect mirror. incident light reflected in different directions by different facets. end result is mixed reflectance. smoother surfaces are more specular or glossy. random distribution of facet normals results in diffuse reflectance.

39 Physics of Diffuse Reflection ideal diffuse reflection very rough surface at the microscopic level real-world example: chalk microscopic variations mean incoming ray of light equally likely to be reflected in any direction over the hemisphere what does the reflected intensity depend on?

40 Lambert’s Cosine Law ideal diffuse surface reflection the energy reflected by a small portion of a surface from a light source in a given direction is proportional to the cosine of the angle between that direction and the surface normal reflected intensity independent of viewing direction depends on surface orientation wrt light often called Lambertian surfaces

41 Lambert’s Law intuitively: cross-sectional area of the “beam” intersecting an element of surface area is smaller for greater angles with the normal.

42 Computing Diffuse Reflection depends on angle of incidence: angle between surface normal and incoming light I diffuse = k d I light cos  in practice use vector arithmetic I diffuse = k d I light (n l) always normalize vectors used in lighting!!! n, l should be unit vectors scalar (B/W intensity) or 3-tuple or 4-tuple (color) k d : diffuse coefficient, surface color I light : incoming light intensity I diffuse : outgoing light intensity (for diffuse reflection) nl 

43 Diffuse Lighting Examples Lambertian sphere from several lighting angles: need only consider angles from 0° to 90° why? demo: Brown exploratory on reflection ploratories/applets/reflection2D/reflection_2d_java_browser.html