gDPSetCombineMode [Macro]

Function

gDPSetCombineMode

Sets the color combiner (CC) mode

Syntax

#include <ultra64.h>        /* gbi.h */
gDPSetCombineMode(Gfx *gdl, s32 mode1, s32 mode2)
gsDPSetCombineMode(         s32 mode1, s32 mode2)

Arguments

gdl
Display list pointer.
mode1
CC mode for first cycle.
mode2
CC mode for second cycle.

Description

Makes detailed settings regarding the input sources to the CC. Although the CC mainly combines colors, it also performs post-color space conversion processing and sets chroma keying (currently unsupported) and LOD processes. These combination and setup processes are accomplished inside the CC by linearly interpolating various input sources. For information about input sources, see Figure 12-10 "RGB Color Combiner Input Sources" and Figure 12-11 "Alpha Combiner Input Sources" in Section 12.6.1 of the N64 Programming Manual.

In 1-cycle mode, mode1 and mode2 must be set to the same mode. In 2-cycle mode, although the CC can execute linear interpolation calculations twice, texture and shading color modulation processes are usually executed in the second cycle.

The following tables show the modes that can be used in 1-cycle mode and 2-cycle mode. However, other original modes also can be defined and assigned as arguments. For example, when the color is (a-b)*c+d and the alpha value is (A-B)*C+D, you can set:

    #define G_CC_MYNEWMODE a,b,c,d,A,B,C,D

For details, refer to Section 12.6.5 "Custom Modes" in the N64 Programming Manual.

Modes that can be used in one-cycle mode:

PR: Primitive color, SH: Shading color, EV: Environment color, T0: Texture color, T0A: Texture alpha, K4 & K5: Color conversion constants

G_CC_**** Top: Color definition
Bottom: Alpha definition
Function
I, IA, RGB & RGBA format modulated textures
MODULATEI T0*SH Multiply texture color and shading color
SH Output shading alpha
MODULATEIA T0*SH Multiply texture color and shading color
T0*SH Multiply texture alpha and shading alpha
MODULATEIDECALA T0*SH Multiply texture color and shading color
T0 Output texture alpha
MODULATERGB T0*SH Same as MODULATEI
SH
MODULATERGBA T0*SH Same as MODULATEIA
T0*SH
MODULATERGBDECALA T0*SH Same as MODULATEIDECALA
T0
MODULATEI_PRIM T0*PR Multiply texture color and primitive color
PR Output primitive alpha
MODULATEIA_PRIM T0*PR Multiply texture color and primitive color
T0*PR Multiply texture alpha and primitive alpha
MODULATEIDECALA_PRIM T0*PR Multiply texture color and primitive color
T0 Output texture alpha
MODURATERGB_PRIM T0*PR Same as MODULATEI_PRIM
PR
MODULATERGBA_PRIM T0*PR Same as MODULATEIA_PRIM
T0*PR
MODULATERGBDECALA_PRIM T0*PR Same as MODULATEIDECALA_PRIM
T0
RGB & RGBA format decal textures
DECALRGB T0 Output texture color
SH Output shading alpha
DECALRGBA T0 Output texture color
T0 Output texture alpha
I, IA, RGB & RGBA format blended textures
BLENDI (EV-SH)*T0+SH Use intensity texture to interpolate between environment color and shading color
SH Output shading alpha
BLENDIA (EV-SH)*T0+SH Use intensity texture to interpolate between environment color and shading color
T0*SH Multiply texture alpha and shading alpha
BLENDIDECALA (EV-SH)*T0+SH Use intensity texture to interpolate between environment color and shading color
T0 Output texture alpha
BLENDRGBA (T0-SH)*T0A+SH Use texture alpha to interpolate between texture color and shading color
SH Output shading alpha
BLENDRGBDECALA (T0-SH)*T0A+SH Use texture alpha to interpolate between texture color and shading color
T0 Output texture alpha
RGB & RGBA format reflection highlights and specular highlights
REFLECTRGB EV*T0+SH Reflect environment color and shading color when performing reflection mapping
SH Output shading alpha
REFLECTRGBDECALA EV*T0+SH Reflect environment color and shading color when performing reflection mapping
T0 Output texture alpha
HILITERGB (PR-SH)*T0+SH Use intensity texture to interpolate between shading color and primitive color when highlighting
SH Output shading alpha
HILITERGBA (PR-SH)*T0+SH Use intensity texture to interpolate between shading color and primitive color when highlighting
(PR-SH)*T0+SH Use intensity texture to interpolate between shading alpha and primitive alpha when highlighting
HILITERGBDECALA (PR-SH)*T0+SH Use intensity texture to interpolate between shading color and primitive color when highlighting
T0 Output texture alpha
1-cycle color conversion process
1CYUV2RGB (T0-K4)*K5+T0 Convert from YUV to RGB in 1-cycle mode
SH Output shading alpha
Others
PRIMITIVE PR Output primitive color
PR Output primitive alpha
SHADE SH Output shading color
SH Output shading alpha
ADDRGB T0+SH Add texture color and shading color
SH Output shading alpha
ADDRGBDECALA T0+SH Add texture color and shading color
T0 Output texture alpha
SHADEDECALA SH Output shading color
T0 Output texture alpha
BLENDPE (PR-EV)*T0+EV Use intensity texture to interpolate between environment color and primitive color
T0*SH Multiply texture alpha and shading alpha
BLENDPEDECALA (PR-EV)*T0+EV Use intensity texture to interpolate between environment color and primitive color
T0 Output texture alpha

