Вы находитесь на странице: 1из 30

CS3500

Computer Graphics
Module: Colours etc.

P. J. Narayanan
Spring 2005

CS3500
1

Story so far ...


3D Graphics involves projecting the 3D world to the 2D
image plane of the camera.
Involves a series of rigid transformations.
Complex objects/environments are described in their own
coordinate systems. Modelling places them in a world
coordinate system. This could involve a hierarchy of
transforms for objects made up of complex parts.
View Orientation computes the world in the VRC. This
gives the relative geometry of the world with respect to
the camera.
CS3500 February 10, 2005
2

Camera can be perspective or parallel, defined by 6


planes.
View Mapping or Normalizing Transformation maps
VRC to an orthographic canonical view volume. Different
for parallel and perspective cameras.
Projection is easy to perform here. An image with
dimensions from -1 to +1 results.
Viewport transformation scales and translates in 2D to
map to window coordinates (or frame buffer address).
Points of 3D primitives map to points of 2D primitives.
Scan-convert using standard algorithms.
CS3500 February 10, 2005
3

Rendering Pipeline

View View
Modelling Clipping Viewport
Orientation Mapping
Object World Camera Canonical Normalized Screen
Coords Coords Coords View Volume 2D Coords Coords

CS3500 February 10, 2005


4

What after scan conversion?


What do we write into the frame-buffer after identifying
which pixels belong to a primitive?

The colour and intensity!

Colour represented using Red, Green, and Blue. Why?

What about black/white/gray level?

What are the basics we need to know to design a good


Graphics system/application?

CS3500 February 10, 2005


5

Light
Light can be two types: Achromatic (without colour) or
Chromatic (coloured)

White (and gray) light contains all wavelengths. Coloured


light has a dominant wavelength.

White light can be split into VIBGYOR components by


passing through a prism.

CS3500 February 10, 2005


6

Visible Spectrum
Visible portion of the electromagnetic spectrum is what
we are interested in.

From about 400nm (Violet) to 700nm (Red).

Human sensitivity (luminous efficiency) is different for


different wavelengths: Peak is around 550nm (Green).

CS3500 February 10, 2005


7

Some Terms
Radiance: Light energy emitted by the source.

Luminance: Light energy that reaches the sensor.

Brightness: Perceived intensity or energy.

Lightness: Perceived intensity or energy of a reflecting


object.

CS3500 February 10, 2005


8

A Monochrome Display System


Number of different intensities: n+1 (say, 256).

: lowest intensity to be displayed. Highest is 1.0 = .




Human eye is sensitive to intensity ratios (logarithmic


response). (i.e, to is same as to ).












Thus, . Thus, .

















Intensities for each level (index): .





 







. Or, .























CS3500 February 10, 2005


9

CRT Monitor and Gamma Correction


Dynamic range ( ) is between 40 and 200. For






and , , and .

















CRT’s response is non-linear. , : #electrons






, the voltage. Thus, and .









for CRTs. needn’t double to double !







 

For each index , supply to the CRT.







For a given , round . .



















CS3500  February 10, 2005
10

How Many Intensity Levels?


Successive levels should be continuous, without edges.

From experiments, this means: . So use .








. Therefore , .




















The edges between levels not visible if this is satisfied.
CS3500 February 10, 2005
11

Typical values for different media (dynRange) :


CRT (50-200) 400-530 Prints (100) 465
Slides (1000) 700 Coated paper (100) 465
Newspaper (10) 234

In practice, fewer will suffice due to ink/light smearing.

256 levels have become a standard because it is good


enough and convenient for byte-oriented computers!!

CS3500 February 10, 2005


12

Halftone Approximations
Use spatial integration to simulate intensity levels on
bilevel display/hardcopy devices.
Halftoning (clustered-dot ordered dither): Print with
blackness in a small resolution unit.




levels using pixels. (5 levels with pixels)
















Dither Matrix: turn on pixels to display blackness .









A dither matrix:
















CS3500 February 10, 2005


13

Basics of colour
A bulb appears red if it emits light of in the red range.
A flower appears yellow because it absorbs light of all
wavelengths except in the yellow range.
Pure colours have a particular . Mixed colours have light
of different wavelengths.
Different perceptual colours have different spectral
energy distributions.
Different spectral distributions might “look” the same!
(Called metamers).
CS3500 February 10, 2005
14

