### Color and Radiometry

Digital Image Synthesisg g y
*Yung-Yu Chuang*

10/22/2009 10/22/2009

*with slides by Pat Hanrahan and Matt Pharr*

**Radiometry**

• Radiometry: study of the propagation of

electromagnetic radiation in an environment electromagnetic radiation in an environment

• Four key quantities: flux, intensity, irradiance d di

and radiance

• These radiometric quantities are described by their spectral power distribution (SPD)

• Human visible light ranges from 370nm to 730nmg g

**1** **1 0****2**

**1 0****4**

**1 0****6**

**1 0****8**

**1 0****1 0**

**1 0****1 2**

**1 0****1 4**

**1 0****1 6**

**1 0****1 8**

**1 0****2 0**

**1 0****2 2**

**1 0****2 4**

**1 0****2 6**

**Cosm ic**
**Ra y s**
**Ga m m a**

**Ra y s**
**X -Ra y s**

**Ultra -**
**V iolet**
**Infra -**

**Red**
**Ra d io**

**H ea t**
**Pow er**

**1 0****1 6**

**1 0****1 4**

**1 0****1 2**

**1 0****1 0**
**1 0****8**

**1 0****6**

**1 0****4**

**1 0****2**

**1** **1 0****-2**

**1 0****-4**

**1 0****-6**

**1 0****-8**
**Ra y s**
**Ra y s**

**V iolet**
**Red**

**W a velength (N M )**

**7 0 0** **6 0 0** **5 0 0** **4 0 0**

**IR** **R** **G** **B** **UV**

**Basic radiometry**

• pbrt is based on radiative transfer: study of the transfer of radiant energy based on radiometric transfer of radiant energy based on radiometric principles and operates at the geometric optics level (light interacts with objects much larger level (light interacts with objects much larger than the light’s wavelength)

It i b d th ti l d l H

• It is based on the particle model. Hence,

**diffraction and interference can’t be easily **
t d f

accounted for.

**Basic assumptions about light behavior**

**• Linearity: the combined effect of two inputs is **
equal to the sum of effects

equal to the sum of effects

**• Energy conservation: scattering event can’t **
produce more energy than they started with
produce more energy than they started with

**• Steady state: light is assumed to have reached **
equilibrium so its radiance distribution isn’t
equilibrium, so its radiance distribution isn t
changing over time.

**• No polarization: we only care the frequency of **

**• No polarization: we only care the frequency of **
light but not other properties (such as phases)

**• No fluorescence or phosphorescence: **

**• No fluorescence or phosphorescence: **

behavior of light at a wavelength or time

doesn’t affect the behavior of light at other g wavelengths or time

**Fluorescent materials**

**Spectral power distribution**

*fl* * li h (日光燈)*

400nm (bluish)

650nm (red) 550nm

(green)

*fluorescent light (日光燈)*

**Spectral power distribution**

*lemmon skin*

400nm (bluish)

650nm (red) 550nm

(green)

*lemmon skin*

**Color**

• Need a compact, efficient and accurate way to represent functions like these

represent functions like these

• Find proper basis functions to map the infinite- di i l f ll ibl SPD f ti

dimensional space of all possible SPD functions to a low-dimensional space of coefficients

• For example, B(λ)=1 is a trivial but bad approximation

**Color matching experiment**

p_{1} = 645.2 nm
p_{2} = 525.3 nm

444 4

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

p_{1 } p_{2 } p_{3}
p_{1 } p_{2 } p_{3}

p_{3} = 444.4 nm

**Color matching experiment**

**Color matching experiment**

• To avoid negative parameters

**Human Photoreceptors**

**Metamers**

different spectrum same perception different spectrum, same perception

t t (鎢絲) b lb l i i i

tungsten (鎢絲) bulb television monitor

**Why reflecting different colors**

high

heat/ light

heat/

chemical

g

low low

Light with specific wavelengths b b d

Fluorescent are absorbed.

**Primary colors**

Primary colors for

addition (light sources) Primary colors for

subtraction (reflection) ( g ) subtraction (reflection)

**Heat generates light**

• Vibration of atoms or electrons due to heat

generates electromagnetic radiation as well If generates electromagnetic radiation as well. If its wavelength is within visible light (>1000K), it generates color as well

it generates color as well.

• Color only depends on temperature, but not t f th bj t

property of the object.

• Human body radiates IR light under room temperature.

• 2400-2900K: color temperature of incandescent p light bulb

**Spectrum**

**• In core/color.***

N l i i li f f

• Not a plug-in, to use inline for performance

**• Spectrum** stores a fixed number of samples at
a fixed set of wavelengths. Better for smooth
functions. Why is this possible? Human vision system

**#define COLOR_SAMPLE 3**
**class COREDLL Spectrum {**

We actually sample RGB

**p**
**public:**

* <arithmetic operations>* component-wise
+ - * / comparison

**private:**

**float c[COLOR_SAMPLES];**

+ / comparison…

**...**

**}**

**Human visual system**

• Tristimulus theory: all visible *SPDs S can be *
accurately represented for human observers
accurately represented for human observers
*with three values, x*_{λ}*, y*_{λ}*and z*_{λ}.

Th b i th *t l t hi * X(λ)

*• The basis are the spectral matching curves, X(λ), *
Y(λ) and Z(λ) determined by CIE (國際照明委員

會) 會).

