Next we add a new capability to our triangle rasterizer; the ability to linearly interpolate parameters over its interior. You might ask: Why would we ever want to do such a thing? The reasons are plenty.
Currently we can only draw solid colored triangles. Wouldn't it be nice if we could smoothly vary the colors as we filled the polygon. In this case the parameters that are interpolated are the red, green, and blue components of the color. Later on, when we get to 3D techniques, we'll also interpolate other parameters such as the depth at each point on the triangle.
First, let's frame the problem. At each vertex of a triangle we
have a parameter, say its redness. When we actually draw the vertex,
the specified shade of red is exactly what we want, but at other
points we'd like some sort of smooth transition between the values
given. This situation is depicted below: