(Back to tutorials index)
A cubemap is a special layout of a panorama, often used in computer games. This layout gives the least amount of distortion and wastes as little texture space as possible. There are different types of cubemap layouts. Here are some examples of possible layouts:
All skies on CGTextures are available in the cubemap format, but it may be useful to be able to convert between different formats. For example, the stretching at the top in a equirectangular projection ("map of the world" style layout) makes it difficult to paint on the top of the sky. To convert equirectangular panoramas to a cubemap, you can either use your 3D application of choice (set up 6 cameras and render out the cube faces) or use one of the following:
Pano2VR - Creates 3D Flash previews and converts to all sorts of panorama layouts - 59 euros
NVidia DDS exporter
Most games on Windows use the DDS file format for their textures. This file format is supported by the hardware of the video card. The video card has limited memory, and the texture is stored with compression in the video memory and decompressed 'on the fly' when drawn onscreen. This saves a lot of memory!
To save cubemaps in this format you can use the NVidia DDS Exporter plugin for Photoshop. The cubemaps available on CGTextures are already in the right order to save with the NVidia plugin:
When exporting to a DDS texture, be sure the size is a power of two. Check whether your cubemap has one of the following sizes:
1536 x 256 pixels
3072 x 512 pixels
6144 x 1024 pixels
12288 x 2048 pixels
Save with the following settings:
- DXT1 Compression (plain color, no alpha)
- Drop down menu: Cubemap
- No Mipmaps (depends on your engine, lower mipmaps might be used for lower display settings or cubic reflection maps)
These settings are just examples. Depending on the exact engine, other settings might be needed. For example, the Source Engine (Half Life 2) needs the cubemap as 5 seperate DDS files, with only the sky in the image and everything below the horizon cropped.
Another free utility to create DDS cubemaps is ATI's CubeMapGen.
The special feature of this utility is that it lets you create Mipmaps for your cubemap with better filtering. The Nvidia Exporter filters the Mipmaps in isolation (the seperate cube faces have no influence on each other), which can lead to artifacts in the Mipmaps. The ATI CubeMapGen filters the cubemap as a whole.
These Mipmaps can be used for blurry metal shaders or for better ambient lighting, for more information see the link to the article about Convolved Cube Maps at the end of this page.
The ATI CubemapGen Utility needs the cubemap in the 'Vertical Cross' layout. To convert between the NVidia Horizontal Strip and the Vertical Cross layout I have created some Photoshop actions:
StripToCross.atn - Photoshop CS3 Actions to convert cubemaps to Vertical Cross.
Simply run the run the correct action for the height of your image, and the result will be a cubemap in the Vertical Cross cubemap:
An article on how to use ATI's CubeMapGen to filter cubemaps:
NVidia's DDS Exporter for Photoshop:
Pano2VR - A utility for creating 3D Flash previews and converting panoramas in different layouts.