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.

Colour interpolation

Note