###

*S*

###

*X*

###

*d*

###

*x* ( ) ( )

###

###

###

###

###

*Y*

*d*

*S*

*y* ( ) ( )
)
(
)

(

###

###

###

###

###

*Z*

*d*

*S*

*z* ( ) ( )

**XYZ basis**

pbrt has discrete versions (sampled every 1nm) of these bases in core/color.cpp

**360** **830**

**XYZ color**

• Good for representing visible SPD to human observer, but not good for spectral computation. g p p

• A product of two SPD’s XYZ values is likely different from the XYZ values of the SPD which is the product of th t i i l SPD

the two original SPDs.

• Hence, we often have to convert our samples (RGB) into XYZ

into XYZ

**void XYZ(float xyz[3]) const {**
**xyz[0] = xyz[1] = xyz[2] = 0.;**

**for (int i = 0; i < COLOR_SAMPLES; ++i) {**
**xyz[0] += XWeight[i] * c[i];**

**[1] +** **YW i ht[i] *** **[i]**

**xyz[1] += YWeight[i] * c[i];**

**xyz[2] += ZWeight[i] * c[i];**

**}**
**}**
**}**

**Conversion between XYZ and RGB**

**float Spectrum::XWeight[COLOR_SAMPLES] = {**
**0.412453f, 0.357580f, 0.180423f**

**};**

**float Spectrum::YWeight[COLOR_SAMPLES] = {**
**0.212671f, 0.715160f, 0.072169f**

**};**

**float Spectrum::ZWeight[COLOR_SAMPLES] = {**
**0.019334f, 0.119193f, 0.950227f****,** **,**

**};**

**Spectrum FromXYZ(float x, float y, float z) {**
**float c[3];**

**float c[3];**

**c[0] = 3.240479f * x + -1.537150f * y + -**
**0.498535f * z;**

**c[1] = -0 969256f * x +** **1 875991f * y +**
**c[1] 0.969256f x + 1.875991f y + **
**0.041556f * z;**

**c[2] = 0.055648f * x + -0.204043f * y + **
**1.057311f * z;**

**return Spectrum(c);**

**}**

**Conversion between XYZ and RGB**

vector sampled at several

wavelengths such as (R,G,B)g ( , , ) (R,G,B)

950227 .

0 119193 .

0 019334 .

0

072169 .

0 715160 .

0 212671 .

0

180423 .

0 357580 .

0 412453 .

0

057311 1

204043 0

055648 0

041556 .

0 875992 .

1 969256 .

0

498535 .

0 537150 .

1 240479 .

device dependent 3

*x*_{λ}*, y*_{λ}*, z*_{λ}

*x*_{λ}*, y*_{λ}*, z*_{λ}

*S* *X* *d*

*x* ( ) ( )

0.055648 0.204043 1.057311

*d*
*Z*

*S*

*d*
*Y*

*S*
*y*

*d*
*X*

