Computer Graphics
Inf4/MSc
Computer Graphics
Lecture Notes #12
Colour: physics and light
Computer Graphics
Inf4/MSc
The Elements of Colour
Perceived light of different
wavelengths is in
approximately equal weights
– achromatic.
>80% incident light from
white source reflected from
white object.
<3% from black object.
Narrow bandwidth reflected
– perceived as colour
30/10/2007 Lecture Notes #12 2
Computer Graphics
Inf4/MSc
The Visible Spectrum
30/10/2007 Lecture Notes #12 3
Computer Graphics
Inf4/MSc
Measuring Light and
Colour
Physics: Radiometry
The amount of power per wavelength interval
• Termed radiance, we will often use intensity
• Psychophysics
Photometry
The relative brightness of a light source (colour or
black/white) when compared to a standard candle
• Termed luminance
Uniform perceptual scale
• Termed lightness
• Colourimetry
30/10/2007 Lecture Notes #12 4
Computer Graphics
Inf4/MSc
Colour Matching
Experiment.
Adjust brightness of 3 primaries to “match” colour
C - colour to be matched, RGB - laser sources (R=700 nm,
G=546 nm, B=435 nm)
C R G C R B G
B
C=R+G+B C+R=G+B
Therefore: humans have trichromatic color vision
30/10/2007 Lecture Notes #12 5
Computer Graphics
Inf4/MSc
Human Colour Vision.
• There are 3 light sensitive pigments in your cones (L,M,S),
each with different spectral response curve.
L = ∫ L (λ ) ⋅ E (λ )
M = ∫ M (λ ) ⋅ E (λ )
S = ∫ S (λ ) ⋅ E (λ )
• Biological basis of colour blindness
– genetic disease. © Pat Hanrahan.
30/10/2007 Lecture Notes #12 6
Computer Graphics
Inf4/MSc
Colour Matching is Linear!
Grassman’s Laws
1. Scaling the colour and the primaries by the
same factor
preserves the match :
2C=2R+2G+2B
2. To match a colour formed by adding two
colours, add
the primaries for each colour
C1+C2=(R1 +R2)+(G1 +G2 )+(B1 +B2)
30/10/2007 Lecture Notes #12 7
Computer Graphics
Inf4/MSc
Spectral Matching Curves
Red, Green & Blue primaries.
Match each pure colour
in the visible spectrum
with the 3 primaries, and
record the values of the
three as a function of
wavelength.
Note : We need to specify a negative amount
of one primary to represent all colours.
© Pat Hanrahan.
30/10/2007 Lecture Notes #12 8
Computer Graphics
Inf4/MSc
Luminance Compare colour source
to a grey source
• Luminance
Y = .30R + .59G + .11B
Colour signal on a B&W tv
(Except for gamma, of course)
• Perceptual measure : Lightness
L* = Y 1/3
30/10/2007 Lecture Notes #12 9
Computer Graphics
Inf4/MSc
CIE Colour Space
For only positive mixing coefficients, the CIE (Commission
Internationale d’Eclairage) defined 3 new hypothetical light
sources x, y and z (as shown) to replace red, green and blue.
Primary Y intentionally
has same response as
luminance response of
the eye.
The weights X, Y, Z
form the 3D CIE XYZ
space (see next slide).
30/10/2007 Lecture Notes #12 10
Computer Graphics
Inf4/MSc
Chromaticity Diagram.
CIE Colour Coordinates Often convenient to work
X 2.77 1.75 1.13 Rλ in 2D colour space, so 3D
Y = 1.00 4.59 0.06 G
λ colour space projected onto
Z 0.00 0.57 5.59 Bλ the plane X+Y+Z=1 to
X yield the chromaticity
x= diagram.
X +Y + Z
Normalise by the total
Y The projection is shown
y= amount of light energy.
X +Y + Z opposite and the diagram
Z appears on the next slide.
z=
X +Y + Z
30/10/2007 Lecture Notes #12 11
Computer Graphics
Inf4/MSc
CIE Chromaticity Diagram
C is “white” and close to x=y=z=1/3
The dominant wavelength of a
colour, eg. B, is where the line
E from C through B meets the
F D spectrum, 580nm for B (tint).
i B A and B can be mixed to
j produce any colour along the
C
line AB here including white.
A True for EF (no white this time).
k
True for ijk (includes white)
30/10/2007 Lecture Notes #12 12
Computer Graphics
Inf4/MSc
Some device colour “gamuts”
The diagram can be
used to compare the
gamuts of various
devices. Note
particularly that a
C colour printer can’t
reproduce all the
colours of a colour
monitor. Note no
triangle can cover
all of visible space.
30/10/2007 Lecture Notes #12 13
Computer Graphics
Inf4/MSc
Colour Cube.
R,G,B model is additive, i.e
we add amounts of 3
primaries to get required
colour.
Can visualise RGB space as
cube, grey values occur on
diagonal K to W.
30/10/2007 Lecture Notes #12 14
Computer Graphics
Inf4/MSc
Intuitive Colour Spaces.
Artist specification of colours Tints
resulting from a pure pigment : White
Saturated → Pure
• Tint – Adding white to a pure Pigment
pigment
Greys Tones
• Shade – Adding black to a pure Shades
pigment.
• Tone – Add both black & white.
Black
30/10/2007 Lecture Notes #12 15
Computer Graphics
Inf4/MSc
CMYK – subtractive colour model.
R = (1-C) (1-K) W
G = (1-M) (1-K) W
B = (1-Y) (1-K) W
K = G(1-max(R,G,B))
C = 1 - R/(1-K)
M = 1 - G/(1-K)
Y = 1 - B/(1-K)
30/10/2007 Lecture Notes #12 16
Computer Graphics
Inf4/MSc
Radiometry : Radiance.
Radiometry is the science of light energy measurement
Definition: The radiance (luminance) is the power per unit
area per unit solid angle.
W
L( x , w ) 2
m .sr
Properties:
1. Fundamental quantity
2. Stays constant along a ray
3. Response of a sensor proportional to radiance
30/10/2007 Lecture Notes #12 17
Computer Graphics
Inf4/MSc
Radiometry: Irradiance and Radiosity.
Definition: The irradiance (illuminance) is the power per
unit area incident on a surface.
E= ∫ L cosθ dω
2Π
i i i
W
E( x) 2
m
tion: The radiosity (luminosity) is the power per unit area leaving a sur
30/10/2007 Lecture Notes #12 18
Computer Graphics
Inf4/MSc
Irradiance: Distant Source
E = Es cosθ s
30/10/2007 Lecture Notes #12 19
Computer Graphics
Inf4/MSc
Irradiance: Point Source
Φ
E= cosθ s
4Π r 2
• Inverse square law fall off
• Still has cosine dependency.
30/10/2007 Lecture Notes #12 20
Computer Graphics
Inf4/MSc
What does Irradiance look like?
30/10/2007 Lecture Notes #12 21
Computer Graphics
Inf4/MSc
The Reflection Equation.
• Linear response
2. Bidirectional
reflectance
distribution function
(BRDF) defines
outgoing radiance for a
given incoming
irradiance –
characteristic property
Lr ( x, ω r ) = ∫f
2Π
x ( x, ω i → ω r ) Li ( x,of
ω i surface.
) cosθ i dω i
30/10/2007 Lecture Notes #12 22
Computer Graphics
Inf4/MSc
Approximating the BRDF.
• All illumination models in graphics are
approximations to the BRDF for surfaces.
• Frequently chosen for their visual effect,
and ease of implementation, rather than on
physical principles.
• BRDF is approximated by reflection
functions.
• Usually a total hack !
30/10/2007 Lecture Notes #12 23
Computer Graphics
Inf4/MSc
Types of Reflection Functions
• Ambient.
• Ideal Specular
– Mirror
– Reflection Law
• Ideal Diffuse
– Matte
– Lambert’s Law
• Specular
– Glossiness and
Highlights
– Phong and Blinn Models
30/10/2007 Lecture Notes #12 24
Computer Graphics
Inf4/MSc
Ambient Reflection.
• Simplest illumination model.
• There is assumed to be global ambient
illumination in the scene, Ia
• Amount of ambient light reflected from a
surface defined by ambient reflection
coefficient, ka.
• Ambient term is I = Ia.ka
• No physical basis whatsoever !
30/10/2007 Lecture Notes #12 25
Computer Graphics
Inf4/MSc
Mirror: Ideal Specular Surface
Calculation of the reflection vector involves
mirroring L about N.
Law of Reflection Both L and N are normalised.
Projection of L onto N is N cosθ
N
By vector subtraction and congruent triangles :
L S S R S = N cosθ − L
So :
N cosθ
θi θ R = 2 N cosθ − L
r
Subsitute N .L for cos θ :
R = 2 N .( N .L ) − L
θr= θi
30/10/2007 Lecture Notes #12 26
Computer Graphics
Inf4/MSc
Matte: Ideal Diffuse Reflection.
• Dull surfaces such as chalk exhibit diffuse
or Lambertian reflection.
• Reflect light with equal intensity in all
directions.
• For a given surface, brightness depends
only on the angle between the surface
normal and the light source.
30/10/2007 Lecture Notes #12 27
Computer Graphics
Inf4/MSc
Matte: Ideal Diffuse Reflection.
Ip N 2 effects to consider :
L • The amount of light reaching the
surface.
θ • Beam intercepts an area dA/ cos
θ
• cos θ dependence.
• The amount of light seen by the
θ
viewer.
dA dA • Also cos θ dependence per unit
cosθ surface area
• BUT amount of surface seen by
viewer also has cos θ dependence.
30/10/2007 Lecture Notes #12 28
Computer Graphics
Inf4/MSc
Matte: Ideal Diffuse Reflection.
Ip N
L
The diffuse lighting equation is :
θ
I = I p k d cosθ
If N and L are both normalized :
θ I = I p k d ( N .L )
dA dA
cosθ
30/10/2007 Lecture Notes #12 29
Computer Graphics
Inf4/MSc
Matte: Ideal Diffuse Reflection.
• Diffuse coefficient defined for each surface.
• Diffusely lit objects often look harshly lit
– Ambient light often added.
• Poor physical basis for diffuse reflection.
– Internal reflections inside the material etc…
30/10/2007 Lecture Notes #12 30
Computer Graphics
Inf4/MSc
Specular reflection.
• Can be observed on a shiny surface, e.g nice red
apple lit with white light.
• Observe highlights on surface.
• Highlight appears as the colour of the light, rather
than of the surface.
• Highlight appears in the direction of ideal
reflection. Now view direction important.
• Materials such as waxy apples, shiny plastics have
transparent reflective surface.
30/10/2007 Lecture Notes #12 31
Computer Graphics
Inf4/MSc
The Phong model.
R Assume specular highlight is at a
N maximum when α = 0 , and falls off
L rapidly with larger values of α
θ θ V • Fall-off depends on cosn α.
α
• n referred as specular exponent.
• For perfect reflector, n is infinite.
I λ = I a k a + I p [k d cosθ + k s cos n α ]
30/10/2007 Lecture Notes #12 32
Computer Graphics
Inf4/MSc
The Phong model.
H R • An alternative formulation uses
N halfway vector, H
L β
• It’s direction is halfway between
θ θ V viewer and light source.
α
• If the surface normal was oriented at
H, viewer would see brightest highlights.
H = (L +V ) / L +V • Note α ≠ β , both formulations are
approximations.
Specular term is now
( N .H )n
If viewer and light source at infinity, H is constant
30/10/2007 Lecture Notes #12 33
Computer Graphics
Inf4/MSc
Rough Surface : Microfacet distribution.
Physical justification for Phong model is
that the surface is rough and consists of
microfacets which are perfect specular
reflectors.
Distribution of microfacets determines
specular exponent.
L N
N′ R
30/10/2007 Lecture Notes #12 34
Computer Graphics
Inf4/MSc
Material Selection.
Ambient 0.52 Ambient 0.39
Diffuse 0.00 Diffuse 0.46
Specular 0.82 Specular 0.82
Shininess 0.10 Shininess 0.75
Light intensity 0.31 Light intensity 0.52
30/10/2007 Lecture Notes #12 35
Computer Graphics
Inf4/MSc
Summary of Lighting.
• Surface reflection specified by BRDF.
• BRDF approximated by ambient, diffuse
and specular reflection.
• Lambertian reflection.
• Phong Lighting model.
30/10/2007 Lecture Notes #12 36