Here are some sample Texture Environment (TEV) settings.
Polygons and Vertex Lighting with Applied Vertex Colors
This configuration passes a rasterized color channel directly with the PASSCLR operation. No texture is used.
// One Rasterized Color
// The channel COLOR0A0 is supposed to have lit color.
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD_NULL,
GX_TEXMAP_NULL,
GX_COLOR0A0 );
GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);Simple Texture Mapping
This configuration is used for displaying texture color directly. No rasterized color can be used.
// One Texture
// A texture should be loaded to GX_TEXMAP0.
// An appropriate texcoord generation should be set to GX_TEXCOORD0.
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD0,
GX_TEXMAP0,
GX_COLOR_NULL );
GXSetTevOp(GX_TEVSTAGE0, GX_REPLACE);Applying Lighting to Material Textures
This configuration uses the MODULATE operation.
// One Texture Modulated by Rasterized Color
// The channel COLOR0A0 is supposed to have lit color.
// A texture should be loaded to GX_TEXMAP0.
// An appropriate texcoord generation should be set to GX_TEXCOORD0.
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD0,
GX_TEXMAP0,
GX_COLOR0A0 );
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);Highlight Map with a Diffuse Lit Surface
Projected Shadow Map on Lit Surface
This configuration uses the DECAL operation. The texture should contain an alpha value which will be used for blending.
// One Texture Modulated by Rasterized Color
// The channel COLOR0A0 is supposed to have lit color.
// A texture should be loaded to GX_TEXMAP0.
// An appropriate texcoord generation should be set to GX_TEXCOORD0.
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD0,
GX_TEXMAP0,
GX_COLOR0A0 );
GXSetTevOp(GX_TEVSTAGE0, GX_DECAL);This configuration uses neither the output from lighting unit nor any texture.
// Constant color from TEV register
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD_NULL,
GX_TEXMAP_NULL,
GX_COLOR_NULL );
GXSetTevColorIn( // output = Register0
GX_TEVSTAGE0,
GX_CC_ZERO,
GX_CC_ZERO,
GX_CC_ZERO,
GX_CC_C0 );
GXSetTevColorOp(
GX_TEVSTAGE0,
GX_TEV_ADD,
GX_TB_ZERO,
GX_CS_SCALE_1,
GX_DISABLE,
GX_TEVPREV );
GXSetTevColor(GX_TEVREG0, constColor);Diffuse Lit Color + Specular Lit Color
No texture is used. The first stage passes the rasterized color as is with the PASSCLR operation. The second stage adds two colors where a detailed setting is required.
// Add Two Rasterized Colors
// Two Color channels COLOR0/COLOR1 will be used.
GXSetNumTevStages(2);
// Stage0 simply passes the rasterized color.
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD_NULL,
GX_TEXMAP_NULL,
GX_COLOR0A0 );
GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
// Stage1 adds the second color and output from previous stage.
GXSetTevOrder(
GX_TEVSTAGE1,
GX_TEXCOORD_NULL,
GX_TEXMAP_NULL,
GX_COLOR1A1);
GXSetTevColorIn( // output = RASC + CPREV
GX_TEVSTAGE1,
GX_CC_ZERO,
GX_CC_RASC,
GX_CC_ONE,
GX_CC_CPREV );
GXSetTevColorOp(
GX_TEVSTAGE1,
GX_TEV_ADD,
GX_TB_ZERO,
GX_CS_SCALE_1,
GX_ENABLE,
GX_TEVPREV );Diffuse Lit Color + Specular Lit Color with Alpha Channel Processing
If the specular color is white, the alpha channel can be used as a specular light color which will be broadcast to each RGB component for a TEV stage. Since it requires only one stage, better fill-rates are possible than when using two channels. This method is only available if the alpha is not reserved for another purpose.
// Add Rasterized Color and Alpha
// Color0/Alpha0 may be processed independently.
GXSetNumTevStages(1);
GXSetTevOrder(
GX_TEVSTAGE0,
GX_TEXCOORD_NULL,
GX_TEXMAP_NULL,
GX_COLOR0A0 );
GXSetTevColorIn( // output = RASC + RASA
GX_TEVSTAGE0,
GX_CC_ZERO,
GX_CC_RASA,
GX_CC_ONE,
GX_CC_RASC );
GXSetTevColorOp(
GX_TEVSTAGE0,
GX_TEV_ADD,
GX_TB_ZERO,
GX_CS_SCALE_1,
GX_ENABLE,
GX_TEVPREV );
2006/03/01 Initial version.
CONFIDENTIAL