tg-shadow

Description

This program performs shadow projection using texture coordinate generation and a two-pass rendering method. A shadow pattern is rendered along the first path. Next, the frame buffer is copy output as a texture. For the second path, this shadow texture is projected onto the floor. This demo shows a scene of a torus object shadow.

Coverage

Functions Parameters Description
GXLoadTexMtxImm Matrices Appropriate projection matrix.
Matrix destination. GX_TEXMTX1
Types GX_MTX3x4
GXSetNumTexGens number of texture coordinates. 0, 1
GXSetTexCoordGen Destination coordinates. GX_TEXCOORD1
Generation type. GX_TG_MTX3x4
Generation source. GX_TG_POS
Matrix source. GX_TEXMTX1
GXInitTexObj Pointer to image data. Appropriate value.
Width and height Appropriate value.
Format GX_TF_IA4, GX_TF_RGB5A3
Wrap mode (s, t). GX_CLAMP, GX_REPEAT.
Mipmap Always GX_FALSE.
GXLoadTexObj Destination texture name. GX_TEXMAP0, GX_TEXMAP1
GXInvalidateTexAll (No parameter)
GXSetTexCopySrc top / left / width / height Only fixed size.
GXSetTexCopyDst Width and height Only fixed size.
Format Always GX_TF_IA4.
Mipmap filter GX_TRUE
GXCopyTex Pointer to image data. Appropriate value.
Clear operation GX_TRUE
GXSetCopyClear Color Only one color.
Z value Always 0xFFFFFF.
GXSetTevOp TEV stage ID. GX_TEVSTAGE0, GX_TEVSTAGE1.
Operation mode GX_MODULATE for stage0, GX_DECAL for stage1
GXSetPixelFmt Pixel Format GX_PF_RGBA6_Z24
Z compression format Always GX_ZC_LINEAR.
GXPixModeSync (No parameter)

Using the Demo

START exits the test.

The Control Stick moves camera position. The C Stick moves light position. The A Button starts or stops the spinning animation of the torus object.

Snapshot

tg-shadow.jpg (46270 bytes)

Required Data Files

$REVOLUTION_SDK_ROOT/dvddata/gxTextrs.tpl

Revision History

2006/03/01 Initial version.


CONFIDENTIAL