1.1

Bug information and programming guides for the N64 will be periodically released. All information that will become unnecessary with software (library, etc.) and hardware upgrades used in development will be noted together. Please utilize this information after confirming that the information concerns your specific upgrade.

Contents:

  1. Tip: 16b RGBA Textures with more than 1-Bit Alphas
  2. Tip: Gamma Correction

February 23, 1996


1. Tip: 16b RGBA Textures with more than 1-Bit Alphas

The 16 bit RGBA texture type is often used to texture sprites and billboards because this is the only type that allows a large number of colors. Unfortunately, this type only has one bit of alpha (which means you can't prefilter texture edges), and can lead to pixelated texture edges.

One way to get more bits of alpha (in order to create smoother outlines) is to use two tiles. The first tile describes the RGB color of the texture, while the second tile describes the alpha channel of the texture. Render the texture in two-cycle mode. In the color combiner, select T0 as the source and in the alpha combiner select T1 as the source.

A code fragment indicates how to set the combine modes and load the textures:

#define MULTIBIT_ALPHA 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL1

...

/* use special combine mode */

gsDPSetCombineMode(MULTIBIT_ALPHA, G_CC_PASS2),

...

/*
 * Load alpha texture at Tmem = 256, notice I use a different load 
 * macro that allows specifying Tmem address.
 */

_gsDPLoadTextureBlock_4b(I4molecule, 256, G_IM_FMT_I,
                32, 32, 0,
                G_TX_WRAP, G_TX_WRAP,
                5, 5, G_TX_NOLOD, G_TX_NOLOD),

/*
 * Load color texture starting at Tmem=0
 */

gsDPLoadTextureBlock(RGBA16molecule, G_IM_FMT_RGBA, G_IM_SIZ_16b,
                32, 32, 0,
                G_TX_WRAP, G_TX_WRAP,
                5, 5, G_TX_NOLOD, G_TX_NOLOD),

/*
 * Since normal load macros use tile 0 for render, I need to set 
 * tile 1 manually to point at alpha texture.
 */

gsDPSetTile(G_IM_FMT_I, G_IM_SIZ_4b, 2, 256, 1,
                0,
                G_TX_WRAP,5,  G_TX_NOLOD,
                G_TX_WRAP,5,  G_TX_NOLOD),

gsDPSetTileSize( 1, 0, 0, 31 << 2, 31 << 2),
...
/* make sure in two-cycle mode */

gsDPSetCycleType(G_CYC_2CYCLE),


2. Tip: Gamma Correction

Super NES and Super Famicom do not have gamma correction hardware but the Nintendo 64 does. Some developers have indicated that the colors look washed out on the N64 with gamma correction turned on.

If you are currently writing games for Super NES or Super Famicom (or any machine that does not have gamma correction), your production path is likely to be setup to compensate for the lack of gamma correction hardware. In other words, you are probably picking pre-gamma corrected colors. If you use this same production path and turn Ultra 64 gamma correction on, you will get the wash out effect because you would have gamma corrected twice.

To undo the first gamma correction, square and shift down by 8 each color component (assuming 8 bit color) or rework your path to exclude the gamma correction stop, leaving gamma correction to the hardware.