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

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

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

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

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

CSE 167: Lecture #6: Color. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CSE 167: Introduction to Computer Graphics Lecture #5: Illumination Model

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

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)

Illumination & Shading

Comp 410/510 Computer Graphics. Spring Shading

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

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

Computer Graphics. Illumination and Shading

Lecture 1 Image Formation.

Illumination and Shading

CSE 681 Illumination and Phong Shading

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

Computer Graphics MTAT Raimond Tunnel

Lecture 15: Shading-I. CITS3003 Graphics & Animation

CPSC 314 LIGHTING AND SHADING

Illumination & Shading: Part 1

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

w Foley, Section16.1 Reading

Shading I Computer Graphics I, Fall 2008

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

Illumination Models & Shading

Shading. Brian Curless CSE 557 Autumn 2017

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

CS5620 Intro to Computer Graphics

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

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

Colour Reading: Chapter 6. Black body radiators

Simple Lighting/Illumination Models

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

Illumination in Computer Graphics

Visualisatie BMT. Rendering. Arjan Kok

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

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

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

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

Shading 1: basics Christian Miller CS Fall 2011

CS770/870 Spring 2017 Color and Shading

Light Transport Baoquan Chen 2017

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

CS-184: Computer Graphics. Today

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

Introduction to color science

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

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Illumination and Shading

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

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

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

Announcements. Lighting. Camera s sensor. HW1 has been posted See links on web page for readings on color. Intro Computer Vision.

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

CS6670: Computer Vision

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

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

Turn on the Lights: Reflectance

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

Complex Shading Algorithms

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

CS6670: Computer Vision

Computer Graphics. Illumination and Shading

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

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

CS 5625 Lec 2: Shading Models

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

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

CS 4600 Fall Utah School of Computing

Shading / Light. Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham

Introduction to Computer Graphics 7. Shading

CS635 Spring Department of Computer Science Purdue University

Lighting/Shading III. Week 7, Wed Mar 3

CS201 Computer Vision Lect 4 - Image Formation

(0, 1, 1) (0, 1, 1) (0, 1, 0) What is light? What is color? Terminology

Raytracing. COSC 4328/5327 Scott A. King

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

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

CPSC / Illumination and Shading

Introduction to Visualization and Computer Graphics

Why we need shading?

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

Virtual Reality for Human Computer Interaction

Light. Properties of light. What is light? Today What is light? How do we measure it? How does light propagate? How does light interact with matter?

CS5670: Computer Vision

CS-184: Computer Graphics. Announcements. Lecture #3: Shading. 03-Shading.key - January 28, 2014

CEng 477 Introduction to Computer Graphics Fall

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

CS-184: Computer Graphics. Announcements. Lecture #3: Shading. Wednesday, August 31, 11

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

Today we will start to look at illumination models in computer graphics

Sung-Eui Yoon ( 윤성의 )

Reflection and Shading

CS452/552; EE465/505. Intro to Lighting

The Rasterization Pipeline

Transcription:

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

Announcements Homework project #3 due this Friday, October 18 th Starts at 1:30pm as usual. Grading in order of names on white board in labs 260 and 270. Last day for late submissions of project #2: this Friday Next Monday: No new homework assignment, but midterm review session in Center Hall 105 at 3pm 2

Lecture Overview Color Color spaces Color reproduction on computer monitors Shading Introduction Local shading models 3

Color Reproduction How can we reproduce, represent color? One option: store full spectrum Representation should be as compact as possible Any pair of colors that can be distinguished by humans should have two different representations 4

Color Spaces Set of parameters describing a color sensation Coordinate system for colors Three types of cones, expect three parameters to be sufficient Why not use L,M,S cone responses? 5

Color Spaces Set of parameters describing a color sensation Coordinate system for colors Three types of cones We expect three parameters to be sufficient 6

Trichromatic Theory Claims that any color can be represented as a weighted sum of three primary colors Proposes red, green, blue as primaries Developed in 18 th and 19 th century, before discovery of photoreceptor cells (Thomas Young, Hermann von Helmholtz) 7

Tristimulus Experiment Given arbitrary color, we want to know the weights for the three primaries Yields tristimulus values Experimental solution CIE (Commission Internationale de l Eclairage, International Commission on Illumination), circa 1920 8

Tristimulus Experiment Determine tristimulus values for spectral colors experimentally 9

Tristimulus Experiment Spectral primary colors were chosen Blue (435.8nm), green (546.1nm), red (700nm) Matching curves for monochromatic target Weight for red primary Negative values! 10 Target (580nm)

