PPT

advertisement
Photo-realistic Rendering and Global
Illumination in Computer Graphics
Spring 2012
Color Representation
K. H. Ko
School of Mechatronics
Gwangju Institute of Science and Technology
Overview


The growth of raster graphics has made color and gray scale
an integral part of contemporary computer graphics.
Color is an immensely complex subject.

The color of an object depends





The color of the object itself
The light source illuminating it
The color of the surrounding area
The human visual system.
Some objects reflect light, whereas others also transmit light.


When a surface that reflects only pure blue light is illuminated with pure
red light, it appears black.
A pure green light viewed through glass that transmits only pure red will
also appear black.
2
Color? Computer Graphics?
For realism in Computer Graphics
 Appropriate user interface design

 Use
of color makes the big difference.
Color models for easy color selection
 Color conversion between different media
 Useful for image processing and anti-aliasing

3
Achromatic Light

Achromatic light is what we see on a black-andwhite television set or display monitor.
 None
of the sensations we associate with red, blue, yellow,
etc.

Quantity of light is the only attribute of achromatic
light.
 Amount
of energy, brightness, or intensity and luminance
 It is useful to associate a scalar with different intensity
levels


0 as black and 1 as white
Gray levels for values between 0 and 1.
4
Selecting Intensities – Gamma
Correction

We want to display 256 different intensities. Which
256 intensity levels should we use???
 Evenly
distributed levels: They do not consider an
important characteristic of the eye.

Humans are actually tuned to the ratio of intensities, not their
absolute difference.



So going from a 50 to 100 watt light bulb looks the same as going
from 100 to 200.
So if we only have 4 intensities between 0 and 1, we should choose
to use 0, 0.25, 0.5 and 1.0.
For a uniformly distributed intensities, such as 0, 0.333, 0.666, 1.0

Poor resolution at low light levels, good resolution at high light level.
 The
intensity levels should be spaced logarithmically to
achieve equal steps in brightness.
5
Selecting Intensities – Gamma
Correction

I j +1 = I j =
r
Ij
I j -1
Equal steps in brightness :
I0 =I0, I1 =rI0, I2 =rI1 =r2I0, I3 =rI2 =r3I0,K,
I 255 = r 255 I 0 = 1

Therefore
-
r = (1/ I0)1/ 255, I j = r j I0 = (1/ I0) j / 255I0 = I0(255 j)/ 255
for 0  j  255

