tg-dual

Description

This program demonstrates a few methods of dual-transform texture coordinate generation. The dual-transform texgen feature makes it easy to render some texture effects such as the two examples shown in this demo. One is a texture projection (like shadows) which uses position for texgen source. Another is normal-based reflection mapping. In both cases, you can simply set position or normal transform matrices for the first texgen transform and one pre-calculated constant matrix for the second texgen. You don't have to recalculate texgen matrix every time and therefore you can save the CPU processing costs. This method is also suitable for stitched models.

Coverage

Functions Parameters Description
GXLoadTexMtxImm Matrices Appropriate projection matrix.
Matrix destination. GX_TEXMTX0, GX_PTTEXMTX0, GX_PTTEXMTX1
Types GX_MTX3x4
GXSetTexCoordGen2 Destination coordinates. Always GX_TEXCOORD0.
Generation type. GX_TG_MTX3x4
Generation source. GX_TG_POS, GX_TG_NRM
mtx src for the first transform GX_TEXMTX0
normalization GX_TRUE / GX_FALSE
mtx src for the second transform GX_PTTEXMTX0, GX_PTTEXMTX1

Using the Demo

PAUSE exits the test. The main stick rotates the model. The sub stick moves the location of light source. The A Button switches the texgen mode. (Projection/Reflection)
The L/R Buttons control the width of the light frustum. This is available only on projection mode.

Snapshot

Texture projection by dual-transform.

tg-dual-0.jpg (21849 bytes)

Reflection mapping by dual-transform.

tg-dual-1.jpg (19547 bytes)

Required Data Files

$REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-dual.tpl

Revision History

2006/03/01 Initial version.


CONFIDENTIAL