university of british columbia cpsc 314 computer graphics jan-apr 2005 tamara munzner cs314/vjan2005...

Post on 18-Dec-2015

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

University of British ColumbiaCPSC 314 Computer Graphics

Jan-Apr 2005

Tamara Munzner

http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005

Color

Week 5, Fri Feb 4

2

Review: Shading Models

flat shading compute Phong lighting once for entire

polygon Gouraud shading

compute Phong lighting at the vertices and interpolate lighting values across polygon

Phong shading compute averaged vertex normals interpolate normals across polygon and

perform Phong lighting across polygon

3

Correction: Phong Shading

linearly interpolating surface normal across the facet, applying Phong lighting model at every pixel same input as Gouraud shading pro: much smoother results con: considerably more expensive

not the same as Phong lighting common confusion Phong lighting: empirical model to calculate

illumination at a point on a surface

4

Review/Correction: Non-Photorealism

draw silhouettes and creases cool-to-warm shading

http://www.cs.utah.edu/~gooch/SIG98/paper/drawing.html

(n0 ⋅n1 ) ≤ threshold

5

Computing Normals per-vertex normals by interpolating per-facet

normals OpenGL supports both

computing normal for a polygon

c

b

a

6

Computing Normals per-vertex normals by interpolating per-facet

normals OpenGL supports both

computing normal for a polygon three points form two vectors

c

b

a

b-c

a-b

7

Computing Normals per-vertex normals by interpolating per-facet

normals OpenGL supports both

computing normal for a polygon three points form two vectors cross: normal of plane

c

b

a

b-c

a-b

(a-b) x (b-c)

8

Computing Normals per-vertex normals by interpolating per-facet

normals OpenGL supports both

computing normal for a polygon three points form two vectors cross: normal of plane

which side of plane is up? counterclockwise

point order convention

c

b

a

b-c

a-b

(a-b) x (b-c)

University of British ColumbiaCPSC 314 Computer Graphics

Jan-Apr 2005

Tamara Munzner

Color

10

Basics Of Color

elements of color:

11

Basics of Color

Physics: Illumination

Electromagnetic spectra Reflection

Material properties Surface geometry and microgeometry (i.e.,

polished versus matte versus brushed) Perception

Physiology and neurophysiology Perceptual psychology

12

Electromagnetic Spectrum

13

White Light

Sun or light bulbs emit all frequencies within the visible range to produce what we perceive as the "white light"

14

Sunlight Spectrum

15

White Light and Color

when white light is incident upon an object, some frequencies are reflected and some are absorbed by the object

combination of frequencies present in the reflected light that determinses what we perceive as the color of the object

16

Hue

hue (or simply, "color") is dominant wavelength

integration of energy for all visible wavelengths is proportional to intensity of color

17

Saturation or Purity of Light

how washed out or how pure the color of the light appears contribution of dominant light vs. other

frequencies producing white light

18

Intensity vs. Brightness

intensity : radiant energy emitted per unit of time, per unit solid angle, and per unit projected area of the source (related to the luminance of the source)

brightness : perceived intensity of light

19

Humans and Light when we view a source of light, our eyes respond

respond to hue: the color we see (red, green, purple)

dominant frequency saturation: how far is color from grey

(pink is less saturated than red, sky blue is less saturated than royal blue)

brightness: how bright is the color how close is the color to white or black how bright are the lights illuminating the object?

 

20

Physiology of Vision

the eye: the retina

rods cones

color!

21

Physiology of Vision

center of retina is densely packed region called the fovea. cones much denser here than the periphery

22

Trichromacy three types of cones

L or R, most sensitive to red light (610 nm) M or G, most sensitive to green light (560 nm) S or B, most sensitive to blue light (430 nm)

color blindness results from missing cone type(s)

23

Metamers a given perceptual sensation of color derives from the stimulus of all three cone types

identical perceptions of color can thus be caused by very different spectra

24

