0% found this document useful (0 votes)
92 views69 pages

Unit-4 Illumination & Colour Models

Uploaded by

Bhumika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views69 pages

Unit-4 Illumination & Colour Models

Uploaded by

Bhumika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 69

ILLUMINATION MODELS &

SHADING
Illumination Models and Shading
• Light Source Models
• Ambient Illumination
• Diffuse Reflection
• Specular Reflection
• Polygon Rendering Methods
• Flat Shading
• Gouraud Shading
• Phong Shading
Illumination Model Parameters
•Lighting effects are described with models that consider the
interaction of light sources with object surfaces

•The factors determining the lighting effects are:


– The light source parameters:
• Positions
• Electromagnetic Spectrum
• Shape
– The surface parameters
• Position
• Reflectance properties
• Position of nearby surfaces
– The eye (camera) parameters
• Position
• Sensor spectrum sensitivities
Illumination Models and Rendering
•An illumination model is used to calculate the
intensity of the light that is reflected at a given
point on a surface
•A rendering method uses intensity calculations
from the illumination model to determine the light
intensity at all pixels in the image
Illumination Models
•Motivation: In order to produce realistic images,
we must simulate the appearance of surfaces under
various lighting conditions

•Illumination Model: Given the illumination


incident at a point on a surface, quantifies
the reflected light
Light Source Models
• Point Source (a): All light rays originate at a point and
radially diverge. A reasonable approximation for sources
whose dimensions are small compared to the object size
• Parallel source (b): Light rays are all parallel. May be
modeled as a point source at infinite distance (the sun)
• Distributed source (c): All light rays originate at a finite
area in space. It models a nearby source, such as a
fluorescent light c
b
a
Illumination Models
• Simplified and fast methods for calculating
surfaces intensities, mostly empirical
• Calculations are based on optical properties
of surfaces and the lighting conditions (no
reflected sources nor shadows)
• Light sources are considered to be point
sources
• Reasonably good approximation for most
scenes
Ambient Illumination
• Assume there is some non-directional light
in the environment (background light)

• The amount of ambient light incident on


each object is constant for all surfaces and
over all directions

• Very simple model, not very realistic

• OpenGL default
Ambient Illumination
• Example:
Ambient Illumination
• The reflected intensity Iamb of any point on the
surface is:

Iamb = Ka Ia
Ia - ambient light intensity
Ka  [0,1] - surface ambient reflectivity

• In principle Ia and Ka are functions of color, so we


have IRamb, IGamb and IB
Diffuse Reflection
• Diffuse (Lambertian) surfaces are rough or grainy,
like clay, soil, fabric

• The surface appears


equally bright from all
viewing directions

• The brightness at each L


N
point is proportional to 

cos()
Diffuse Reflection
• Brightness is proportional to cos() because a
surface (a) perpendicular to the light direction is
more illuminated than a surface (b) at an oblique
angle

a b

L
N

Diffuse Reflection
• The reflected intensity Idiff of a point on the
surface is:

Idiff = Kd Ipcos() = Kd Ip(NL)

Ip - the point light intensity. May appear as


attenuated source fatt(r)IP
Kd  [0,1] - the surface diffuse reflectivity
N - the surface normal
L - the light direction

NOTE: If N and L have unitary length:


Diffuse Reflection
• Example:
Diffuse Reflection
• Example: diffuse reflection from different
light directions
Diffuse Reflection
• Commonly, there are two types of light sources:
– A background ambient light
– A point light source

• The equation that combines the two models is:

I = Idiff + Iamb = Kd Ip NL + Ka Ia

• Note this is the model for one color and it should


be replicated for each channel: IR, IG and IB
Diffuse Reflection
• Example:
0.6 Kd
0 0.3

0.3

0.5

0.7
Ka
Specular Reflection
• Models shiny and glossy surfaces (like metal,
plastic, etc..) with highlights
• Reflectance intensity changes with reflected
angle
• An ideal specular surface (mirror) reflects light
exclusively in one direction: R
• Glossy objects are not ideal mirrors and reflect
in the immediate
N vicinity of R N
L R L
    V
 R

