0% found this document useful (0 votes)
50 views12 pages

13 Interpolative Shading

Interpolative shading techniques like Gouraud and Phong shading are used to approximate smooth curved surfaces with polygons for rendering by graphics hardware. Gouraud shading interpolates vertex intensities, while Phong shading interpolates vertex normals, solving highlight problems but being more computationally expensive. Both have inaccuracies from interpolating in screen space rather than world space.

Uploaded by

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

13 Interpolative Shading

Interpolative shading techniques like Gouraud and Phong shading are used to approximate smooth curved surfaces with polygons for rendering by graphics hardware. Gouraud shading interpolates vertex intensities, while Phong shading interpolates vertex normals, solving highlight problems but being more computationally expensive. Both have inaccuracies from interpolating in screen space rather than world space.

Uploaded by

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

Interpolative Shading

Interpolative Shading
• Remember that most graphics hardware can only draw polygons.
• Smooth curved surface has to be polygonized in order to be displayed.
• If you shade the surface honestly using previously mentioned illumination model, you will
see ….

• The surface is not smooth when display.


Interpolative Shading
• Smooth surfaces are often approximated by polygonal facets because:
– Graphic hardware generally wants polygons
– We know how to intersect rays with polygons
• How do we compute the shading for such a surface?
– Interpolative shading
• Ray tracing is very expensive. Can we exploit some coherence
information to save some ray-object intersections?
• We will study two types of interpolative shading in the image space:
– Gouraud shading
– Phong shading
• Note that although normals are used in both cases, interpolative
shading is done in the image/screen space. As you will see, the idea is
very similar to the use of object coherence in Z-buffer.
Interpolative Shading
Interpolative shading
To recover (approximately) the visual appearance of curved surface which is now
represented by flat polygons.

Assumptions:
1) An approximate normal to the original smooth surface is given, or can be computed at
each vertex by averaging the normals to the polygons sharing that vertex.

Np=(N1+N2+N3+N4)/4

2) The shading of a particular pixel can be obtained by a bilinear interpolation of the


appropriate quantities from adjacent vertices.
Gouraud Shading
• Calculate the intensity at each vertex using local reflection model
• Intensities of interior pixels are determined by linearly interpolating the vertices’ intensities

• Interpolation equations are:


Ia = [I1 (ys- y2 ) + I2(y1-ys)] / (y1 - y2)
Ib = [I1 (ys- y3) + I3(y1-ys)] / (y1 - y3)
Is = [Ia (xb- xs) + Ib(xs-xa)] / (xb - xa)
Gouraud Shading
Gouraud Shading
• Flaws of Gouraud Shading:
1) Highlight anomalies

• If the highlight appears in the interior of the polygon, Gouraud may fail to shade this
highlight because no highlighted intensities are recorded/calculated at the vertices.

2) Mach banding
Human visual system emphasizes intensity changes occurring at a boundary, which creates a
banding effect. The bands can be obvious if insufficient polygons are used to model area of
high curvature.
Phong Shading
• Instead of interpolating the vertex intensities, Phong interpolates vertex normal vectors.
• Solves the interior highlight problem:

• Interpolation equations are:


Na = [N1 (ys- y2 ) + N2(y1-ys)] / (y1 - y2)
Nb = [N1 (ys- y3) + N3(y1-ys)] / (y1 - y3)
Ns = [Na (xb- xs) + Nb(xs-xa)] / (xb - xa)
Phong Shading
• Since illumination calculation has to be invoked at each interior
surface point, Phong shading is more expensive than Gouraud
shading.
Defects in Interpolative Shading
Interpolation inaccuracies:
Interpolation done in screen space is not equivalent to interpolation in world space.
Remember perspective projection is non-linear.

Hence interpolation is orientation dependent.


Gouraud vs Phong Shading
Gouraud interpolation Phong Shading

• Compute vertex normals • Compute vertex normals


• Shade only vertices (using • Interpolate normals and
Phong equation) normalize
• Interpolate the resulting vertex • Shade using the interpolated
colors normals (using Phong equation)

Gouraud interpolation Phong interpolation


Summary
Here’s what you should take home from this lecture:
• Gouraud shading
• Phong shading
• Their comparative advantages and disadvantages
• Anomalies in interpolative shading

You might also like