Colour and Normal Interpolation

As it applies to triangles and quadrilaterals in the rendering of 3D surfaces

Written by Paul Bourke
September 2002

It is frequently desirable to estimate the colour or normal at a point in the interior of a 3 or 4 vertex planar polygon given only the colour and normal at each of the vertices. The most common application of this is smooth rendering of surfaces approximated by a finite number of triangular facets or quadrilaterals. Without colour and/or normal interpolation each planar piece of the surface has the same colour and normal, this results in a visible discontinuity between adjacent faces. The following illustrates a part of a sphere made up of quadrilaterals and rendered using a single normal applied to the whole face or 4 normals at each vertex interpolated across the face.

 Wireframe Single normal across face Normal interpolated across face

The approach most commonly used by 3D rendering packages, both realtime such as OpenGL and more CPU intensive algorithms such as raytracing, is called Phong normal interpolation. A often used efficient implementation is called barycentric interpolation. The idea is the same for both colour and normal interpolation, a line is extended from the point in question to two edges of the polygon. The estimate of the colour or normal at those points is made by linear interpolation between the values at the vertices of the edge. The estimate at the point in question is linearly interpolated from the estimates at the ends of the extended line.

This is illustrated in the sequence below, while this is for normals the method is identical for colours which are after all generally a (r,g,b) triple instead of a (x,y,z) triple. In (A) the point P is where the colour or normal is to be estimated, a line is extended (in any direction but shown as horizontal in this diagram) until it intersects two edges. In (B) the normals at the intersection points of the extended line are shown in red, they are calculated by linear interpolation. In (C) the two normals in (B) are linearly interpolated to give the estimate of the normal at point P.

Note

• The colour or normal estimate at the vertices is always the same as the vertex value.

• The colour or normals along the edges only depends on the colour or normal at the edge vertices and not on the values at the other vertices. It is this that ensures that adjacent faces with the same colour or normal along a joining edge will join smoothly even though their other vertices may have very different values.

• The direction in which the line is extended out from the point being estimated doesn't matter except that it must be the same for all points within a face. One way is to choose a major axis by specifying a normal. The plane with this normal that passes though the point in question cuts two of the polygon edges, this is used as the extended line.

• One difference between interpolation of normals and colours is that the normals estimated at the end of the extended lines and the final normal at P are normalised to unit length. In colour interpolation each r,g,b component is treated independently.