light And Color - Computer Graphics At...

5
1 Light and Color CS148, Summer 2010 Siddhartha Chaudhuri 2 Rainbow over the Potala Palace, Lhasa, Tibet (Galen Rowell, 1981) 3 What is Light? Electromagnetic radiation “Light” usually refers to radiation visible to human eye Travels through vacuum at c = 299,792,458 m/s Travels through other media at lower speeds (Image: Wikimedia Commons) 4 Characteristics of Light electron positron electron positron photon Exhibits both wave and particle-like characteristics Has wavelength (λ), frequency (ν), amplitude etc. Emitted in discrete quanta, called photons Reconciled by quantum electrodynamics (Wikimedia Commons) 5 Light carries radiant energy Energy of a single photon = = A light source emits photons over time. Its power (energy per unit time) is called the radiant flux Φ. Let radiant flux of photons with wavelengths in range [λ + Δλ) be ΔΦ The spectral radiant flux at wavelength λ is Modeling radiant flux as a continuous function, this becomes the derivative Radiometry h hc d d 6 Some Spectral Radiant Flux Curves Outdoor daylight Incandescent bulb SP65 triphosphor fluorescent Mercury lamp © General Electric Co., 2010

Transcript of light And Color - Computer Graphics At...

1

Light and Color

CS148, Summer 2010

Siddhartha Chaudhuri

2Rainbow over the Potala Palace, Lhasa, Tibet (Galen Rowell, 1981)

3

What is Light?● Electromagnetic radiation

● “Light” usually refers to radiation visible to human eye● Travels through vacuum at c = 299,792,458 m/s

● Travels through other media at lower speeds

(Image: Wikimedia Commons) 4

Characteristics of Light

electron

positron

electron

positron

photon

● Exhibits both wave and particle-like characteristics● Has wavelength (λ), frequency (ν), amplitude etc.

● Emitted in discrete quanta, called photons

● Reconciled by quantum electrodynamics

(Wikimedia Commons)

5

● Light carries radiant energy● Energy of a single photon = =

● A light source emits photons over time. Its power (energy per unit time) is called the radiant flux Φ.

● Let radiant flux of photons with wavelengths in range [λ + Δλ) be ΔΦ

● The spectral radiant flux at wavelength λ is● Modeling radiant flux as a continuous

function, this becomes the derivative

Radiometry

h h c

d

d 6

Some Spectral Radiant Flux Curves

Outdoor daylight Incandescent bulb

SP65 triphosphor fluorescentMercury lamp

© General Electric Co., 2010

8

Why do I need to know all this?

To produce photorealistic images of virtual 3D scenes, by simulating actual light transport