Metamer Demo http://www.cs.brown.edu/exploratories/freeSoftware/catalogs/color_theory.html

25

Adaptation, Surrounding Color

color perception is also affected by adaptation (move from sunlight to dark room) surrounding color/intensity:

simultaneous contrast effect

26

Bezold Effect

impact of outlines

27

Color Constancy

28

Color Constancy

29

Color Constancy

30

Color Constancy

31

Color Constancy

32

Color Constancy

33

Color Constancy

automatic “white balance” from change in illumination

vast amount of processing behind the scenes!

colorimetry vs. perception

34

Color Spaces

three types of cones suggests color is a 3D quantity. how to define 3D color space?

idea: perceptually based measurement shine given wavelength () on a screen user must control three pure lights producing

three other wavelengths (say R=700nm, G=546nm, and B=436nm)

adjust intensity of RGB until colors are identical this works because of metamers!

35

Negative Lobes

exact target match with phosphors not possible

some red had to be added to target color to permit exact match using “knobs” on RGB intensity output of CRT

equivalently (theoretically), some red could have been removed from CRT output

figure shows that red phosphor must remove some cyan for perfect match

CRT phosphors cannot remove cyan, so 500 nm cannot be generated

36

Negative Lobes

can’t generate all other wavelenths with any set of three positive monochromatic lights!

solution: convert to new synthetic coordinate system to make the job easy

37

CIE Color Space

CIE defined three “imaginary” lights X, Y, and Z, any wavelength can be matched perceptually by positive combinations

Note that:X ~ RY ~ GZ ~ B

38

Measured vs. CIE Color Spaces

measured basis monochromatic lights physical observations negative lobes

transformed basis “imaginary” lights all positive, unit area Y is luminance

39

CIE Color Space Gamut

the gamut of all colors perceivable is thus a three-dimensional shape in X,Y,Z

color = X’X + Y’Y + Z’Z

40

RGB Color Space (Color Cube) define colors with (r, g, b)

amounts of red, green, and blue used by OpenGL

RGB color cube sits within CIE color space something like this subset of perceivable colors

41

CIE Chromaticity Diagram (1931)

For simplicity, we often project to the 2D plane X’+Y’+Z’=1

X’ = X’ / (X’+Y’+Z’)Y’ = Y’ / (X’+Y’+Z’)Z’ = 1 – X’ – Y’

42

Device Color Gamuts

use CIE chromaticity diagram to compare the gamuts of various devices

43

Device Color Gamuts

Since X, Y, and Z are hypothetical light sources, no real device can produce the entire gamut of perceivable color

Example: CRT monitor

44

Gamut Mapping

45

YIQ Color Space

YIQ is the color model used for color TV in America. Y is brightness, I & Q are color note: Y is the same as CIE’s Y result: use the Y alone and backwards

compatibility with B/W TV!

46

Converting Color Spaces

converting between color models can also be expressed as a matrix transform

note the relative unimportance of blue in computing the Y

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

−−−=

⎥⎥⎥

⎢⎢⎢

B

G

R

Q

I

Y

31.052.021.0

32.028.060.0

11.059.030.0

47

HSV Color Space

a more intuitive color space H = Hue S = Saturation V = Value (or brightness)

ValueSaturation

Hue

48

Simple Model of Color

based on RGB triples surface interactions also simplified

49

50

The Gamma Problem

device gamma

monitor: I= A(k1D+k2V)

typical monitor =2.5 LCD: nearly linear

OS gamma defined by operating system

inverse gamma curve I1/

“gamma correction”

51

Display System Gamma

product of device and OS curves divide device by OS gammaDS D OS

display system gamma varies different devices, different OS nonlinear

viewing conditions also affect perception of “gamma”

PC Mac SGI

1.0 1.4 1.7

Default OS Gamma

PC Mac SGI

2.2 1.6 1.3

Default DS Gamma

52

Intensity Mapping

top related