Description of colour
Colour perception in terms of: Hue, Saturation, Value.

Hue: Pure colour or dominant wavelength.

Saturation: How far from white/gray or excitation purity.

Value/Intensity; The intensity/brighness or luminance.

In artists language: Mix black to a pure color to get its


shades. Mix white to get its tints. Mix black and white to
get grays. Mix all three to get tones.
CS3500 February 10, 2005
15

V
G Y

W
C R

B M

H
B S
CS3500 February 10, 2005
16

Human Colour Perception

Our retina has rods and cones. Rods see gray levels an
cones see colour.

Our retina has 3 types of cones: Red, Green, and Blue.

Their spectral responses respectively peak approximately


at 580nm, 545nm, and 440nm.

Luminous efficiency (to constant luminance light) of the


eye is a bell-shaped curve with a peak at about 550 nm.
CS3500 February 10, 2005
17

CS3500 February 10, 2005


18

CS3500 February 10, 2005


19

Tristimulus Theory
All perceivable colours can be specified as weighted
combination of primary colours R, G, and B.

RGB define a set of basis vectors. Mix them in different


measures to get any colour.

Attractive, because a compact representation is possible.

Problem reduces to: Find the values of R, G, B to produce


a given perceptual colour.

CS3500 February 10, 2005


20

Colour Matching
Computing the weights of R, G, B for a given colour.
Colour Matching Functions: distribution of weights for
RGB to match a given wavelength.
Unfortunately, has negative R
B
values for red in the G
450-550nm range.
Negative values are not
0
convenient for a device like
CRT, which can’t “take away” red.

CS3500 February 10, 2005


21

CIE XYZ Colour Model


A model called XYZ was standardized by the CIE in 1931.

All colour-matching functions are positive for them.

Colour-matching function of Y was designed to match the


luminous efficiency function of the eye.
Colour .







Chromaticity values defined by  . Obtained by







dividing by their sum. Thus, .












CS3500 February 10, 2005


22

CIE Chromaticity Diagram

A tongue-shaped diagram with pure colours along the


periphery. (CIE space cut by the plane).







Line between two colours obtained by mixing them.

“‘White” point lies close to .










Extend the line from white to any colour to the periphery.
Hue is the point on periphery and Saturation is the ratio
of distances from white to colour and peripheral point.

Complementary Colours: Mix to form white.


CS3500 February 10, 2005
23

CS3500 February 10, 2005


24

RGB Colour Model

Called the Additive Primaries.

Colour Cube: R+G = Yellow, R+B = Magenta,


G+B = Cyan, R+G+B = White, all zero gives Black.

Popular in graphics, as it is relevant for CRT Monitors.

Commonly, values are normalized to the range .










Grays lie along the diagonal from (0, 0, 0) to (1, 1, 1).
CS3500 February 10, 2005
25

B C

M W
B
G
R
Y

CS3500 February 10, 2005


26

CMY(K) Colour Model


Called the Subtractive Primaries.

Colour Cube: C+M = Blue, C+Y = Green,


M+Y = Red, C+M+Y = Black, all zero gives White.

Subtract RGB from 1.0, you get CMY, respectively.

Since black is common, is taken out as











black or K component. Yields the CMYK colour model
used in the 4-colour printing process.

CS3500 February 10, 2005


27

Interpolating in Colour Space


Simple, affine, transformation matrices between RGB,
CMY, YIQ, YUV, spaces.

Lines in one colour space map to corresponding lines in


the other space.

Thus, colour interpolation can be performed in any space.

Lines in RGB space map to something else in HSV space.

Interpolating HSV values is not valid.


CS3500 February 10, 2005
28

Colour in Computer Graphics


Tasteful use is mandated. Overuse and arbitrary use take
away from the message.

Golden rule: Less the better!.

Colour can effectively enhance the message.

Perceptual distance between colours is not the same as


the RGB distance!

Blues appear far and reds near. Unwise to use red for
background and blue for foreground.
CS3500 February 10, 2005
29

End of Class 18

CS3500 February 10, 2005

Вам также может понравиться