(we won't study this too much in this course, take CS348b if you want an in-depth treatment)

9

Just to convince you...

© Arnold van Duursen, rendered with fryrender 10

Photometry● Perceptual study of light● Brightness, color etc. depend on the interaction of

our eyes with light

Rod (brown) and cone (green) cells(© Visuals Unlimited, 2009)

11

Photopic Luminous Efficiency

Overall sensitivity of human eye to different parts of the spectrum(in bright lighting conditions) 12

Tristimulus Theory

● Cone cells perceive color (less sensitive than rods)● Three types of cone cells: (L)ong, (M)edium and

(S)hort

0

1

0.5

Resp

onsi

vity

Wavelength (nm)

Normalized response curves of human cone cells

13

Tristimulus Theory● Presence of 3 cone types suggests: 3 parameters

describe all colors● Two light sources with different spectral

distributions can appear to be the same color. Such pairs are called metamers.

Different spectra can appear the same color (Hughes, Bell and Doppelt) 14

Color Matching Experiments

● Wright and Guild (1920s)● Choose lights of 3 different primary colors● Show a user single-wavelength light● Ask her/him to match it with a weighted combination

of the primaries● Primaries standardized by the CIE in 1931

● Red (R): 700 nm● Green (G): 546.1 nm● Blue (B): 435.8 nm

15

Examples

= + +

= +

=

= +

16

Grassmann's “Law”● Chromatic sensation is linear● Let:

● Beam 1 color-match (R1, G1, B1)

● Beam 2 color-match (R2, G2, B2)● Then:

● α · Beam 1 + β · Beam 2 matches(αR1 + βR2, αG1 + βG2, αB1 + βB2)

● Holds for any set of primaries of any size, defines additive color model

17

Color Matching Functions for CIE RGB

Amounts of the red, green and blue primaries needed to match any color 18

What's a negative amount of color???

● Mathematical convenience, doesn't really exist● Implies that experimenters had to add the

corresponding amount of primary to the source beam to get the colors to match

● It turns out there is no small set of physically realizable primaries such that any visible color is formed by combining them with positive weights

● And computing with negative numbers was tricky in 1931

19

Oops.

20

Enter CIE XYZ...● Luckily, the CIE has a solution...

… Let's have imaginary primaries (oh great...)● Construct linear, possibly non-realizable,

combinations of RGB primaries s.t. color matching functions are positive throughout visible range

● We have a great deal of flexibility in this choice● We want one color matching function to approximate

photopic luminous efficiency as closely as possible● Used to separate relative luminance (loosely, brightness)

from chromaticity (loosely, hue)

21

The CIE XYZ Primaries, 1931

M = [ 0.49 0.31 0.200.17697 0.81240 0.01063

0.00 0.01 0.99 ][XYZ ] = M [RGB ] [RGB ] = M−1 [XYZ ]

● Map RR + GG + BB to XX + YY + ZZ● Conversion between XYZ and RGB coordinates

● Note that M –1 has negative elements – XYZ basis is not physically realizable 22

Color Matching Functions for CIE XYZ

Amounts of the XYZ primaries needed to match any color(y function is precisely CIE-standardized photopic luminous efficiency, 1931)

23

xyY: Separate Chrom from Lum

y = YXYZ

x = XXYZ

● Formed nonlinearly from X, Y and Z

● x and y are chromaticity coordinates, Y is relative luminance coordinate

● Gamut: Set of colors that can be physically realized in a color space (without negative coefficients etc.)

24

CIE XYZ and RGB Chromaticity Gamuts

This part of the gamut (outside the sRGB triangle) cannot be displayed on normal monitors. It's shown here using the closest displayable colors

CIE Green

CIE Red

CIE Blue

Spectral colors (single-wavelength) lie on this curved boundary

CIE Y

CIE X

Nonspectral purples

CIE Z

sRGB

x

y

All visible chromaticities mapped to xy plane

25

Some More Color Representations

● sRGB: HDTV/monitor/digicam standard color space, similar to but smaller gamut than CIE RGB

● Perceptually uniform representations: Distance between two colors in color model reflects ability of humans to discriminate between them● HSL color model● HSV color model● L*a*b* color space

(SharkD@Wikimedia Commons) 26

Remember: Gamuts are actually 3D!

Colors projecting inside 2D sRGB chromaticity gamut may not be within true 3D gamut(Lindbloom, 2007)

27

Reflected Light (Pigments)

● Subtractive color model: color of pigment is defined by light it does not absorb

Different components of white light are absorbed by pigments

(C)yan, (M)agenta, (Y)ellow, (K)ey black: typical printer primaries

28

CMYK Separation is Not Unique

No black

Full black

(Images: Wikimedia Commons)

29

Raster Images● Array of pixels (picture elements)

● We'll consider only 2D arrays● Types of images

● Binary: 0/1 per pixel● Greyscale: Single value (channel) per

pixel, usually floating point numberin [0, 1] or byte in [0, 255]– 0: black, 1: white, intermediate value: grey

● Color: Multiple channels per pixel,usually RGB triplet– Interpretation depends on color space– Value of channel = weight of component

30

Raster Images● Resolution: Number of pixels

● 640x480, 1024x768 etc.● Color/Bit Depth: Number of bits per pixel

● 24-bit color image has 8 bits (1 byte) per channel● Transparency

● Alpha channel added to pixel (e.g. RGBA)● α = 0 ⇒ pixel is fully transparent● α = 1 ⇒ pixel is fully opaque

α = 0 α = 1