Professional Documents
Culture Documents
12 Polygon Rendering Methods EN
12 Polygon Rendering Methods EN
Computer Graphics
Polygon Rendering Methods
Andreas Aristidou
andarist@ucy.ac.cy
http://www.andreasaristidou.com
Polygonal Rasterization Rendering Techniques
Wireframe Flat
Gouraud Phong
EPL426 | Computer Graphics
Polygon Rendering Methods
▪ We consider the application of a
lighting model as the
performance in polygons with
local surfaces.
▪ There are two ways of rendering
on surfaces:
▪ Each polygon can be rendered at
a constant intensity
▪ The intensity at each point of the
polygon is calculated by
interpolation.
ng.htm
No interpolation, pick a single representative intensity and propagate it over entire object
Loses almost all depth cues
EPL426 | Computer Graphics
Images come from:
www.siggraph.org/education/materials/HyperGraph/scanline/shade_models/shadi
ng.htm
ng.htm
ng.htm
ng.htm
flat shading of
polygonal mesh
How accurate is this approach?
What are the disadvantages? Flat surface rendering is extremely
fast, but can be unrealistic
𝑝
𝑚
𝐼 = 𝑘𝑎 𝐼𝑎 + 𝐼𝑗 𝑘𝑑 𝑛. 𝑙𝑗 + 𝑘𝑠 ℎ𝑗 . 𝑛
𝑗=1
𝑝
𝑚
𝐼 = 𝑘𝑎 𝐼𝑎 + 𝐼𝑗 𝑘𝑑 𝑛. 𝑙𝑗 + 𝑘𝑠 ℎ𝑗 . 𝑛
𝑗=1
EPL426 | Computer Graphics
Gouraud Surface Rendering
▪ The average unit normal vector at v is given as:
N1 + N 2 + N 3 + N 4
Nv = N1
N1 + N 2 + N 3 + N 4
Nv
▪ or more generally :
v
n N4 N2
N i
Nv = i =1
n
Ni
i =1
N3
y
3 y4 − y2 y1 − y4
I4 = I1 + I2
y1 − y2 y1 − y2
1
Scan-line y5 − y 2 y3 − y 5
I5 = I3 + I2
4 p 5 y3 − y 2 y3 − y 2
x5 − x p x p − x4
Ip = I4 + I5
2 x5 − x4 x5 − x4
x
EPL426 | Computer Graphics
Advantages of Gouraud Surface Rendering
Mach bands
EPL426 | Computer Graphics
Problems with Gouraud Shading
▪ The major problem with Gouraud shading is in handling specular reflections
Gouraud Phong
𝑝
𝑚
𝐼 = 𝑘𝑎 𝐼𝑎 + 𝐼𝑗 𝑘𝑑 𝑛. 𝑙𝑗 + 𝑘𝑠 ℎ𝑗 . 𝑛
𝑗=1
EPL426 | Computer Graphics
Phong Shading
▪ 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 interpolated normal vectors
N3 y4 − y2 y1 − y4
N4 = N1 + N2
N1 y1 − y2 y1 − y2
y5 − y 2 y3 − y 5
N5 = N3 + N2
y3 − y 2 y3 − y 2
N4
Np
Scan line y p − y5 y4 − y p
p Np = N4 + N5
N5 y 4 − y5 y 4 − y5
N2
Phong Shading
Gouraud Phong
http://www.cgchannel.com/2010/11/cg-science-for-artists-part-2-the-real-time-
rendering-pipeline/