Combiner Commands And Explination			
		==================================			
									
	Any Link Below is truncated to the root of SDK Manual, 		
             NINTENDO%2064%20SDK%205_CDROM/man/allman50 	
		Can Also be downloaded at romhacking			
									
		Compiled By Trevor					
		Credits to Zoinkity for Original Find			
FC G_SETCOMBINE
typedef struct {
int cmd:8;
unsigned int muxs0:24; cc1 ac1
unsigned int muxs1:32; cc2 ac2
} Gsetcombine;
/* * SetCombineMode macros are NOT redunant. It allow the C preprocessor * to substitute single parameter which includes commas in the token and * rescan for higher parameter count macro substitution. * * eg. gsDPSetCombineMode(G_CC_MODULATE, G_CC_MODULATE) turns into * gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0, * TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0) */ The above example inputs the values into the spaces below, which is then packed gsDPSetCombineLERP(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ { \ _SHIFTL(G_SETCOMBINE, 24, 8) | \ _SHIFTL(GCCc0w0(G_CCMUX_##a0, G_CCMUX_##c0, \ G_ACMUX_##Aa0, G_ACMUX_##Ac0) | \ GCCc1w0(G_CCMUX_##a1, G_CCMUX_##c1), 0, 24), \ (unsigned int)(GCCc0w1(G_CCMUX_##b0, G_CCMUX_##d0, \ G_ACMUX_##Ab0, G_ACMUX_##Ad0) | \ GCCc1w1(G_CCMUX_##b1, G_ACMUX_##Aa1, \ G_ACMUX_##Ac1, G_CCMUX_##d1, \ G_ACMUX_##Ab1, G_ACMUX_##Ad1)) \ } =Zoinkitys Original (My Corrections and legnths)========================================================
upper word Value Length
(bits)
Options applicable
00F00000 a0 4 Combine, Texel0, Texel1, Primitive, Shade, Environment, Noise, 1, 0
000F8000 c0 5 Combine, Texel0, Texel1, Primitive, Shade, Environment , Scale, Combined_Alpha, Texel0_Alpha, Texel1_Alpha, Primitive_A, Shade_Alpha, Env_Alpha, LOD_FRACTION, Prim_LOD_Frac, K5, 0
00007000 AA0 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
00000E00 AC0 3 Texel0, Texel1, Primitive, Shade, Environment, LOD_FFRACTION, Prim_LOD_Frac, 0
000001E0 a1 4 Combine, Texel0, Texel1, Primitive, Shade, Environment, Noise, 1, 0
0000001F c1 5 Combine, Texel0, Texel1, Primitive, Shade, Environment, Scale, Combined_Alpha, Texel0_Alpha, Texel1_Alpha, Primitive_A, Shade_Alpha, Env_Alpha, LOD_FFRACTION, Prim_LOD_Frac, K5, 0
lower word
F0000000 b0 4 Combine, Texel0, Texel1, Primitive, Shade, Environment, center, k4, 0
0F000000 b1 4 Combine, Texel0, Texel1, Primitive, Shade, Environment, center, k4, 0
00E00000 AA1 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
001C0000 AC1 3 Texel0, Texel1, Primitive, Shade, Environment, LOD_FFRACTION, Prim_LOD_Frac, 0
00038000 d0 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
00007000 AB0 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
00000E00 AD0 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
000001C0 d1 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
00000038 AB1 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
00000007 AD1 3 Combine, Texel0, Texel1, Primitive, Shade, Environment, 1, 0
In case the hex is confusing, I find it so, I made a bitmap. Each group is a value.
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 Bit Number
0 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 Runway 66AFD4
Bit

a0

c0

A0

C0

a1

c1

Combiner
Multiplexor
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Bit Number
0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 0 0 Runway 66AFD4
Bit

b0

b1

A1

C1

d0

B0

D0

d1

B1

D1

Combiner
Multiplexor
The Equation looks like this
CYCLE1 (presetname)
Colour Combiner0: (a - b) * c + d
Alpha Combiner0: (A - B) * C + D
 
CYCLE2 (presetname)
Colour Combiner1: (a - b) * c + d
Alpha Combiner1: (A - B) * C + D
If we plug Runway (FC 26 A0 04 1F FC 93 FC) into it we get
CYCLE1 (TRILERP)
Colour Combiner0: (Texel1 - Texel0) * LOD_FRACTION + Texel0
Alpha Combiner0: (Texel1 - Texel0) * LOD_FRACTION + Texel0
 
CYCLE2 (MODULATERGB2)
Colour Combiner1: (Combined - 0) * Shade + 0
Alpha Combiner1: (0 - 0) * 0 + Shade
This means trilinear Filter (take Mip-Map level n and n+1 and average them) then combine the vertex colour with texture colour Below lists the values of the combine modes. Where the length is 3 bits, use the ACMUX values. General Rule of thumb is, if the value is all 1's then the value = 0 The exotic Modes are only available to values of bit lengths of 5 (c0 and c1). /* * G_SETCOMBINE: colour combine modes --- This stuff is direct from SDK */ /* Color combiner constants (Decimal): */ #define G_CCMUX_COMBINED 0 combined output from cycle 1 mode #define G_CCMUX_TEXEL0 1 texture map output #define G_CCMUX_TEXEL1 2 texture map output from tile+1 #define G_CCMUX_PRIMITIVE 3 PrimColour - A 6Byte Colour Register held by the Combiner for Colouring textures on a Realtime lit Primitive #define G_CCMUX_SHADE 4 Shade colour - The colour assigned to Vertexes, Realtime lighting requires these to be Normals and not Colour #define G_CCMUX_ENVIRONMENT 5 Environment colour - A Colour Register held by the Combiner. #define G_CCMUX_CENTER 6 chroma key center value #define G_CCMUX_SCALE 6 key scale value #define G_CCMUX_1 6 1.0 #define G_CCMUX_COMBINED_ALPHA 7 combined alpha output from cycle 1 #define G_CCMUX_NOISE 7 Random (Static on old TV) #define G_CCMUX_K4 7 colour convert constant K4 #define G_CV_K4 = 114 G_CCMUX_0 7 0.0 for 3bit entries #define G_CCMUX_TEXEL0_ALPHA 8 texture map alpha #define G_CCMUX_TEXEL1_ALPHA 9 texture map alpha from tile+1 #define G_CCMUX_PRIMITIVE_ALPHA 10 A PrimColour Alpha - The Alpha component from the Colour Register PrimColor. Used for Transparency on FOG and Lit Primitives. #define G_CCMUX_SHADE_ALPHA 11 B Shade alpha - Vertex Alpha, FOG uses this for intensity #define G_CCMUX_ENV_ALPHA 12 C Environment colour alpha - Alpha Component of the Environment Colour Register #define G_CCMUX_LOD_FRACTION 13 D LOD fraction L_F - An Automatically generated 8bit Float (0.0-0.99609375) to indicate Mip-map Level Blend multiplier. An ignored 3bit Value (0-7) comes before this to indicate Tile. #define G_CCMUX_PRIM_LOD_FRAC 14 E Prim LOD fraction P_L_F - A Manually Adjustable LOD_Fraction Multiplier to either hasten or delay the next Mip-Map Level. e.g. setting to 2.0 (255) will double the speed at which Mip-Map Levels will appear (Blurry sooner). Setting to 0.5 (0) will delay levels and induce Moiring on High Frequency textures. #define G_CCMUX_K5 15 F colour convert constant K5 #define G_CV_K5 = 42 G_CCMUC_0 15 0.0 for 4bit entries #define G_CCMUX_0 31 1F 0.0 /* Alpha combiner constants: */ #define G_ACMUX_COMBINED 0 #define G_ACMUX_LOD_FRACTION 0 #define G_ACMUX_TEXEL0 1 #define G_ACMUX_TEXEL1 2 #define G_ACMUX_PRIMITIVE 3 #define G_ACMUX_SHADE 4 #define G_ACMUX_ENVIRONMENT 5 Environment colour alpha - Alpha Component of the Environment Colour Register Example Usage: Replacement for Shade Alpha when Blender is in 'Force' Mode #define G_ACMUX_PRIM_LOD_FRAC 6 #define G_ACMUX_1 6 #define G_ACMUX_0 7 ============================================================================================= SetCombine Mode Description =========================== The Combiner 0 in 1 cycle should be set to SHADE for untextured Tris or MODULATEI for textured tris, or MODULATEIA for transparent textures. In 2 Cycle Mode, 0 should be set to TRILERP (or TEMPLERP for custom transition distance) if textured with a Mip-Mapable texture, and 1 should be set to MODULATEI2/IA2. If the Tri is UnTextured or the Texture is Non-Mip-mapable 0 should be set to MODULATEI/IA and 1 set to PASS2 While there are Presets for both I and RGB, they are the same combiner and don't make any difference. Where the colour output will be (a-b)*c+d and the alpha output will be (A-B)*C+D. The values you can use for each of a, b, c, d, A, B, C, and D are above.
Preset names
G_CC_ (a - b) * c + d (A - B) * C + D
PRIMITIVE 0 0 0 prim. 0 0 0 prim.
SHADE 0 0 0 shade 0 0 0 shade
SHADEDECALA 0 0 0 shade 0 0 0 texel0
DECALRGB 0 0 0 texel0 0 0 0 shade
DECALRGBA 0 0 0 texel0 0 0 0 texel0
ADDRGB 1 0 texel0 shade 0 0 0 shade
ADDRGBDECALA 1 0 texel0 shade 0 0 0 texel0
MODULATERGB texel0 0 shade 0 0 0 0 shade
MODULATEI texel0 0 shade 0 0 0 0 shade
MODULATERGBA texel0 0 shade 0 texel0 0 shade 0
MODULATEIA texel0 0 shade 0 texel0 0 shade 0
MODULATERGBDECALA texel0 0 shade 0 0 0 0 texel0
MODULATEIDECALA texel0 0 shade 0 0 0 0 texel0
MODULATERGB_PRIM texel0 0 prim. 0 0 0 0 prim.
MODULATEI_PRIM texel0 0 prim. 0 0 0 0 prim.
MODULATERGBA_PRIM texel0 0 prim. 0 texel0 0 prim. 0
MODULATEIA_PRIM texel0 0 prim. 0 texel0 0 prim. 0
MODULATERGBDECALA_PRIM texel0 0 prim. 0 0 0 0 texel0
MODULATEIDECALA_PRIM texel0 0 prim. 0 0 0 0 texel0
REFLECTRGB env. 0 texel0 shade 0 0 0 shade
REFLECTRGBDECALA env. 0 texel0 shade 0 0 0 texel0
BLENDI env. shade texel0 shade 0 0 0 shade
BLENDIA env. shade texel0 shade texel0 0 shade 0
BLENDIDECALA env. shade texel0 shade 0 0 0 texel0
BLENDRGBA texel0 shade texel0A shade 0 0 0 shade
BLENDRGBDECALA texel0 shade texel0A shade 0 0 0 texel0
BLENDPE prim. env. texel0 env. texel0 0 shade 0
BLENDPEDECALA prim. env. texel0 env. 0 0 0 texel0
BLENDPE_ALT env. prim. texel0 prim. texel0 0 shade 0
BLENDPEDECALA_ALT env. prim. texel0 prim. 0 0 0 texel0
HILITERGB prim. shade texel0 shade 0 0 0 shade
HILITERGBA prim. shade texel0 shade prim. shade texel0 shade
HILITERGBDECALA prim. shade texel0 shade 0 0 0 texel0
TWOcolourTEX prim. shade texel0 shade 0 0 0 shade
/* used for 1-cycle sparse mip-maps, primitive color has color of lowest LOD */
SPARSEST PRIM, TEXEL0 L_F TEXEL0 PRIM TEXEL0 L_F TEXEL0
TEMPLERP TEXEL1 TEXEL0 P_L_F TEXEL0 TEXEL1 TEXEL0 P_L_F TEXEL0
/* typical CC cycle 1 modes, usually followed by other cycle 2 modes */
TRILERP TEXEL1 TEXEL0 L_F TEXEL0 TEXEL1 TEXEL0 L_F TEXEL0
INTERFERENCE TEXEL0 0 TEXEL1 0 TEXEL0 0 TEXEL1 0
When in 2Cycle Mode, CC1 should be set to TRILERP for Tri-Liner Filtering     
         
One-cycle color convert operation     
 */        
G_CC_1CYUV2RGBTEXEL0 K4 K5 TEXEL0000 SHADE
         
/*        
 *  NOTE: YUV2RGB expects TF step1 color conversion to occur in 2nd clock.
 * Therefore, CC looks for step1 results in TEXEL1
 */        
G_CC_YUV2RGBTEXEL1 K4 K5 TEXEL10000
         
/* typical CC cycle 2 modes */        
G_CC_PASS2000 COMBINED000 COMBINED
G_CC_MODULATEI2COMBINED0 SHADE0000 SHADE
G_CC_MODULATEIA2COMBINED0 SHADE0 COMBINED0 SHADE0
G_CC_MODULATERGB2G_CC_MODULATEI2     
G_CC_MODULATERGBA2G_CC_MODULATEIA2     
G_CC_MODULATEI_PRIM2COMBINED0 PRIMITIVE0000 PRIMITIVE
G_CC_MODULATEIA_PRIM2COMBINED0 PRIMITIVE0 COMBINED0 PRIMITIVE0
G_CC_MODULATERGB_PRIM2G_CC_MODULATEI_PRIM2     
G_CC_MODULATERGBA_PRIM2G_CC_MODULATEIA_PRIM2     
G_CC_DECALRGB2000 COMBINED000 SHADE
         
         
G_CC_DECALRGBA2COMBINED SHADE COMBINED_ALPHA SHADE000 SHADE
         
G_CC_BLENDI2ENVIRONMENT SHADE COMBINED SHADE000 SHADE
G_CC_BLENDIA2ENVIRONMENT SHADE COMBINED SHADE COMBINED0 SHADE0
G_CC_CHROMA_KEY2TEXEL0 CENTER SCALE00000
G_CC_HILITERGB2ENVIRONMENT COMBINED TEXEL0 COMBINED000 SHADE
G_CC_HILITERGBA2ENVIRONMENT COMBINED TEXEL0 COMBINED ENVIRONMENT COMBINED TEXEL0 COMBINED
G_CC_HILITERGBDECALA2ENVIRONMENT COMBINED TEXEL0 COMBINED000 TEXEL0
G_CC_HILITERGBPASSA2ENVIRONMENT COMBINED TEXEL0 COMBINED000 COMBINED
Normal: Texture * Shade (Darken) Add: Add Texture to Vert Colour (Washout/Burnout/SunGlare) Noise: Add a random dither pattern to surface each cycle

Mip-Mapping with and without Trilinear filter. When to use Add? In an equally dark environment, such as the inside of a building, lights and surfaces under direct sunlight usually burnout to white relative to the surrounding colours. These surfaces should use Add. When everything is equally brightly lit, the shadows become 'darker' and the scene can return to using normal texture shading. By using Add in addition to Normal, basically gives you 512 levels of brightness and a more realistic lighting effect. Resources: /header/gbi.htm (contains all Combiner Multiplexor Preset Combinations) /tutorial/graphics/4 (Tutorial explination of Combiner. Not as in depth as above) Compile Tests ============================================================ To help work out the bit orders and lengths I compiled a series of demos with a custom Combiner. I list each C code then I list the hex output from ROM. Below That I print the bit map. Corrections Listed below have now been input above but kept for reference. Also you may notice that I assigned 5 bits to b0 and 3 to b1. This was wrong and has also been corrected above. Oh My... I just found that the docs actually specify Bit Lengths and Shift Values Already... They were under my nose but I couldn't see them... ah well, the compiling was still useful since there are order issues with regards to b1, A1 and C1. Control1 All 0 #define G_CC_MYNEWMODE 0,0,0,0, 0,0,0,0 FC FF FF FF FF FF FF FF Control2 All Combine #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,COMBINED, COMBINED,COMBINED,COMBINED,COMBINED FC 00 00 00 00 00 00 00 #define G_CC_MYNEWMODE 0,COMBINED,COMBINED,COMBINED, COMBINED,COMBINED,COMBINED,COMBINED FC F0 00 00 00 00 00 00 1CYC FC F0 01 E0 00 00 00 00 1111 1100 1111 00000 000 000 1111 00000 00000 000 000 000 000 000 000 000 000 000      a0 a1 Seems good #define G_CC_MYNEWMODE COMBINED,0,COMBINED,COMBINED, COMBINED,COMBINED,COMBINED,COMBINED FC 00 00 00 F0 00 00 00 1CYC FC 00 00 00 FF 00 00 00 1111 1100 0000 00000 000 000 0000 00000 11111 111 000 000 000 000 000 000 000 000 b0 seems good, b1 is d0 #define G_CC_MYNEWMODE COMBINED,COMBINED,0,COMBINED, COMBINED,COMBINED,COMBINED,COMBINED FC 0F 80 00 00 00 00 00 1CYC FC 0F 80 1F 00 00 00 00 1111 1100 0000 11111 000 000 0000 11111 00000 000 000 000 000 000 000 000 000 000 c0 c1 seems good #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,0, COMBINED,COMBINED,COMBINED,COMBINED FC 00 00 00 00 03 80 00 1CYC FC 00 00 00 00 03 81 C0 1111 1100 0000 00000 000 000 0000 00000 00000 000 000 000 111 000 000 111 000 000 d1 ok, d0 is b1 #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,COMBINED, 0,COMBINED,COMBINED,COMBINED FC 00 70 00 00 00 00 00 1CYC FC 00 70 00 00 E0 00 00 1111 1100 0000 00000 111 000 0000 00000 00000 000 111 000 000 000 000 000 000 000 A0 ok, A1 is B0 #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,COMBINED, COMBINED,0,COMBINED,COMBINED FC 00 00 00 00 00 70 00 1CYC FC 00 00 00 00 00 70 38 1111 1100 0000 00000 000 000 0000 00000 00000 000 000 000 000 111 000 000 111 000 B0 is A1, B1 is OK #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,COMBINED, COMBINED,COMBINED,0,COMBINED FC 00 0E 00 00 00 00 00 1CYC FC 00 0E 00 00 1C 00 00 1111 1100 0000 00000 000 111 0000 00000 00000 000 000 111 000 000 000 000 000 000 C0 is OK, C1 is D0 #define G_CC_MYNEWMODE COMBINED,COMBINED,COMBINED,COMBINED, COMBINED,COMBINED,COMBINED,0 FC 00 00 00 00 00 0E 00 1CYC FC 00 00 00 00 00 0E 07 1111 1100 0000 00000 000 000 0000 00000 00000 000 000 000 000 000 111 000 000 111 D0 is C1, D1 is OK GoldenEye/Perfect Dark Colour Combiner and Render Mode Translations