Cubemaps are used in real time rendering engines (mostly in video games) to fake reflections on objects. Raytracing is slow and heavy on the CPU, so instead of tracing rays it’s faster to take the informations from a pre-calculated image. A Cubemap is made of six different images mapped on a cube (one image per face). Most of the time those six images are parts of a 360° panorama, it’s faster to use this type of projection vs a sphere (because the sphere will obviously have more polygons than a cube).
Video games use them it for all kind of reflections on metallic objects, they also use them for skybox backgrounds (environements) or just special effects on shaders (for example you can fake global illumination using a cubemap) because it’s very fast and the results are impressive.
Recent games even use cubemaps to fake global illumination and diffuse illumination by using a high mipmap level of a cubmap. The high mipmap level is like a blurry version of your sharp cubemap, which contain the light informations but not the details, it’s usually called a “Diffusely Convolved cubemap” (read this article on the polycount wiki for more informations).
Software used in this article
Picturenaut + Filter plugins (read the instructions to install the plugins)
HDRshop v1 (the version two is not a freeware)
ATI cubemapgen (download link at the bottom of the page)
What's a diffusely convolved cubemap ?
Behind this strange word there’s a simple explanation, making a sharp panorama into a diffusely convolved one is like taking a picture in Photoshop and applying some blur. The only difference here, between Photoshop and Picturenaut, is that Picturenaut blur the image and respect the outer edges. The result, when applied to a sphere, has no visible seams !
Sharp reflections or smooth illumination
Here you can see the difference between a sharp panorama and the diffuse version of it. The sharp one is usually used for reflections on metallic objects while the diffuse one is used to mimic the effects of global illumination. You could also have a less diffuse but not quite perfectly sharp one for objects with glossy reflections.


Now, let’s see what’s the result if we don’t use Picturnaut. Here’s a version with some Photoshop gaussian blur. There’s more details, less light from the sun, a lot more brown and orange colors from the buildings. And most importantly (you can’t see it on that image, because it’s flat) there’s a difference between the top and bottom pixels and between the left and right pixels.

How does that look on objects ?
Here’s the previous panorama applied to the Standford rabbit model in a realtime engine. I also added a small ammount of fresnel in the luminance to make the edges a little bit more defined.

As you can see with the diffusely convolved panorama you only get soft lights, in game engine they combine that soft indirect light to dynamic lights (spots, sun, torchlight and so on) to get even more realistic results. You could also combine that version with a slight ammount of the sharp cubemap to fake materials like porcelain.

In the next example I just used the sharp cubemap, you can clearly see the chrome look and feel. Its even more impressive when you move the camera around. Even if the mesh doesn’t reflect itself you get very nice fake realtime reflections. It almost look like a render.

Here’s another example just for fun, the teapot metal is made high mipmap level of the sharp cubemap and the black rubber is made from the same cubemap but diffusely convolved.

Another benefit of using cubemaps
What’s cool about them is that you can have different mipmap levels in the same file (see Mipmap on Wikipedia). Using the embedded mipmap levels you can do both chrome and blurry aluminium reflections using only one cubemap. For sharp reflections like chrome you use the mipmap level 0 (with the higher definition) and for the blurry reflections like aluminium you use a higher mipmap level (with a smaller definition). At each mipmap level the cubemap become blurrier.
Its also good for your graphic card memory, if you look at a chrome object in a video game that’s 10 meters far from the camera you don’t need a 1024 pixel cubemap on it because the object take only 20 pixel on your screen. The object will use a higher resolution cubemap if you get close to it. Think like that, mipmap are like LOD (see Level of Detail on wikipedia) but for textures.
How do I make cubemaps ?
First of all you need some 360° images, they can be in various projection methods (panorama, spherical, cross). If you don’t know where to get some free images, you can go to the sIBL Archive and download some of their files. In each package you will get a 8bit JPG file and a 32bit EXR file in panorama projection. You can use both.
8bit vs 32bit cubemaps
You can work with HDR images or LDR images (see High dynamic range imaging on wikipedia). LDR images like 8bit JPG are enough for most cases. 32bit cubemaps are used mostly for skyboxes (a good example on the Valve wiki) because they got more dynamic range, thus they give even better results in quality than 8bit images. The only drawback is that they are more expensive for the graphic card. Hopefully you can convert the 32bit files into 8bit files…
Tools to use
There’s not one workflow for cubemap creation, but here’s the tools I use and what purpose they serve. The basic workflow is getting a panorama (or shooting one), converting that panorama to a vertical cross projection and generating the cubemap from that file.

Picturenaut is one of the free tool you gonna love. You can use it to convert the HDR images to LDR ones when you need it. That’s also the tool you will use to generate the Diffusely Convolved version of your sharp panorama.

HDRshop is used to convert your panorama (latitude longitude projection) to a vertical cross one. Here’s an example of a vertical cross projection, it look like an unfolded cube.

Generating the cubemap in ATI Cubemapgen
Once you got a vertical cross projected image you will need to use ATI Cubemapgen. With this tool you can load your vertical cross and filter it to a cubemap. There’s plenty of options, you can generate mipmaps, blur the generated cubemap etc… You can import HDR or LDR vertical cross, DDS cubemaps, or separate faces (one image per face) You can then save DDS cubemap, separate faces or cubemap cross depending on the engine you’re gonna use. I use DDS cubemap since it’s the most common type in real time engines (see DirectDraw Surface on wikipedia).
I usually do a Diffusely Convolved cubemap at 64 pixels per face for lighting. Some 128 pixels per face with different ammounts of blur (for rough materials). And a 1024 or 512 pixels per face for chrome materials with a super small blur of 4 pixels (perfectly sharp reflections look wrong).
Other utilities for Windows
To see the .DDS files in the explorer you need the Nvidia DDS Thumbnail viewer. You can also use the Windows Texture viewer to view your .DDS at full size. There’ also the Nvidia DDS Plugins if you use Photoshop to load and export .DDS files.
Information and other things about this subject
The polycount wiki got one article about cubemaps and another article about the diffusely convolved cubemaps. The Marmoset toolbag is a real time engine to showcase models for game artists which support cubemaps and HDR files as illumination source. It’s also one of the best engine with the Unreal 3 engine for taking screenshots of game assets.
Ressources used in this tutorial
Barcelona rooftops from the Smart IBL Archive on hdrlabs.com (awesome site by the way)
The classic Standford Bunny model from the Standford University, modified version with less polygons by Mr.Bluesummers (good things on his website) smoothed in Cinema 4D.
