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...
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...
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
Question
xdaniel
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...
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...
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
Link to comment
Share on other sites
2 answers to this question
Recommended Posts