Tristimulus Experiment Negative values Some spectral colors could not be matched by primaries in the experiment Trick One primary could be added to the source (stimulus) Match with the other two Weight of primary added to the source is considered negative Photoreceptor response and matching curves are different! 11

Tristimulus Values Matching values for a sum of spectra with small spikes are the same as sum of matching values for the spikes Monochromatic matching curves In the limit (spikes are infinitely narrow) 12

CIE Color Spaces Matching curves define CIE RGB color space CIE RGB values are color coordinates CIE was not satisfied with range of RGB values for visible colors Defined CIE XYZ color space Most commonly used color space today 13

CIE XYZ Color Space Determined coefficients such that Y corresponds to an experimentally determined brightness No negative values in matching curves White is XYZ=(1/3,1/3,1/3) Linear transformation of CIE RGB: 14

CIE XYZ Color Space Matching curves No corresponding physical primaries Tristimulus values Always positive! 15

Summary CIE color spaces are defined by matching curves At each wavelength, matching curves give weights of primaries needed to produce color perception of that wavelength CIE RGB matching curves determined using tristimulus experiment Each distinct color perception has unique coordinates CIE RGB values may be negative CIE XYZ values are always positive 16

Lecture Overview Color Color spaces Color reproduction on computer monitors Shading Introduction Local shading models 17

Summary CIE color spaces are defined by matching curves At each wavelength, matching curves give weights of primaries needed to produce color perception of that wavelength CIE RGB matching curves determined using trisimulus experiment Each distinct color perception has unique coordinates CIE RGB values may be negative CIE XYZ values are always positive 18

CIE XYZ Color Space Visualization Interpret XYZ as 3D coordinates Plot corresponding color at each point Many XYZ values do not correspond to visible colors 19

Chromaticity Diagram Project from XYZ coordinates to 2D for more convenient visualization Drop z-coordinate 20

Chromaticity Diagram Factor out luminance (perceived brightness) and chromaticity (hue) x,y represent chromaticity of a color Y is luminance CIE xyy color space Reconstruct XYZ values from xyy 21

Chromaticity Diagram Visualizes x,y plane (chromaticities) Pure spectral colors on boundary Colors shown do not correspond to colors represented by (x,y) coordinates! 22

Chromaticity Diagram Visualizes x,y plane (chromaticities) Pure spectral colors on boundary Weighted sum of any two colors lies on line connecting colors Colors shown do not correspond to colors represented by (x,y) coordinates! 23

Chromaticity Diagram Visualizes x,y plane (chromaticities) Pure spectral colors on boundary Weighted sum of any two colors lies on line connecting colors Weighted sum of any number of colors lies in convex hull of colors (gamut) Colors shown do not correspond to colors represented by (x,y) coordinates! 24

Gamut Any device based on three primaries can only produce colors within the triangle spanned by the primaries Points outside gamut correspond to negative weights of primaries Gamut of CIE RGB primaries Gamut of typical CRT monitor 25

RGB Monitors Given red, green, blue (RBG) values, what color will your monitor produce? I.e., what are the CIE XYZ or CIE RGB coordinates of the displayed color? How are OpenGL RGB values related to CIE XYZ, CIE RGB? Often you don t know! OpenGL RGB CIE XYZ, CIE RGB Gamut of CIE RGB primaries Gamut of typical CRT monitor 26

srgb Standard color space, with standard conversion to CIE XYZ Designed to match RGB values of typical monitor under typical viewing conditions (dimly lit office) If no calibration information available, it is best to interpret RGB values as srgb srgb roughly corresponds to 2.2 gamma correction srgb is supported by OpenGL as srgb textures (since OpenGL 2.1) srgb framebuffers (since OpenGL 3.0) 27

Video: Gamut Comparison Macbook Pro/Retina display compared to srgb http://www.youtube.com/watch?v=mifnztuehp4 srgb: solid line, Macbook Pro: wireframe 28

Conclusions Color reproduction on consumer monitors is less than perfect The same RGB values on one monitor look different than on another Given a color in CIE XYZ coordinates, consumer systems do not reliably produce that color Need color calibration But no selling point for consumers Standard for digital publishing, printing, photography Display calibration 29

Further Reading Wikipedia pages http://en.wikipedia.org/wiki/cie_1931_color_space http://en.wikipedia.org/wiki/cielab More details: CIE Color Space: http://www.fho-emden.de/~hoffmann/ciexyz29082000.pdf 30

Lecture Overview Color Color spaces Color reproduction on computer monitors Shading Introduction Local shading models 31

Shading Compute interaction of light with surfaces Requires simulation of physics Global illumination Multiple bounces of light Computationally expensive, minutes per image Used in movies, architectural design, etc. 32

Global Illumination Covered by CSE168 33 (All non-teapot images courtesy of Prof. Wann Jensen)

