Game Development Community

Basic Cubemap Implementation & Tool

by Lorne McIntosh · in Game Design and Creative Issues · 04/11/2008 (6:46 pm) · 2 replies

I noticed there's not much documentation on implementing a simple cubemap so I thought I'd put some basic knowledge down here on what I've learned in trying to get cubemaps working in TGEA. Hope someone finds this useful :)

Tool:

For starters, here's a decent tool I've found for helping create smoother cubemaps. It's called CubeMapGen and can be found here:

ati.amd.com/developer/cubemapgen/index.html

What it lets you do is import each of your 6 cubemap images and map them onto a sphere (or any .obj you'd like) so that you can preview it easily without having to load up Torque. There's also a great feature called "edge fixup" that allows you to "blur" the seams of your cubemap because it is often hard to get a seamless cubmap (if anyone knows of a good way to do this please share!). After you blur the seams the tool will let you export each face with the blur baked into each face. There is also a built in mip map feature.


Material.cs code Sample:

new CubemapData( cubemapname )
{
cubeFace[0] = "~/data/interiors/metal_ball/cubemapxpos";
cubeFace[1] = "~/data/interiors/metal_ball/cubemapxneg";
cubeFace[2] = "~/data/interiors/metal_ball/cubemapypos";
cubeFace[3] = "~/data/interiors/metal_ball/cubemapyneg";
cubeFace[4] = "~/data/interiors/metal_ball/cubemapzpos";
cubeFace[5] = "~/data/interiors/metal_ball/cubemapzneg";
};

/*
Through trial and error it seems that no matter where you put your
cubemap face textures you need to include the full path to the images
(as you can see from above)
*/

new Material(chrome)
{
mapTo = "chrome_color";
basetex[0] = "chrome_color";
bumptex[0] = "chrome_normal";
cubemap = cubemapname;
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 32.0;

};

About the author

Ubiq Visuals is a software and creative content developer for the entertainment industry. Our vision is to provide inspiration and the tools for soon-to-be game designers and creative minds of all ages.


#1
05/13/2008 (10:40 pm)
Great resource!!! I made a great looking chrome map first try. Thanks for the information.
#2
06/03/2008 (6:37 am)
Tnx for this :)