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 a rasterized color channel directly with the <code>PASSCLR</code> operation. No texture is used.</P>
16<DL><DD><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></DD></DL>
17
18<H2>One Texture</H2>
19<P>Simple Texture Mapping</P>
20<P>This configuration is used for displaying texture color directly. No rasterized color can be used.</P>
21<DL><DD><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></DD></DL>
22
23<H2>One Texture Modified by Rasterized Color</H2>
24<P>Applying Lighting to Material Textures</P>
25<P>This configuration uses the <code>MODULATE</code> operation.</P>
26<DL><DD><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></DD></DL>
27
28<H2>One Texture Overlaid on Rasterized Color</H2>
29<P>Highlight Map with a Diffuse Lit Surface<br>Projected Shadow Map on Lit Surface</P>
30<P>This configuration uses the <code>DECAL</code> operation. The texture should contain an alpha value which will be used for blending.</P>
31<DL><DD><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></DD></DL>
32
33<H2>Constant Color</H2>
34<P>This configuration uses neither the output from lighting unit nor any texture.</P>
35<DL><DD><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></DD></DL>
36
37<H2>Add Two Rasterized Colors</H2>
38<P>Diffuse Lit Color + Specular Lit Color</P>
39<P>No texture is used. The first stage passes the rasterized color as is with the <code>PASSCLR</code> operation. The second stage adds two colors where a detailed setting is required.</P>
40<DL><DD><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></DD></DL>
41
42<H2>Add Rasterized Color and Alpha</H2>
43<P>Diffuse Lit Color + Specular Lit Color with Alpha Channel Processing</P>
44<P>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.</P>
45<DL><DD><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></DD></DL>
46
47<H2>Revision History</H2>
48<P>
492006/03/01 Initial version.<br>
50</P>
51
52<hr><p>CONFIDENTIAL</p></body>
53</HTML>