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>tg-spheremap</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">tg-spheremap</H1> 12 13<H2>Description</H2> 14<P><code>tg-spheremap</code> illustrates a method for converting a cube (environment) map into a sphere map. Sphere maps can be used for reflection mapping. Generating sphere maps is efficient but must be re-rendered when the viewpoint changes. Of course, if the environment itself changes, you will also need to regenerate the map.</P> 15<P>This demo creates a sphere 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. A 3D model (torus) is also displayed with the sphere map as an example of reflection mapping.</P> 16<P>This demo has controls that help visualize the steps that are required to generate the sphere map, which 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).</P> 17 18<H2>Coverage</H2> 19<TABLE border="1" cellpadding="3" cellspacing="0.1" width="640"> 20 <TBODY> 21 <TR> 22<TD width="30%" bgcolor="#C0C0C0"><EM><STRONG>Functions</STRONG></EM></TD> 23<TD width="25%" bgcolor="#C0C0C0"><EM><STRONG>Parameters</STRONG></EM></TD> 24<TD width="45%" bgcolor="#C0C0C0"><EM><STRONG>Description</STRONG></EM></TD> 25 </TR> 26 <TR> 27<TD width="30%" rowspan="3"><A href="../../../gx/Transform/GXLoadTexMtxImm.html"><CODE>GXLoadTexMtxImm</CODE></A></TD> 28<TD width="25%"><SPAN class="argument">Matrices</SPAN></TD> 29<TD width="45%">Appropriate projection matrix.</TD> 30 </TR> 31 <TR> 32<TD width="25%"><SPAN class="argument">Matrix destination.</SPAN></TD> 33<TD width="45%"><CODE>GX_TEXMTX0</CODE></TD> 34 </TR> 35 <TR> 36<TD width="25%"><SPAN class="argument">Types</SPAN></TD> 37<TD width="45%"><CODE>GX_MTX3x4</CODE></TD> 38 </TR> 39 <TR> 40<TD width="30%" rowspan="4"><A href="../../../gx/TexCoordGen/GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A></TD> 41<TD width="25%"><SPAN class="argument">Destination coordinates.</SPAN></TD> 42<TD width="45%"><CODE><font face="Courier New">GX_TEXCOORD0</font>.</CODE></TD> 43 </TR> 44 <TR> 45<TD width="25%"><SPAN class="argument">Generation type.</SPAN></TD> 46<TD width="45%"><CODE>GX_TG_MTX3x4</CODE></TD> 47 </TR> 48 <TR> 49<TD width="25%"><SPAN class="argument">Generation source.</SPAN></TD> 50<TD width="45%"><CODE>GX_TG_NRM</CODE></TD> 51 </TR> 52 <TR> 53<TD width="25%"><SPAN class="argument">Matrix source.</SPAN></TD> 54<TD width="45%"><CODE>GX_TEXMTX0</CODE></TD> 55 </TR> 56 </TBODY> 57</TABLE> 58<H2>Using the Demo</H2> 59<P>PAUSE exits the test. The <STRONG>Control Stick</STRONG> rotates the reflection-mapped torus. The <strong>A Button</strong> selects the cube map texture. The <strong>B Button</strong> displays individual cube faces. The <strong>Y Button</strong> displays all the cube faces in the sphere map. The Z Button selects the alpha/color channel to display.</P> 60 61<H2>Snapshot</H2> 62<P>Test cube map that visualizes how the cube is projected onto the sphere map.</P> 63<P><IMG src="./images/tg-spheremap-0.jpg" alt="tg-spheremap-0.jpg (33065 bytes)" width="640" height="448"></P> 64 65<P>Environment map example created from the courtyard database.</P> 66<P><IMG src="./images/tg-spheremap-1.jpg" alt="tg-spheremap-1.jpg (24219 bytes)" width="640" height="448"></P> 67 68<H2>Required Data Files</H2> 69<P><CODE>$REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-cube.tpl<BR> $REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-cube1.tpl</CODE></P> 70 71<H2>Revision History</H2> 72<P> 732006/03/01 Initial version.<br> 74</P> 75 76<hr><p>CONFIDENTIAL</p></body> 77</HTML>