Oldest known version of this page was edited on 2006-07-20 21:12:30 by DintHer []
Page view:
Articles - Cube Mapped Textures
In the movie Terminator 2 there's a metal shape shifting android that has a reflective surface. As the android moves the reflection changes like a real reflective surface. This effect can be created in GLScene using cube mapping. Cube mapping involves creating a cube of textures around the object in question.

(Picture from
Rosalee Wolfes site∞)
A cube of textures requires 6 textures:

(Picture from
Rosalee Wolfes site∞)
The cube map defines the environment surrounding the object and as the object is moved the cube map stays static while the texture displayed on the object changes depending on the position of the object in relation to the cube map.
Cube mapping in GLScene requires specifying 6 textures to the
TGLTexture image property rather than just one texture. TGLTexture.imageclassname should be set to 'Cube Map' instead of 'Persistant Image' (which is the default imageclass name ) or at run time the image class name can be specified as follows:
texture.ImageClassName:=
TGLCubeMapImage.ClassName;
Six textures can be loaded by into the
TGLTexture.image property. The width and height of the textures must be to the power of two eg 64x64:
with Image as TGLCubeMapImage do begin
// Load all 6 texture map components of the cube map
// The 'PX', 'NX', etc. refer to 'positive X', 'negative X', etc.
// and follow the RenderMan specs/conventions
Picture[cmtPX].LoadFromFile('cm_left.jpg');
Picture[cmtNX].LoadFromFile('cm_right.jpg');
Picture[cmtPY].LoadFromFile('cm_top.jpg');
Picture[cmtNY].LoadFromFile('cm_bottom.jpg');
Picture[cmtPZ].LoadFromFile('cm_back.jpg');
Picture[cmtNZ].LoadFromFile('cm_front.jpg');
end;
The mapping mode of the
TGLTexture should be set to tmmCubeMapReflection instead of tmmUser. When you apply the texture to a GLScene object a cube mapped reflection should be visible.
There is a demo showing cube mapping in CVS. It is the demo under demos\materials\cubemap
by skinhat