4.4 Review of Combine Mode

Thus far, we have been using combine mode without knowing much about it. Next, we will look at the combine mode definitions and see how those definitions are realized.

If you look at <gbi.h>, you'll see that the gDPSetCombineMode command macro is defined as follows:

  #define gDPSetCombineMode(pkt, a, b)   gDPSetCombineLERP(pkt, a, b)

In other words, as previously mentioned, setting the combine mode is nothing more than using the gDPSetCombineLERP command to set the input source for linear arithmetic in the Combiner.

So how are the definitions actually set for the combine mode used in the sample programs (gfx1.c to gfx3.c) we have been talking about up to now? The G_CC_SHADE mode that colors the model using shading color is defined in <gbi.h> as follows:

  #define G_CC_SHADE   0, 0, 0, SHADE, 0, 0, 0, SHADE

With this, the

output color = (0 - 0) * 0 + shade color = shade color.

In other words, the result of the shading calculation is output without being changed in any way. The same is true for the alpha value. Take a look at the definition for G_CC_PRIMITIVE mode:

  #define G_CC_PRIMITIVE   0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE

As you can see, this specifies that the primitive color & alpha be output unchanged.

These fall in the class of very simple combine modes, but many other combine modes have been prepared in <gbi.h>. For details, see the section on gDPSetCombineMode in the Function Reference.

What kinds of visual effects result from the use of these preset combine modes? To gain a deeper understanding of combine mode, define a number of combine modes of your own at this point and see what happens.

Flat shading is used for all coloring in this chapter's gfx4.c sample program. Thus, assuming that the Combiner performs no combining with texture color, etc., each surface of the cube will be colored with a single color. In other words, you do not necessarily need to use smooth shading to produce interesting and beautiful visual effects.