tev-complex

Description

This program is an example of multitexture processing that uses complex TEV settings. A torus is displayed using textures like material texture, bump, reflection, and diffusion map. Two color channels are also used. (One for diffuse and one for specular usage.)

Coverage

Functions Parameters Description
GXInitTexObj Pointer to image data. Appropriate value.
Width and height Appropriate value.
format Appropriate value.
Wrap mode (s, t). Appropriate value.
Mipmap GX_FALSE
GXLoadTexObj Destination texture name GX_TEXMAP0 - GX_TEXMAP3
GXSetNumChans Number of color channels. 2
GXSetChanCtrl Channel ID GX_COLOR0A0, GX_COLOR1A1.
Channel enable Always GX_ENABLE.
Ambient color source Always GX_SRC_REG.
Material color source Always GX_SRC_REG.
Light mask GX_LIGHT0 (for channel 0)
GX_LIGHT1 (for channel 1)
Diffusion function GX_DF_CLAMP (for channel 0)
GX_DF_NONE (for channel 1)
Attenuation function GX_AF_NONE (for channel 0)
GX_AF_SPEC (for channel 1)
GXSetNumTexGens number of texture coordinates. 5
GXSetTexCoordGen Texture coordinate ID GX_TEXCOORD0 - GX_TEXCOORD4
Type of texture coordinate generation GX_TG_MTX2x4, GX_TG_BUMP0
Source parameter of texture coordinate generation. GX_TG_TEX0, GX_TG_NRM, GX_TG_TEXCOORD1
Matrix index Appropriate matrix index.
GXSetNumTevStages Number of TEV Stages 5
GXSetTevColor Output color register ID GX_TEVREG0 - GX_TEVREG2
Color Appropriate value.
GXSetTevColorIn TEV stage ID. GX_TEVSTAGE0 - GX_TEVSTAGE4
Input variable A/B/C/D. Appropriate value (use fixed value).
GXSetTevColorOp TEV stage ID. GX_TEVSTAGE0 - GX_TEVSTAGE4
Operator/bias/scale. Appropriate value (use fixed value).
Clamp GX_FALSE
Output register ID GX_TEVREG2, GX_TEVPREV
GXSetTevAlphaIn TEV stage ID. GX_TEVSTAGE0 - GX_TEVSTAGE4
Input variable A/B/C/D. Appropriate value (use fixed value).
GXSetTevAlphaOp TEV stage ID. GX_TEVSTAGE0 - GX_TEVSTAGE4
Operator/bias/scale. Appropriate value (use fixed value).
Clamp GX_FALSE
Output register ID. GX_TEVREG2, GX_TEVPREV
GXSetTevOrder TEV stage ID. GX_TEVSTAGE0 - GX_TEVSTAGE4
Texture coordinate ID. GX_TEXCOORD0 - GX_TEXCOORD4
Texture map ID. GX_TEXMAP0 - GX_TEXMAP3
Color channel ID. GX_COLOR0A0, GX_COLOR1A1

Using the Demo

End the test with START.

Rotate the model with the Control Stick.

Move the light location that is centered at the model with the C Stick.

Snapshot

tev-complex-0.jpg (26520 bytes)

Algorithm Details

This multitexture effect uses 2 color channels, 4 textures, and 5 TEV stages.

Color channel 0. Diffuse light color (Cd).
Color channel 1. Specular light color (Cs).
Texture map 0. Bump texture (Tb).
Texture map 1. Base material texture (Tm).
Texture map 2. Reflection map (Tr).
Texture map 3. Gloss map (Tg) : actually (1-Tg) is used in the specular calculation.
TEV stage 0. Rprev = Cd + Sb * Tb
TEV stage 1 Rprev = Rprev - Sb * Tb (Perturbation for embossing)
TEV stage 2 Reg2 = Rprev * Tm
TEV stage 3 Rprev = Cs + Sr * Tr
TEV stage 4 Rprev (final output) = Tg * Reg2 + (1 - Tg) Rprev

(Sb and Sr are scale constants stored in TEV register 0 and 1.)

Required Data Files

$REVOLUTION_SDK_ROOT/dvddata/gxTests/tev-03.tpl

Revision History

2008/05/12 Corrected the old function name, GXSetTevStages, to the new name, GXSetNumTevStages.

2006/03/01 Initial version.


CONFIDENTIAL