May 2021
Beginner
248 pages
5h 26m
English

In the previous chapter, we developed an algorithm to draw a triangle filled with a solid color. Our goal for this chapter is to draw a shaded triangle—that is, a triangle filled with a color gradient.
We want to fill the triangle with different shades of a single color. It will look like Figure 8-1.
We need a more formal definition of what we’re trying to draw. We have a base color C: for example, 0,255,0, pure green. We’ll assign a real value h to each vertex, denoting the intensity of the color at the vertex. h is in the [0.0,1.0] range, where 0.0 represents the darkest possible shade (that is, black) ...
Read now
Unlock full access