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:
- Create the cubemap.
- Launch the Bake CubeMap Tool from GameObject menu.
- Provide the cubemap and the camera render position.
- Optionally save individual images if you plan to apply filtering to
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
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
- Check the box to save individual images when baking the
- Launch the CubeMapGen tool and load cubemap images following the relations
shown in the following table.
- 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
- Apply filters to cubemap as required until the results are
- 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
The following figure shows CubeMapGen after loading the six cubemap images:
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
|Base Filter Angle
|Mip Initial Filter Angle
|Mip Filter Angle Scale
|Edge Fixup Width
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