Creating a Cubemap Manually

Overview

Obsolete

Please note that this process is depreciated and contained here only for reference. For information on using the Material Editor to create a cubemap, please see Generating Environment Cubemaps and Environment Probes.

After completing the following tutorial, you will be able to create and set up a cubemap manually, as well as understand the tools needed to achieve the best results.

File Size

One important thing to consider first is the required size of the cubemaps that you will use. In some cases you don't need to have high-res cube maps. It can be inefficient for things like small mud decals. But, in some cases a high-res cube map is required such as glass reflections.

The goal should be to keep your cube map as small as possible, but sufficient enough to serve its purpose. This is particularly important when there are more than one cubemap within a scene, and when working with the autocube function.

For a crisp and sharp cubemap, which will be reflected on bigger objects, a size of 512x512 for every face should be enough. The downside of this is a high memory consumption of 1MB for the compressed DDS.

As this is probably too big, a smaller size of 256x256 is a better choice (a quarter of the area as before, so 250kb). The downside of this is that the reflection gets more blurry. This shouldn't be a problem in most cases (like water reflections on decals).

Color or Grayscale

The colors of a cube map are shown as its "reflection", which means sometimes they don't match the current light situation, for example in rooms with colored light sources. In these cases, you should use grayscale cube maps.

Creating a Cubemap

There are 2 ways to create a cubemap:

1. Take pictures of a reflecting globe and compute them into a environment map/cross. To do this you need a good camera, tripod, and hdrshop (http://www.hdrshop.com/).

2. Painting a cubemap by hand. For accurate high-res cube maps use skypaint. Tools you may need to use include:

  • Photoshop or any painting program
  • HDRshop if you want to compute your cube map out of photos
  • ATI CubeMapGenerator (downloadable at www.ati.com)

The ATI CubeMapGenerator can load all different sorts of existing cubemaps, cubecrosses from hdrshop, and single faces.

Cubecrosses usually look like this:

Setting Up a Cubemap

Cubemaps for the CryENGINE need to be stored according to the following design:

In comparison with the cubecross (as seen above) you have to change the following faces:

  • Left – turn 90° Clockwise
  • Right --turn 90° CounterClockwise
  • All the other faces stay as they are.

As for the creation of the cube map itself - it's your decision as to how it should look. You have to produce the needed faces for the cube and sort them as the picture above shows. If you paint it with Photoshop, you should work with several layers with each face on a separate layer so that you can rotate/mirror them to see if the corners match properly.

As soon as you have loaded the cubefile/faces/cubecross, you can see the result in the middle of your screen as it gets projected on the globe.

Viewing the Cubemap

Changing the FOV zooms the globe in or out, while activating the skybox checkbox makes it possible to view the cubemap from the inside of the cube.

If one face has a wrong direction, you can select the face at the ATIcubemapGenerator and flip it.

Note: It only flips the faces of your 2D cubemap and not any polygons.

As soon as the faces are in the correct position and orientation, you can filter the edges. If you do not do this, the file cannot be exported. Select a filtering method that suits your cube map and click the filter cube map button.

After the filtering is complete, you can export the file. You have the choice of saving it in multiple images (for easier editing), as a .dds compressed cubemap, or as a cubecross. As an example, the Crysis game used .dds compressed cube maps.

Setting Up the Cubemap Material

After creating a new object, open the Sandbox Material Editor, assign a material, and pick a usable shader (such as illummetal). Be sure that the general settings provide some specularity for the object. Without the ability to reflect, the object will not display the reflection map.

After you have assigned a material, you first have to choose the cubemap you want to use.

Select the environment slot (which is located under the "texture maps" category) and pick the cube map file that you want to use. Now go to the shader generation parameters and turn on the environment map.

Once the cube map is loaded and turned on, you're free to change the shader parameters to get a proper reflection.

You have the following sliders:

  • Specular multiplier: Changes the light intensity of the reflection.
  • Specular sharpness: Value to control the reflection behavior of the light (smaller for a more soft reflection, higher value for a crisp, sharp spot reflection).
  • Reflect amount: Controls the strength of the reflection.
  • Fresnel bias: You will get a color changing effect depending on the direction of the reflecting polygon. In other words, the edges which have a nearly 90° direction or you will get a different predefined color. It is also possible to generate the impression of existing backlight reflections on glass-like objects. Set the value to zero to switch this off.
  • Fresnel size: Size of the effect mentioned above.

Here is a teapot with an environment map.