Ideal specular surface Non-ideal specular surface


Specular Reflection
• The Phong Model: reflected specular intensity
falls off as some power of cos ():

Ispec = Ks Ipcosn() = Ks Ip(RV)n


Ks - the surface specular reflectivity
n – specular reflection parameter, determining
the deviation from ideal specular surface
(for a perfect mirror n=)
N
L
   V
R

Specular surface
Specular Reflection
• The Phong Model: plots of cosn() for three
values of the specular parameter n
1

n=1
0.8
n=8
N
n=64
0.6 L
  R
V
0.4

0.2
Specular surface

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Specular Reflection
•The illumination equation combined with diffuse
reflection is:
I = Iamb+Idiff+Ispec=
Ka Ia + Ip (Kd NL + Ks (RV)n)

• If k light sources are present in the scene:

I= Iamb+k (Ik diff+Ik spec)


Specular
• Example:
Reflection
0.2 0.5 0.8 Ks

0.3

0.7

Kd
Specular Reflection
• Example: effects of the specular parameter n

n=50

n=10

n=3
Specular
• Example:
Reflection

Ambient Illumination

Ambient + Diffuse

Ambient + Diffuse + Specular


Composing Light Sources
• Example:
Polygon Rendering Methods
• A freeform surface can be approximated
by polyhedra

• Rendering: calculate the illumination at


each surface point

• Applying the illumination model at each


surface point is computationally expensive
Flat Shading
• A single intensity is calculated for each surface
polygon
• Fast and simple method
• Gives reasonable result only if all of the following
assumptions are valid:
– The object is a polyhedron
– Light source is far away
from the surface so that
N•L is constant over each
polygon
– Viewing position is far away
from the surface so that V•R
is constant over each polygon
Gouraud Shading
• Renders the polygon surface by linearly
interpolating intensity values across the surface

Gouraud Shading Algorithm:


1. Determine the normal at each polygon
vertex
2. Apply an illumination model to each vertex to
calculate the vertex intensity
3. Linearly interpolate the vertex intensities over
the surface polygon
Gouraud Shading
•The normal Nv of a vertex is an average of all
neighboring normals:
 N k
N V  k

 N k
k
Gouraud Shading
• Interpolation of the vertex intensities
y
I3

I1 IP
scan line
I4 I5
I2
x
y  y y  y
I4  4 2
I1  1 4
I2
y 1  y 2 y 1  y 2

y  y y 
I5  5 2
I3  3 5
I2
y 3  2
yy 3  y 2
y
x 
Ip  5
 xx
p
I4  x p 4
I5
xx 5  4 x 5  x 4
Gouraud Shading
• Example: Gouraud shading of a sphere
Phong Shading

• A more accurate method for rendering a


polygon surface is to interpolate normal
vectors, and then apply the illumination
model to each surface point

•Phong Shading Algorithm:


1. Determine the normal at each polygon
vertex
2. Linearly interpolate the vertex normals
over the surface polygon
3. Apply the illumination model along each scan
Phong Shading
• Example: Phong shading of a sphere
Polygon Rendering Methods
• Example:

Flat

Gouraud

Phong
Polygon Rendering Methods
• Example:

Flat

Gouraud

Phong
Polygon Rendering Methods
• Example:

Flat Gouraud

Phong
Computer Graphics
Color Models

38
Outline:
Properties of Light
Color Models
Standard primaries and the chromaticity diagram
The RGB color model
The YIQ and related color model
The HSV color model
The HSL Color model
The CMY and CMYK Color models
Color Models Applications
Dithering VS Half-toning 39
Properties of Light

FIGURE-1

Each frequency value within the visible region of the electromagnetic spectrum
corresponds to a distinct spectral color.
40
Properties of Light
• When white light is incident on an opaque object , some frequencies
are reflected and some are absorbed.
• The combination of frequencies present in the reflected in the
reflected light determines the color of the object that we see.
(Dominant frequency or Hue)

