6.2.4 Filtering cubemaps

One of the advantages of implementing reflections using local cubemaps is the fact that the cubemap is static. That is, it is generated during development rather than at run-time. This provides an opportunity to apply any filtering to the cubemap images to achieve an effect.

CubeMapGen is a tool by AMD that applies filtering to cubemaps. You can obtain CubeMapGen from the AMD developer web site at: http://developer.amd.com.
To export cubemap images from Unity to CubeMapGen you must save each cubemap image separately. For the source code of a tool that saves the images, see 6.2.6 Source code for editor script to generate cubemaps. This tool can create a cubemap and can optionally save each cubemap image separately.
You must place the script for this tool in a folder called Editor in the Asset directory.
To use the cubemap editor tool:
  1. Create the cubemap.
  2. Launch the Bake CubeMap Tool from GameObject menu.
  3. Provide the cubemap and the camera render position.
  4. Optionally save individual images if you plan to apply filtering to the cubemap.
The following figure shows the Bake CubeMap tool interface:
Figure 6-17 Bake CubeMap tool interface

You can load each of the images for the cubemap separately with CubeMapGen.
Select what face to load from the Select Cube Face drop down menu and then press Load Cubemap Face button. When all faces have been loaded it is possible to rotate the cubemap and check that it is correct.
CubeMapGen has a number of different filtering options in the Filter Type drop down menu. Select the filter settings you require and press Filter Cubemap to apply the filter. The filtering can take up to several minutes depending on the size of the cubemap. There is no undo option so save the cubemap as a single image before applying any filtering. If the result of the filtering is not what you expect you can reload the cubemap and try adjusting the parameters.
Use the following procedure for importing cubemap images into CubeMapGen:
  1. Check the box to save individual images when baking the cubemap.
  2. Launch the CubeMapGen tool and load cubemap images following the relations shown in the following table.
  3. Save the cubemap as a single dds or cube cross image. Undo is not available so this enables you to reload the cubemap if you are experimenting with filters.
  4. Apply filters to cubemap as required until the results are satisfactory.
  5. Save the cubemap as individual images.
The following table shows the equivalence of cubemap face index between CubeMapGen and Unity.

Table 6-4 Equivalence of cubemap face index between CubeMapGen and Unity

AMD CubeMapGen Unity
X+ -X
X- +X
Y+ +Y
Y- -Y
Z+ +Z
Z- -Z
The following figure shows CubeMapGen after loading the six cubemap images:
Figure 6-18 CubeMapGen

The following figure shows the result of CubeMapGen applying a Gaussian filtering to achieve a frosty effect:
Figure 6-19 CubeMapGen showing frosty effect

The following table shows the filter parameters used with the Gaussian filter to achieve the frosty effect.

Table 6-5 Parameters used in CubeMapGen to produce a frosty effect in the reflections.

Filter settings Value
Type Gaussian
Base Filter Angle 8
Mip Initial Filter Angle 5
Mip Filter Angle Scale 2.0
Edge Fixup Checked
Edge Fixup Width 4
The following figure shows a reflection generated with a cubemap with a frosty effect:
Figure 6-20 Reflection with frosty effect

The following figure summarizes the work flow to apply filtering to Unity cubemaps with the CubeMapGen tool.
Figure 6-21 Cubemap filtering workflow

Non-ConfidentialPDF file icon PDF versionARM 100140_0201_00_en
Copyright © 2014, 2015 ARM. All rights reserved.