You are on page 1of 28

SHADING METHODS

Polygon Rendering
Polygon

renderingis a method of
creating two dimensional images
from a group of three
dimensional objects.
These three dimensional objects
are made up of flat polygons, any
shape can be approximated using
polygons.

Rendering

methods used in
computer graphics
Flat surface rendering
Gouraud surface rendering
Phong surface rendering

Flat Surface Rendering


The

simplest method for rendering


a polygon surface
The same colour is assigned to all
surface positions
The illumination at a single point
on the surface is calculated and
used for the entire surface
Flat surface rendering is extremely
fast, but can be unrealistic

Flat

shading provides accurate


rendering for an object if all of the
following assumptions are valid:

All

light sources illuminating the object are


sufficiently far from the surface so that N.L
and the attenuation function are constant
for the surface.
The viewing position is sufficiently far from
the surface so that V.R is constant for the
surface.

No Surface Rendering Vs Flat


Surface Rendering

No Surface Rendering

Flat Surface Rendering

Limitations
It

give a faceted look to low


polygon models.
Specular highlights are rendered
poorly.

Overcoming Flat Shading


Limitations

Just add lots and lots of


polygons however, this is
SLOW!

Gouraud Surface
Rendering
Gouraud

surface shading was


developed in the 1970s by
Henri Gouraud
Often also called intensityinterpolation surface
rendering
Intensity levels are calculated at
each vertex and interpolated
across the surface

Example: flat shading vs


gouraud shading

Gouraud Surface Rendering


To

render a polygon, Gouraud


surface rendering proceeds as
follows:
1.Determine the average unit normal
vector at each vertex of the polygon
2.Apply an illumination model at each
polygon vertex to obtain the light
intensity at that position
3.Linearly interpolate the vertex
intensities over the projected area
of the polygon

Gouraud Surface Rendering


The

average unit
normal vector at
v is given as:

N1

N1 N 2 N 3 N 4
Nv
N1 N 2 N 3 N 4

Nv
v

N4

N3

N2

or

more
n
generally:
Nv

N
i 1
n

N
i 1

Gouraud Surface Rendering


Illumination

values are linearly


interpolated across each scanline
y y
y y
3

I4

1
Scan-line

y1 y2

I1

y1 y2

I2

y5 y 2
y3 y5
I5
I3
I2
y3 y 2
y3 y 2
Ip

x5 x p
x5 x4

I4

x p x4
x5 x4

I5

Y-1

The intensity along


this edge for the next
scan line y-1 is :

Scan-line

Intensity at the edge


point is interpolated
as: y y2
y1 y
I4
I1
I2
y1 y2
y1 y2

I 2 I1
I' I
y1 y2

2
x

Advantages of Gouraud Surface Rendering:


removes the intensity discontinuities

Gouraud Surface Rendering


Example

Gouraud Surface Rendering


Implementation
Gouraud

surfacing rendering can


be implemented relatively
efficiently using an iterative
approach
Typically Gouraud shading is
implemented as part of a visible
surface detection technique

Problems With Gouraud Shading


Gouraud

shading
tends to miss
certain highlighting
In particular Gouraud
shading has a
problem with specular
reflections
Also, the linear intensity
interpolation can cause bright or dark
intensity streaks known as Mach bands

Problems With Gouraud


Shading

Gouraud shading

The

major problem with Gouraud


shading is in handling specular
reflections

Mach Bands
A

psychological phenomenon
whereby we see bright bands
where two blocks of solid colour
meet

Phong Surface Rendering


A

more accurate interpolation


based approach for rendering a
polygon was developed by Phong
Bui Tuong
Basically the Phong surface
rendering model (or normalvector interpolation
rendering) interpolates normal
vectors instead of intensity
values

Phong Surface Rendering


To

render a polygon, Phong


surface rendering proceeds as
follows:
1.Determine the average unit normal
vector at each vertex of the polygon
2.Linearly interpolate the vertex
normals over the projected area of
the polygon
3.Apply an illumination model at
positions along scan lines to
calculate pixel intensities using the

Phong Surface Rendering


N3
N1

N4
p

y4 y2
y1 y4
N4
N1
N2
y1 y2
y1 y2
y5 y 2
y3 y5
N5
N3
N2
y3 y 2
y3 y 2

Np

Scan line

N5
N2

Np

y p y5
y 4 y5

N4

y4 y p
y 4 y5

N5

Phong Surface Rendering


Implementation
Phong

shading is much slower


than Gouraud shading as the
lighting model is revaluated so
many times
However, there are fast Phong
surface rendering approaches
that can be implemented
iteratively.

Phong Shading Examples

Phong Shading Examples

Summary
For

realistic rendering of
polygons we need interpolation
methods to determine lighting
positions
Flat shading is fast, but
unrealistic
Gouraud shading is better, but
does not handle specular
reflections very well
Phong shading is better still, but

THANK

YOU

You might also like