(11-04-2015, 05:20 PM)cpuHacka101 Wrote: 0xFC G_SETCOMBINE
Performs combining operations (ex. multi-texturing)
Syntax: Unknown
Examples:
FC 12 7F FF FF FF F8 38 - Standard usage for solid RGBA textures
FC 12 18 24 FF 33 FF FF - Standard usage for alpha RGBA textures
I have some information to post on this. I posted it over skype to you earlier, trent. But now I post it here too. Me and jeremy were looking what this was doing, and discovered that 0xFC is basically for N64's CC (Color Combiner). The manual says following: "The CC is the ultimate paint mixer. It can take two color values from many sources and linearly interpolate between them." The equation:
newcolor = (A-B)*C+D
Here, A, B, C, and D can come from many different sources. Notice that if D=B, then this is a simple linear interpolator.
So, here the notes:
FC ee ee ee ee ee ee ee
e - Equation for blending, color = ( a - b) x c + d and alpha = ( e - f ) x g + h
Bitwise:
Mask for 'e':
[aaaacccc ceeegggi iiikkkkk bbbbjjjj mmmooodd dfffhhhl llnnnppp]
a - variable 'a' for mode 1 (color)
b - variable 'b' for mode 1 (color)
c - variable 'c' for mode 1 (color)
d - variable 'd' for mode 1 (color)
e - variable 'e' for mode 1 (alpha)
f - variable 'f' for mode 1 (alpha)
g - variable 'g' for mode 1 (alpha)
h - variable 'h' for mode 1 (alpha)
i - variable 'a' for mode 2 (color)
j - variable 'b' for mode 2 (color)
k - variable 'c' for mode 2 (color)
l - variable 'd' for mode 2 (color)
m - variable 'e' for mode 2 (alpha)
n - variable 'f' for mode 2 (alpha)
o - variable 'g' for mode 2 (alpha)
p - variable 'h' for mode 2 (alpha)
Basically, n64 has a color combiner, basically combiner values, color + alpha values.
Decoding the standard usage for alpha RGBA textures:
FC 12 18 24 FF 33 FF FF - Standard usage for alpha RGBA textures
We decoded it as (the names were taken from N64devkit manual):
TEXEL0 (mode 1)
SHADE (mode 1)
TEXEL0_ALPHA (mode 1)
SHADE_ALPHA (mode 1)
TEXEL0 (mode 2)
SHADE (mode 2)
K5 (mode 1)
K5 (mode 2)
TEXEL0_ALPHA (mode 2)
SHADE_ALPHA (mode 2)
NOISE/K4 (mode 1)
0 (mode 1)
0 (mode 1)
NOISE/K4 (mode 2)
0 (mode 2)
0 (mode 2)
TEXEL0 = 1
SHADE = 4
TEXEL0_ALPHA = 1
SHADE_ALPHA = 4
K5 = 15
NOISE/K4 = 7
0 = 31
TEXEL0 is texture map output.
K5 is color convert constant
SHADE is shade color
NOISE is noise.
So, for calculating alpha and color:
color = (a - b) c + d and alpha = (e - f) * g + h (according to N64DevKit manual)
More information about N64's CC is here:
N64's Color Combiner
Also, this one here is also helpful if you want to understand a bit of the complexity of N64's color combiner and some examples.
GLideN64 - Emulating CC
And last, there's the architecture of the CC.
http://n64devkit.square7.ch/tutorial/graphics/4/4_1.htm
If something is wrong there, feel free to correct it.