tg-parabolicmap illustrates one method for converting a cube (environment) map into a dual paraboloid map. Dual-paraboloid maps can be used for reflection mapping. The advantage of dual paraboloid maps over sphere maps is that they do not need to be rerendered when the viewpoint changes. Of course, if the environment itself is changing, you will need to regenerate the map.
This demo creates a dual-paraboloid map by projecting each face of the cube map onto a sphere. In this case, the normal vectors of the sphere are actually reflection vectors. The reflection vectors are projected into texture coordinates that warp the texture of the cube map onto the surface of the sphere.
This demo has controls that help visualize the steps that are required to generate the dual paraboloid map. These steps include clipping the +q coordinate of the projected texture and generating a composite alpha for each individual map. Two sets of prerendered cube maps are provided. One has labels for left, right, top, bottom, back and front, and another is taken from the courtyard database (max/Crtyard).
| Functions | Parameters | Description |
GXLoadTexMtxImm |
Matrices | Appropriate projection matrix. |
| Matrix destination. | GX_TEXMTX0 |
|
| Types | GX_MTX3x4 |
|
GXSetTexCoordGen |
Destination coordinates. | GX_TEXCOORD0. |
| Generation type. | GX_TG_MTX3x4 |
|
| Generation source. | GX_TG_POS |
|
| Matrix source. | GX_TEXMTX0 |
End the test with START.
A Button display all the cube faces in the dual paraboloid map. B Button display individual cube faces. X Button selects the cube map texture. Y Button selects the alpha/color channel to display.
$REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-cube.tpl
$REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-cube1.tpl
2006/03/01 Initial version.
CONFIDENTIAL