41
Properties of Light

Period (T)

42
Characteristics of Color

1. Dominant Frequency (Hue)


The color we see (red, green,
purple).

2. Brightness
The total light energy, how bright is the color (How bright
are the lights illuminating the object?)

3. Purity (Saturation)
Purity describes how close a light appears to be to a pure
spectral color, such as pink is less saturated than red.

Chromaticity refers to the two properties (purity & hue)


together. 43
Color Model

• A color model is an abstract mathematical model


describing the way colors can be represented as tuples of
numbers, typically as three or four values or color
components. [Wikipedia]

• Any method for explaining the properties or behavior of


color within some particular context is called a Color
Model.[Hearn, Baker ,computer graphics with OpenGL]

44
Color Model
Primary Colors
Sets of colors that can be combined to make a useful range of
colors

Color Gamut
Set of all colors that we can produce from the primary colors.

Complementary Colors
Pairs of colors which, when combined in the right proportions,
produce white.

Example, in the RGB model: red & cyan , green & magenta , blue
& yellow.

• No finite set of real primary colors can be combined to produce all possible
visible colors.

• However, given a set of three primary colors, we can characterize any fourth
color using color-mixing processes.
45
Color Model
Shades , Tints & Tones
• A shade is produced by “dimming ” a hue.[Adding black].
Dark Blue = pure blue + black

• A tint is produced by "lightening" a hue. [Adding white].


Pastel red = pure red + white

• Tone refers to the effects of reducing the "colorfulness" of a hue. [adding gray] or
[adding black & white].

Thus, shading takes a hue toward black, tinting takes a hue


towards white, and tones cover the range between.
46
Color Model

Additive color
Uses light to display color. Mixing begins with black and ends with white; as more
color is added, the result is lighter and tends to white. Used for computer displays
Example: The RGB colors are light primaries and colors are created with light.

A subtractive color
Uses ink to display color. Mixing means that one begins with white and ends with
black; as one adds color, the result gets darker and tends to black. Used for printed
material

It is called 'subtractive' because its wavelength is less than sum of the wavelengths
of its constituting colors.
Example: The CMYK color system is the color system used for printing. 47
Standard Primaries & the chromaticity diagram
• This is an international standard for primary colors
established in 1931.

• It allows all other colors to be defined as weighted sum of


the three "primary" colors.

• There are no real three colors that can be combined to give


all possible colors. Therefore the Three standard primaries
are selected [imaginary numbers].

• They are defined mathematically with positive color-


matching functions that specify the amount of each primary
needed to describe any spectral color.

48
Standard Primaries & the chromaticity diagram

Color-matching functions
A color in the
vicinity of
500nm can be
matched only
but subtracting
an amount of
red light from a
combination of
blue and green
lights.

49
Standard Primaries & the chromaticity diagram

50
Standard Primaries & the chromaticity diagram
To define a color in CIE model, provide weights for
the X, Y and Z primaries, just as you would for an
RGB display (e.g. color = xX + yY + zZ).

• X, Y and Z form a three dimensional color volume.

• We can ignore the dimension of luminance by


normalizing with total light intensity, x+y+z = 1.

51
CIE chromaticity diagram.
Standard Primaries & the chromaticity diagram

Gamut Color
Complementary Color Dominant Wavelength
&
Purity

RGB Model 52
RGB Model
• The red, green, and blue (RGB) color space
is widely used throughout computer
graphics.

•Additive Color Model.

•Unit Cube defined on R, G & B axes.

•The Origin (0,0,0) represents black and the


diagonally opposite vertex (1,1,1) is White.

•Vertices of the cube on the axes represent


primary colors, and the remaining vertices are
the complementary color points for each of the
primary colors.

•Shades of gray are represented along the 53


RGB Model

Each color point within the unit cube can be represented as


w weighted vector sum of the primary colors, using unit
vectors R,G and B.

C(λ) =(R,G,B) = RR +GG+ BB

