1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>TEV Configuration Guide</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">TEV Configuration Guide</H1>
12<P>Here are some sample Texture Environment (TEV) settings.</P>
13<H2>One Rasterized Color</H2>
14<P>Polygons and Vertex Lighting with Applied Vertex Colors</P>
15<P>This configuration passes rasterized color channel directly with the <code>PASSCLR</code> operation. No texture is used.</P>
16<P><CODE>// One Rasterized Color<BR> // The channel COLOR0A0 is supposed to have lit color.<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR0A0 );<BR> GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);</CODE></P>
17<H2>One Texture</H2>
18<P>Simple Texture Mapping</P>
19<P>This configuration is used for displaying texture color directly. No rasterized color can be used.</P>
20<P><CODE>// One Texture<BR> // A texture should be loaded to GX_TEXMAP0.<BR> // An appropriate texcoord generation should be set to GX_TEXCOORD0.<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP0,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR_NULL );<BR> GXSetTevOp(GX_TEVSTAGE0, GX_REPLACE);</CODE></P>
21<H2>One Texture Modified by Rasterized Color</H2>
22<P>Applying Lighting to Material Textures</P>
23<P>This configuration uses the <code>MODULATE</code> operation.</P>
24<P><CODE>// One Texture Modulated by Rasterized Color<BR> // The channel COLOR0A0 is supposed to have lit color.<BR> // A texture should be loaded to GX_TEXMAP0.<BR> // An appropriate texcoord generation should be set to GX_TEXCOORD0.<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP0,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR0A0 );<BR> GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);</CODE></P>
25<H2>One Texture Overlaid on Rasterized Color</H2>
26<P>Highlight Map with a Diffuse Lit Surface<br>Projected Shadow Map on Lit Surface</P>
27<P>This configuration uses the <code>DECAL</code> operation. The texture should contain an alpha value which will be used for blending.</P>
28<P><CODE>// One Texture Modulated by Rasterized Color<BR> // The channel COLOR0A0 is supposed to have lit color.<BR> // A texture should be loaded to GX_TEXMAP0.<BR> // An appropriate texcoord generation should be set to GX_TEXCOORD0.<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP0,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR0A0 );<BR> GXSetTevOp(GX_TEVSTAGE0, GX_DECAL);</CODE></P>
29<H2>Constant Color</H2>
30<P>This configuration uses neither the output from lighting unit nor any texture.</P>
31<P><CODE>// Constant color from TEV register<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR_NULL );<BR> GXSetTevColorIn(&nbsp; // output = Register0<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CC_C0 );<BR> GXSetTevColorOp(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEV_ADD,<BR> &nbsp;&nbsp;&nbsp; GX_TB_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CS_SCALE_1,<BR> &nbsp;&nbsp;&nbsp; GX_DISABLE,<BR> &nbsp;&nbsp;&nbsp; GX_TEVPREV );<BR> GXSetTevColor(GX_TEVREG0, constColor);</CODE></P>
32<H2>Add Two Rasterized Colors</H2>
33<P>Diffuse Lit Color + Specular Lit Color</P>
34<P>No texture is used. The first stage passes the first rasterized color with the <code>PASSCLR</code> operation. The second stage adds two colors where a detailed setting is required.</P>
35<P><CODE>// Add Two Rasterized Colors<BR> // Two Color channels COLOR0/COLOR1 will be used.<BR> <BR> GXSetNumTevStages(2);<BR> <BR> // Stage0 simply passes the rasterized color.<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR0A0 );<BR> GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);<BR> <BR> // Stage1 adds the second color and output from previous stage.<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE1,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR1A1);<BR> GXSetTevColorIn(&nbsp; // output = RASC + CPREV<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE1,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CC_RASC,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ONE,<BR> &nbsp;&nbsp;&nbsp; GX_CC_CPREV );<BR> GXSetTevColorOp(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE1,<BR> &nbsp;&nbsp;&nbsp; GX_TEV_ADD,<BR> &nbsp;&nbsp;&nbsp; GX_TB_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CS_SCALE_1,<BR> &nbsp;&nbsp;&nbsp; GX_ENABLE,<BR> &nbsp;&nbsp;&nbsp; GX_TEVPREV );</CODE></P>
36<H2>Add Rasterized Color and Alpha</H2>
37<P>Diffuse Lit Color + Specular Lit Color with Alpha Channel Processing</P>
38<P>If the specular color is white, the alpha channel can be used as a specular lit color which will be broadcasted 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.</P>
39<P><CODE>// Add Rasterized Color and Alpha<BR> // Color0/Alpha0 may be processed independently.<BR> <BR> GXSetNumTevStages(1);<BR> GXSetTevOrder(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEXCOORD_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_TEXMAP_NULL,<BR> &nbsp;&nbsp;&nbsp; GX_COLOR0A0 );<BR> GXSetTevColorIn(&nbsp; // output = RASC + RASA<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CC_RASA,<BR> &nbsp;&nbsp;&nbsp; GX_CC_ONE,<BR> &nbsp;&nbsp;&nbsp; GX_CC_RASC );<BR> GXSetTevColorOp(<BR> &nbsp;&nbsp;&nbsp; GX_TEVSTAGE0,<BR> &nbsp;&nbsp;&nbsp; GX_TEV_ADD,<BR> &nbsp;&nbsp;&nbsp; GX_TB_ZERO,<BR> &nbsp;&nbsp;&nbsp; GX_CS_SCALE_1,<BR> &nbsp;&nbsp;&nbsp; GX_ENABLE,<BR> &nbsp;&nbsp;&nbsp; GX_TEVPREV );</CODE></P>
40<H2>Revision History</H2>
41<P>2006/03/01 Initial version.</P>
42
43<hr>
44<P>CONFIDENTIAL</p>
45</BODY>
46</HTML>
47