*S*
*x*

) ( ) (

) ( ) (

) ( ) (

*S* *Z* *d*

*z* ( ) ( )

**Basic quantities**

Fl (W)

non-directional Flux: power, (W)

Irradiance: flux density per area, (W/m^{2})

Intensity: flux density per solid angle directional Intensity: flux density per solid angle

Radiance: flux density per solid angle per area

**Flux (Φ)**

• Radiant flux, power

T l f i h h

• Total amount of energy passing through a surface per unit of time (J/s,W)

**Irradiance (E)**

• Area density of flux (W/m^{2})

*dA*
*E* *d*

*E* 2

*E*

*E* cos

Lambert’s law Inverse square law

*4 r* 2 *A* *A*

**Angles and solid angles**

• Angle ^{} ^{} _{r}_{r}^{l}

** circle has 2 radians**

• Solid angle ^{ } ^{A}

• Solid angle _{2}

*R*

*The solid angle subtended by a surface is defined as the *
*surface area of a unit sphere covered by the surface's *
*projection onto the sphere.*

**sphere has 4 steradians**

**Intensity (I)**

• Flux density per solid angle

I i d ib h di i ^{d}^{}l di ib i

*I* *d*

• Intensity describes the directional distribution of light

### ( ) *d* *I* ( ) ^{}

*d*

**Radiance (L)**

• Flux density per unit area per solid angle

*d*

*dA*
*d*

*L* *d*

• Most frequently used,

remains constant along ray remains constant along ray.

• All other quantities can b d i d f di

be derived from radiance

**Calculate irradiance from radiance** )

### , ( *x* *L*

*d*

###

###

^{d}###

*x*

*dA*

###

*L* *x*

###

*d*

###

*dA*
*x* *d*

*E*( ) ( , )cos **Light meter**

###

*dA*

**Irradiance Environment Maps**

R N

### ( , )

*L* *E* ( , )

**Radiance **

**Environment Map**

**Irradiance **

**Environment Map**
**Environment Map** **Environment Map**

**Differential solid angles**

Goal: find out the relationship
*between d* *and dθ d*

*d*

*between d* *and dθ, d*
Why? In the integral,
*d*

*d*

*r*

###

2

) (

*S*

*d*
*f*

y g

*dω is uniformly divided*^{.}
To convert the integral to

###

^{f}^{(}

^{}

^{,}

^{}

^{)}

^{d}^{}

^{d}^{}

We have to find the relationship
We have to find the relationship
*between d* and uniformly

*divided dθ and d*^{.}

**Differential solid angles**

• Can we find the surface area of a unit sphere b ?

###

^{2}

^{ }

by ?

###

0^{2}

^{ }0

*d*

^{}

*d*

^{}

###

0^{2}

^{ }0

*d*

^{}

*d*

^{}

**Differential solid angles**

Goal: find out the relationship
*between d* *and dθ d*

*d*

*between d* *and dθ, d*

By definition, we know that

*dA*

sin
*r*

*d*

*d*

*r* _{2}

*r*
*d* *dA*

^{2}

( )( sin )

sin

*dA* *r d* *r* *d*

*r* *d d*

2 sin

*d* *dA*_{2} sin *d d*

*d* *d d*

*r*

*d*
*d cos*

**Differential solid angles**

We can prove that ^{} ^{}

###

^{d}^{}

^{}

^{4}

^{}

*d*
sin

*r* ^{S}^{2}

###

^{d}*d*

*d*

*r*

sin

2

2

###

###

*d*
*d*

*S*

sin

sin

0 2

0

0 0

###

###

###

*d*
*d*

*d*
*d*

cos 2

^{1}

1

0 0

###

###

###

*d*

4

1

###

**Isotropic point source**

If the total flux of the light source is Φ

light source is Φ,

what is the intensity?

*I d*

###

2

### 4

*S*

### *I*

###

##

*4 I*

### *I* 4

###

###

**Warn’s spotlight**

If the total flux is Φ, what is the intensity?

### _{I} _{(} _{} _{)} _{} _{} ^{} ^{c} ^{cos}

_{I}

^{c}

^{S}^{} ^{} ^{}

^{}

^{2}

###

*otherwise* ) 0

### (

### 2

1 1

2

###

^{}

### ^{cos}

^{S}^{} ^{d} ^{cos} ^{} ^{d} ^{} ^{2} ^{c} ^{cos}

^{d}

^{d}

^{S}^{} ^{d} ^{cos} ^{}

^{d}

0 0

0

###

###

### ^{c}

^{c}

^{S}^{} ^{d} ^{} ^{d} ^{} ^{}

^{d}

^{d}

^{S}^{} ^{d} ^{}

^{d}

### 1 S

### c 2 0

### 1 1

### S c y 2

1 S

###

###

###

###

^{}