Interactive Applications No physics-based simulation Simplified models Reproduce perceptually most important effects Local illumination Only one bounce of light between light source and viewer 34 One bounce of light Surface

Rendering Pipeline Scene data Modeling and viewing transformation Shading Projection Scan conversion, visibility Position object in 3D Determine colors of vertices Per vertex shading Map triangles to 2D Draw triangles Per pixel shading 35 Image

Lecture Overview Color Color spaces Color reproduction on computer monitors Shading Introduction Local shading models 36

Local Illumination What gives a material its color? How is light reflected by a Mirror White sheet of paper Blue sheet of paper Glossy metal 37

Local Illumination Model reflection of light at surfaces Assumption: no subsurface scattering Bidirectional reflectance distribution function (BRDF) Given light direction, viewing direction, how much light is reflected towards the viewer For any pair of light/viewing directions! 38

Local Illumination Simplified model Sum of 3 components Covers a large class of real surfaces diffuse specular ambient 39

Local Illumination Simplified model Sum of 3 components Covers a large class of real surfaces diffuse specular ambient 40

Diffuse Reflection Ideal diffuse material reflects light equally in all directions View-independent Matte, not shiny materials Paper Unfinished wood Unpolished stone 41

Diffuse Reflection Beam of parallel rays shining on a surface Area covered by beam varies with the angle between the beam and the normal The larger the area, the less incident light per area Incident light per unit area is proportional to the cosine of the angle between the normal and the light rays Object darkens as normal turns away from light Lambert s cosine law (Johann Heinrich Lambert, 1760) Diffuse surfaces are also called Lambertian surfaces n n n 42

Diffuse Reflection Given Unit surface normal n Unit light direction L Material diffuse reflectance (material color) k d Light color (intensity) c l Diffuse color c d is: 43 Proportional to cosine between normal and light

Diffuse Reflection Notes Parameters k d, c l are r,g,b vectors Need to compute r,g,b values of diffuse color c d separately Parameters in this model have no precise physical meaning c l : strength, color of light source k d : fraction of reflected light, material color 44

Diffuse Reflection Provides visual cues Surface curvature Depth variation Lambertian (diffuse) sphere under different lighting directions 45

OpenGL Lights (gllight*) Values for light: Definition: (0,0,0) is black, (1,1,1) is white OpenGL Values for diffuse reflection Fraction of reflected light: Consult OpenGL Programming Guide (Red Book) See course web site 46

Local Illumination Simplified model Sum of 3 components Covers a large class of real surfaces diffuse specular ambient 47

Specular Reflection Shiny surfaces Polished metal Glossy car finish Plastics Specular highlight Blurred reflection of the light source Position of highlight depends on viewing direction Specular highlight 48

Specular Reflection Ideal specular reflection is mirror reflection Perfectly smooth surface Incoming light ray is bounced in single direction Angle of incidence equals angle of reflection 49

Law of Reflection Angle of incidence equals angle of reflection 50

Specular Reflection Many materials are not perfect mirrors Glossy materials 51 Glossy teapot

Glossy Materials Assume surface composed of small mirrors with random orientation (micro-facets) Smooth surfaces Micro-facet normals close to surface normal Sharp highlights Rough surfaces Micro-facet normals vary strongly Blurry highlight 52 Polished Smooth Rough Very rough

Glossy Surfaces Expect most light to be reflected in mirror direction Because of micro-facets, some light is reflected slightly off ideal reflection direction Reflection Brightest when view vector is aligned with reflection Decreases as angle between view vector and reflection direction increases 53

Phong Shading Model Developed by Bui Tuong Phong in1973 Specular reflectance coefficient k s Phong exponent p Greater p means smaller (sharper) highlight 54

Phong Shading Model 55

Blinn Shading Model (Jim Blinn, 1977) Modification of Phong Shading Model Defines unit halfway vector Halfway vector represents normal of micro-facet that would lead to mirror reflection to the eye 56

Blinn Shading Model The larger the angle between micro-facet orientation and normal, the less likely Use cosine of angle between them Shininess parameter s Very similar to Phong Model 57

Local Illumination Simplified model Sum of 3 components Covers a large class of real surfaces diffuse specular ambient 58

Ambient Light In real world, light is bounced all around scene Could use global illumination techniques to simulate Simple approximation Add constant ambient light at each point: k a c a Ambient light color: c a Ambient reflection coefficient: k a Areas with no direct illumination are not completely dark 59

Complete Blinn-Phong Shading Model Blinn-Phong model with several light sources I All colors and reflection coefficients are vectors with 3 components for red, green, blue diffuse specular ambient 60