Where R,G, and B are assigned values in the range from 0


to 1.0.

For example , the magenta vertex is obtained by adding the


maximum red and blue values to produce : (1,0,1)

54
YIQ model

• YIQ model is used for US TV broadcast.

• This model was designed to separate chrominance (I and


Q) from luminance (Y).

• This was a requirement in the early days of color


television when black-and-white sets still were expected
to pick up and display what were originally color pictures

• The Y-channel contains luminance information (sufficient


for black-and-white television sets) while the I and Q
channels carried the color information.

55
YIQ model
• A color television set would take these three channels, Y, I, and Q, and
map the information back to R, G, and B levels for display on a screen.

• The advantage of this model is that more bandwidth can be assigned to


the Y-component (luminance) because the human visual system is more
sensitive to changes in luminance than to changes in hue or saturation

Convert From RGB To YIQ Convert From YIQ To RGB

56
HSV Model

Every color is represented by three components Hue ( H ),


Saturation ( S ) and Value ( V )

57
HSV Model

The Hue (H) of a color refers to which pure color it resembles.


All tints, tones and shades of red have the same hue. (simply
the color we see)

58
HSV Model

The Saturation (S) of a color describes how white the color is.
Or the amount of white added to the color. A pure red is fully
saturated (S=1) means no white added

59
HSV Model

The Value (V) of a color, also called its lightness, describes


how dark the color is. A value of 0 is black, with increasing
lightness moving away from black.

60
HSL Model
• Double-cone Representation
Parameters are :
• Hue (H)
• Lightness (L)
• Saturation (S)

61
HSL Model
• Vertical Axis is called Lightness(L).
• At L=0 we have black , and at L=1 we have white
• Grayscale values are along the L axis
• The pure colors lie at the axis where L=0.5 and S=1.0

62
CMY and CMYK Model

• Subtractive Color Model.

• Stands for cyan-magenta-yellow.

• Used for hardcopy devices (ex. Printers).

• A printed color that looks red absorbs


the other two components G and B and
reflects R.

• Thus the C-M-Y coordinates are just the


complements of the R-G-B coordinates.

63
CMY and CMYK Model
In additive color models such as RGB, white is the “additive”
combination of all primary colored lights, while black is the absence
of light.

In the CMYK model, it is the opposite: white is the natural color of the
paper or other background, while black results from a full
combination of colored inks.
RGB To CMY CMY To RGB

64
CMY and CMYK Model
CMYK Color Model
Although cyan, magenta and yellow inks might be expected be sufficient for
color printing, most actual color printing uses black ink in addition.

This is partly because a mixture of the first three inks may not yield a black
that is neutral enough, or dark enough, but also because the use of black
spares the use of the more expensive colored inks, and also reduces the total
amount of ink used, thus speeding drying times.

K used instead of equal amounts of CMY


• called under color removal
• richer black
• less ink deposited on paper – dries more quickly
• First approximation – nonlinearities must be
accommodated:
K = min(C, M, Y)
C’ = C – K
M’ = M – K
65
Y’ = Y – K
Color Models Applications
Color Model Application Area Color Model Application Area

- Computer graphics
- Image processing
RGB - Image Analysis
- Image Storage

CMY(K) Printing
- Human visual perception
- Computer graphics processing
- Computer Vision
- Image Analysis
- Design image
HSV, HSL - Human vision
- Image editing software
- Video editor

- TV broadcasting
YIQ - Video system
Halftone
• A technique used in newspaper printing
Only two intensities are possible, blob of ink and no blob of
ink. But, the size of the blob can be varied

67
Dithering

The process of approximating colors you don't have by


mixing colors you do have.

68
Halt-Toning Vs. Dithering
Half toning is the reproduction of grayscale images using dots
but with varying size.
Typical Application Laser printer.

If a monitor can't show a certain color, dithering approximates


the color by placing close together pixels in colors that the
computer can display.
Typical Application Web graphic designers often limit their
images to 256 colors and use dithering to imply other colors.

69

You might also like