Jump to content
  • 0

The N64 Color Combiner


xdaniel
 Share

Question

So yeah, here's a little bit of explanation concerning the N64's color combiner, hope I'm getting this right. Basically, the color combiner is what's responsible for color mixing effects, multi-texturing and other such shenanigans. It takes input from the texture units, the Primitive color, Environment color, etc. and allows one to mix and match those to some degree. Well, let's get started...

 


Posted Image

 

Here's a simple example, a combiner mux from the test map, as shown by SayakaGL's combiner editor.

 

In the first cycle (out of a possible two), this takes color from Texel0, which is the first texture unit and thus our current texture, and multiplies it with Shade, which is the surface's shading as created by the current lighting conditions. Then, in the second cycle, the previously generated color (called Combined) is multiplied with the Primitive color as set by SetPrimColor. Seeing how alpha is simply 1, we can leave that aside for now.

 

Simplifying the equation by removing the 0s and the like, it ends up as (Texel0 * Shade) * Primitive, which simply tints the texture with whatever color the Primitive color is set to.

 

Next, for something a bit more difficult...

 


Posted Image

 

This is the combiner mux that's responsible for the multi-textured grass we see everywhere in the game, this particular mux coming from a part of Hyrule Field, although they're probably all identical. I honestly don't fully understand muxes like that yet either, but I hope I'll be able to pick it apart properly...

 

First of all, we subtract Texel0, one of the two textures that make up the grass, from Texel1, the other, then multiply the result of that with Env_Alpha, which is the Environment color's (set by SetEnvColor, in this case done outside of the room's Display Lists) alpha value. This so far results in a faded out rendering of Texel1. Afterwards, we add Texel0 again, which thus combines one now-faded texture with the other not faded one, giving us two textures on the surface instead of one. In cycle two, we once again multiply Shade into the picture, giving us a nicely shaded, multi-textured surface. Like in the previous example, we can pretty much ignore alpha here as it's, again, just 1.

 


Now, to get a simple transparent surface going, what are you gonna do? Rather simple. Take the first example, from the test map, and look at the alpha part of the equation again. It's just 1, right? This of course means fully opaque, so we've got to replace that one with something else, but how? Well, remember the Primitive color. In the example, it's mixed with Texel0 to create a tinted texture - but all of those color types aren't just RGB, but RGBA. That means, we can just set the alpha value of the Primitive color in the SetPrimColor command to something that's below 255 (the equivalent of 1 in the equation), say 128, and change the combiner mux to take Primitive instead of 1 in the first cycle.

 

However, in addition to changing the combiner mux and Primitive color, if your surface wasn't transparent already - and if if was, what the hell are you trying to do, make it more transparent? - you've also gotta modify the SetOtherMode_L command (usually) right after the SetCombine command you've edited. If I'm not totally mistaken, enabling the ZMODE_XLU and FORCE_BL settings in OtherMode_L should be enough to make the surface accept transparency.

 


Well, hope this helps and isn't too factually inaccurate :P

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I have a question about one of your programs concerning this topic. Could your other (old) program, Symbiosis Combiner Encoder, be used to accomplish the exact same tasks as SayakaGL combiner? Which do you believe is better? I'm trying to make transparent textures in a custom map.

 

Also, concerning transparency, how are we supposed to know where the SetOtherMode_L is located if it as not right after the SetCombine?

Link to comment
Share on other sites

  • 0

Jason777: Symbiosis was never really completed to the state I would've wanted it, and its combiner emulation and editor is somewhat less accurate than Sayaka's. It's still good for more theoretical applications - say for basically "getting the hang of it", it being the combiner's capabilities - but I'd rather use Sayaka's editor for actually editing a map. That said, seeing how you're trying to create transparency in a custom map, you probably have to rely on Symbiosis and a hex editor for the time being.

 

As for the SetOtherMode_L command, it has to be somewhere before your actual Vtx and Tri commands. Existing maps often tend to go SetCombine -> SetOtherMode_L -> GeometryMode -> GeometryMode -> SetPrimColor -> Vtx -> Tri(1/2) -> [...], but I believe it could as well be before SetCombine or after SetPrimColor, as long as it is placed before the geometry rendering commands.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.