Modes that can be used for mode1 in 2-cycle mode

PR: Primitive color, SH: Shading color, EV: Environment color, T0/T1: Texture color, LF: LOD coefficient

G_CC_**** Top: Color definition
Bottom: Alpha definition
Function
TRILERP (T1-T0)*LF+T0 Trilinear interpolation. Use LOD level to modulate texels from two bilerp tiles.
(T1-T0)*LF+T0
INTERFERENCE T0*T1 Multiply colors of texels from two bilerp tiles If the tiles have different frequencies, interesting interference patterns can be produced by sliding the s,t coordinates.
T0*T1 Multiply alphas of texels from two bilerp tiles.

Modes that can be used for mode2 in 2-cycle mode

The functions are almost identical to those in 1-cycle mode. mode2 mainly uses the combined RGBA color resulting from mode1.

CM: Output of first cycle, PR: Primitive color, SH: Shading color, EV: Environment color, T0/T1: Texture color

G_CC_**** Top: Color definition
Bottom: Alpha definition
Function
I, IA, RGB & RGBA format modulated textures
MODULATEI2 CM*SH The same as 1-cycle mode
SH
MODULATEIA2 CM*SH
CM*SH
MODULATERGB2 CM*SH
SH
MODULATERGBA2 CM*SH
CM*SH
MODULATEI_PRIM2 CM*PR
PR
MOCULATEIA_PRIM2 CM*PR
CM*PR
MODULATERGB_PRIM2 CM*PR
PR
MODULATERGBA_PRIM2 CM*PR
CM*PR
RGB format decal textures
DECALRGB2 CM The same as 1-cycle mode
SH
I and IA format blend textures
BLENDI2 (EV-SH)*CM+SH The same as 1-cycle mode
SH
BLENDIA2 (EV-SH)*CM+SH
CM*SH
RGB & RGBA format reflection highlights and specular highlights
HILITERGB2 (EV-CM)*T0+CM The same as 1-cycle mode
SH
HILITERGBA2 (EV-CM)*T0+CM
(EV-CM)*T0+CM
HILITERGBDECALA2 (EV-CM)*T0+CM
T0
HILITERGBPASSA2 (EV-CM)*T0+CM
CM *CM
2-cycle color conversion operations
YUV2RGB (T0-K4)*K5+T1 Perform YUV-to-RGB conversion post-processing of texels processed by the texture filter (TF) in the first cycle
0 The alpha value is 0
Others
PASS2 CM Output color calculated in the first cycle
CM Output alpha calculated in the first cycle

Note

The following internal macro can directly specify these input sources:

gDPSetCombineLERP

For details, see gbi.h.

See Also

gDPSetCycleType, gDPSetEnvColor, gDPSetPrimColor, gDPSetTextureLOD

Revision History

02/01/99 Completely rewritten and deleted chroma key setting.