In general for n+1 intensities:
- j)/ n
r = (1/ I0 )1/ n, I j = I0(n
for 0  j  n
6
Selecting Intensities – Gamma
Correction

Example for 4 intensities
n = 3 (4 intensitie s) and I 0 = 1 / 8, r = 2,
intensity values of 1/8, 1/4, 1/2 and 1
Dynamic range: ratio of maximum to
minimum intensities, i.e., 1/I0
 Typical on CRT anywhere from 40:1 to 200:1
=> I0 between .005 and .025:
 Pixel values are NOT intensities: need
correction to compensate for nonlinearities

7
Selecting Intensities – Gamma
Correction

Nonlinearity in CRT

Therefore, for some other constant k:
g
I = kN
N = number of electrons in beam, proportional to grid
voltage, which is proportional to pixel value V
k and g are constants
g is typicallyin the range of 2.2 to 2.5
I = KV
g
,
g
or V = ( I / K ) 1 /
8
Selecting Intensities – Gamma
Correction
To display intensity I, find nearest Ij from a
table or: j = ROUND(logr(I/I0))
 Ij = rj I0, Vj = ROUND((Ij / K)1/γ)
 Number of intensities needed for appearance
of continuous intensity depends on ratio:
need r = 1.01 for Ij and Ij+1 to be
indistinguishable:

1/ n
r = (1 / I 0 )
or
1/ n
1 . 01 = (1 / I 0 )
9
Selecting Intensities – Gamma
Correction

How many intensities are enough??


r ≤ 1.01 (below this ratio, the eye cannot distinguish between
intensities Ij and Ij+1)
The number of intensities n:


r = (1/I0)1/n, 1.01 = (1/I0)1/n, n = log1.01(1/I0)
1/I0 : dynamic range of the device
Display Media
CRT
Photographic prints
Photographic slides
Coated paper printed in B/W
Coated paper printed in color
Newsprint printed in B/W
Typical Dynamic Range
50-200
100
1000
100
50
10
No. of Intensities, n
400-530
465
700
465
400
234
10
Halftone Approximation


Many hardcopy devices are bilevel: they
produce just two intensity levels.
How can we expand the range of
available intensities? -> Halftoning or
clustered-dot ordered dither

Make the most use of the spatial integration
that our eyes perform


If we view a very small area from a sufficiently
large viewing distance, our eyes average fine
detail within the small area and record only the
overall intensity of the area.
In printing B/W photographs in newspapers,
magazines and books, use a circle of black ink
whose area is proportional to the blackness 1-I
(I = intensity).
11
Halftone Approximation

In halftoning approximation, we have two different
cases.
 When
the image array being shown is smaller than the
display device’s pixel array.

Multiple display pixels can be used for one image pixel.
 When
the image array has the same size of display
device arrays.
12
Halftone Approximation

Example of a 2×2 dither pattern

For a n× n group of bilevel pixels: n2+1 intensity levels


For a 3× 3 case
6 8 4 
1 0 3 


5 2 7 
To display an intensity I, we turn on all pixels whose values are
less than I.
13
Halftone Approximation

The n × n pixel pattern must be designed not to
introduce visual artifacts in a n area of identical
intensity values.
 No
artifacts
 Growth sequence
 Growing outward from the center
 Clustering of dots (dot adjacency)
14
Halftone Approximation

Dither matrix for a CRT display: Ability to display
individual dots.

For 4 x 4 case
15
Halftone Approximation

In halftoning approximation, we have two different
cases.
 When
the image array being shown is smaller than the
display device’s pixel array.

Multiple display pixels can be used for one image pixel.
 When
the image array has the same size of display
device arrays.
16
Halftone Approximation

Whether or not to intensify the pixel at point (x,y) depends
on the desired intensity S(x,y) at that point and on the dither
matrix.



i = x modulo n, j = y modulo n.
If S(x,y) > D(n)ij, then the point at (x,y) is intensified.
Another way to handle this case: Error diffusion

The error is added to the values of the four image array pixels to the
right of and below the pixel in question.
17
Chromatic Color


The visual sensations caused by colored light are much
richer than those caused by achromatic light.
Color perception involves three quantities.

Hue distinguishes among colors such as red, green, purple, and yellow
 Saturation refers to how pure the color is, how much white/gray is mixed
with it
 red saturated; pink unsaturated
 royal blue saturated; sky blue unsaturated
 pastels are less vivid, less intense
 Lightness: perceived achromatic intensity of reflecting object (reflection)

Brightness: perceived intensity of a self-luminous object,
such as a light bulb, the sun, or a CRT (emission)
18
Chromatic Color

It is necessary to specify and measure colors if we
are to use them precisely in computer graphics.
 Compare
colors against a set of standard colors under a
standard light source.


The perceived color of a surface depends both on the surface
and on the light under which the surface is viewed.
Munsell color system is widely used. It is organized in a 3D
space of hue, value (lightness) and chroma (saturation).
19
Chromatic Color

Artists specify color as different
tints, shades and tones of strongly
saturated, or pure, pigments.
 Tint
: results from adding white White
pigment to a pure pigment,
decreasing saturation.
Grays
 Shade : comes from adding a black
pigment to a pure pigment,
Black
decreasing lightness
 Tone : is the consequence of adding
both black and white pigments to a
pure pigment.
Decrease saturation
Tints
“Pure”
color
Decrease
lightness
Tones
Shades
20
Color Mixture

Subtractive vs. Additive Mixture
Subtractive Mixture
Additive Mixture
21
Color Mixture

Subtractive Mixture
 Subtractive mixture
starts with the presence of all colors of
light, usually as white light reflected from a white surface,
such as a piece of paper. Then dyes, inks, or filters are used
to subtract some of the reflected light.
 Subtraction occurs when a color is absorbed and the others
are reflected.

If we put yellow paint or ink on a white piece of paper, it seems
like we're adding color to the paper. But the color is already there;
the white paper reflects all colors of light, approximately equally.
The yellow ink, however, reflects only red and green light. It
absorbs blue light, thereby subtracting it from the white light.
22
Color Mixture

Subtractive Mixture
 First
color reflects 420 - 520 nanometers (broad-band blue
filter), while second reflects 480 - 660 nanometers (broadband yellow filter). Light that can be reflected through both
is in 480 - 520 nanometers, which appears green.
23
Color Mixture

Additive Mixture
 Additive
color mixture begins with the absence of
light (black), and adds colors of light together to
form new colors.
 Additive mixture is used to mix R, G, B guns of
CRT.
 When all three of the additive primary colors are
added together, in approximately equal intensities,
they produce white light.
24
Color Mixture

Additive Mixture
 The
red color we use for additive color mixture is
comprised of the light from one-third of the spectrum. The
green color is another third of the spectrum. And the blue
color is the remaining third.
 Where two colors overlap, or are added together, their
combined light accounts for two-thirds of the spectrum.
(1/3 + 1/3 = 2/3) Those combinations always produce the
colors cyan, magenta, and yellow.
 Where all three colors overlap, the entire spectrum is
present, so we see white light.
Blue and yellow generates gray.
25
Color Mixture

Example of Additive Mixture Technique
 Pointillists Technique
 Color daubs (left detail) mix additively at a distance.
 Creates bright colors where mixing pigments darkens
(subtractive)
 Seurat’s color use and theories about light.
26
Psychophysics

The Munsell and artists’ pigment-mixing
methods are subjective.
 They
depend on human observers’ judgments, the
lighting, the size of the sample, the surrounding
color, etc.

An objective, quantitative way of specifying
colors is needed. : Colorimetry, the branch of
science about color.
 Dominant
wavelength, excitation purity and
luminance.
27
Colorimetry

Dominant wavelength
 The
wavelength of the color we see when viewing
the light

Excitation purity
 The
proportion of pure light of the dominant
wavelength and of white light needed to define the
color.

A completely pure color is 100 percent saturated and thus
contains no white light.
28
Colorimetry
Dominant
Wavelength
e2
Energy
Density
e1
400


700
Dominant wavelength → hue we see
Excitation purity = ratio of monochromatic light of dominant
wavelength, white light to produce color



wavelength, nm
e1 = e2, excitation purity is 0% (unsaturated)
e1 = 0, excitation purity is 100% (fully saturated)
Luminance relates to total energy, proportional to integral of
luminous efficiency function. It depends on both e1 and e2
29
Colorimetry

Colorimetry: quantitative; measurement via
spectroradiometer (measures reflected/radiated
light), colorimeter (measures primary colors),
etc.
Perceptual term
Hue
Saturation
Lightness (reflecting objects)
Brightness (self-luminous objects)
Colorimetry term
Dominant wavelength
Excitation purity
Luminance
Luminance
30
Colorimetry


Spectral color: single wavelength (e.g., from laser); “ROY G. BIV”
spectrum
Non-spectral color: combination of spectral colors. It can be shown as
continuous spectral distribution. Most colors are non-spectral mixtures
White light spectrum where height of
curve is spectral energy distribution

Metamers are spectral energy distributions that are perceived as same
“color”
 The relationship between spectral distributions and colors is many-toone.
31
Tristimulus Theory

The hypothesis that the retina
has three kinds of color
sensors (called cones), with
peak sensitivity to red, green
or blue light.
 The
curves suggests that the
eye’s response to blue light is
much less strong than is its
response to red or green.
32
Tristimulus Theory

Luminous-efficiency function
 The
eye’s response to light of
constant luminance has a peak
sensitivity to yellow-green
light of wavelength around
550nm.
33
Color Matching (Tristimulus Theory)

The theory explains loosely
the notion that colors can be
specified by positively
weighted sums of red, green
and blue (the primary colors).


The Color-matching functions shows
the amounts of red, green, and blue
light needed by an average observer
to match a color of constant
luminance, for all values of
dominant wavelength in the visible
spectrum.
Mixing positive amounts of
arbitrary R, G, B primaries
provides large color gamut, e.g.,
display devices
r
b
g
r

Wavelength λ (nm)
Some colors cannot be produced
by RGB mixes
34
Color Matching (Tristimulus Theory)

The coordinates B, G,
and R are called the
tristimulus values with
respect to that set of
primaries.
r
b
g
r

Wavelength λ (nm)
35
CIE Chromaticity Diagram

Matching and defining a colored light with a mixture of
three fixed primaries is a desirable approach to
specifying color.
 The

need for negative weights is awkward.
The Commission Internationale de l’Éclairage (CIE)
defined three standard primaries.
 X,
Y and Z to replace red, green and blue in the matching
process.
 xλ, yλ, and zλ, color matching functions for these primaries
Y
chosen so that yλ matches luminous efficiency function
 xλ, yλ, and zλ are linear combinations of rλ, gλ, and bλ =>
RGBi  XYZi via a matrix
36
CIE Chromaticity Diagram

The mathematical color matching functions xλ
yλ, and zλ for the 1931 CIE X, Y, and Z
primaries. They are defined tabularly at 1 nm
intervals for color samples that subtend 2°
field of view on retina
37
CIE Chromaticity Diagram


The amount of X, Y, Z
primaries needed to
match a color with a
spectral energy
distribution P(λ) are
k value
 Self-luminous
object, i.e.
CRT k = 680
 Reflecting objects
 P ( ) x d 
k  P ( ) y  d 
k  P ( ) z d 
X = k
Y =
Z =
k=
100
P
w
(  ) y  d
Pw(λ) is the spectral energy
distribution for whatever light
source is chosen as the
standard for white.
38
CIE Chromaticity Diagram

For a given color C: C = XX + YY + ZZ
X + Y + Z = 1 plane
39
CIE Chromaticity Diagram

Chromaticity values
 Depend
only on dominant wavelength and saturation and
are independent of the amount of luminous energy
 Is normalized against X + Y + Z, which can be thought of
as the total amount of light energy
x =
y =
z =
X
X + Y + Z
Y
X +Y + Z
Z
X + Y + Z
x + y + z = 1; (x,y,z) lies on X + Y + Z = 1
plane
(x, y) determines z but cannot recover X, Y, Z
from only x and y. Need one more piece of
data, Y, which carries luminance data
( x, y, Y ), X =
x
1- x - y
Y, Y = Y, Z =
Y
y
y
40
CIE Chromaticity Diagram

Chromaticity values
 CIE
chromaticity diagram is projection onto (X, Y) plane of
(X + Y + Z ) = 1 plane



The interior and boundary of the horseshoeshaped region represent all visible chromaticity
values
 All perceivable colors with the same
chromaticity but different luminance map
into the same point within this region
The 100 percent spectrally pure colors of the
spectrum are on the curved part of the
boundary.
A standard white light, meant to approximate
sunlight, is formally defined by a light source
illuminant C, marked by the center dot.
41
CIE Chromaticity Diagram
Color Matching/Naming

It allows us to measure the dominant
wavelength and excitation purity of any color
by matching the color with a mixture of the
three CIE primaries.
 Colorimeters
measure tristimulus X, Y, and Z
values, from which chromaticity coordinates are
computed.
 Spectroradiometers measure both the spectral
energy distribution and the tristimulus values.
42
CIE Chromaticity Diagram
Color Matching/Naming

When two colors are added together, the
new color lies somewhere on the straight
line in the chomaticity diagram connecting
the two colors being added.

The matched color is at point A.




Color A can be thought of as a mixture of
standard white light (illuminant C) and the pure
spectral light at point B.
B defines the dominant wavelength.
The ratio of length AC to length BC, expressed
as a percentage, is the excitation purity of A.
The closer A is to C, the more white light A
includes and the less pure it is.
43
CIE Chromaticity Diagram
Color Matching/Naming
 The chomaticity diagram
factors out
luminance.
Color
sensations that are luminance-related
are excluded.
 Brown,
which is an orange-red chromaticity at
very low luminance relative to its surrounding
are, does not appear.
The
chromaticity diagram is not a full color
palette.
44
CIE Chromaticity Diagram
Color Matching/Naming
 Complementary Colors
 Those
that can be mixed to
produce white light.

D and E in the right figure.
 Colors
that cannot be defined by
a dominant wavelength are
called nonspectral.


The dominant wave length is said
to be the complement of the
wavelength at which the line
through F and C intersects the
horseshoe part of the curve at point
B.
Example : purples and magentas
which occur in the lower part of the
CIE diagram.
45
CIE Chromaticity Diagram
Define Color Gamuts or Color Ranges
 Show the effect of adding
colors together.
 Any
two colors, I and J, can be
added to produce any color
along their connecting line by
varying the relative amounts of
the two colors being added.
A
third color K can be used with
various mixtures of I and J to
produce the gamut of all colors
in triangle IJK by varying
relative amounts.
46
CIE Chromaticity Diagram
Color Gamut Comparison
 The smallness of the print
gamut with respect to the
color-monitor gamut suggests
that
 If
images originally seen on a
monitor must be faithfully
reproduced by printing, a
reduced gamut of colors should
be used with the monitor.
 Otherwise,
accurate reproduction
will not be possible.
The x, circle and square indicate the
white points for the print, color
monitor and film gamuts, respectively.
47
Download