Requisites

Image editing tools, such as:

For this article Photoshop is used. The tasks in this article can be done with Gimp too, according to the internet. I personally do not have experience with Gimp and therefore cannot write on an article on it.

About normal maps

Normal maps are used throughout games to create a sense of detail on entities. The geometry of an entity is generally limited - geometry used to be relatively expensive to process. A clear example of this is the (at times: extensive) usage of decals that function as normal maps on various maps.

motivation-2.png
One of the examples in the introduction article on decals that shows a terrain with and without decals that function as normal maps

A more general introduction of normal maps is that of a flat plane that represents a brick wall. The joints between the bricks are too detailed to represent in the geometry and therefore we fake this feeling of detail with normal maps.

example-opengl.png
An example from LearnOpenGL that clearly shows the increase in detail

Today, in the (more) modern age, geometry is no longer a limiting factor given that tessalation exists. On top of that, normal maps are replaced with PBR maps - which is topic that needs an article or 10 on its own.

In Supreme Commander there are two types of normal maps used throughout the game:

purple.png
The typical purple normal map commonly used on units and as a strata normal map

orange.png
A more uncommon format for normal maps, used for decals to add in detail into the terrain

The automatic approach

A bump map is in its essence a single channel map that describes some offset to a surface. It is used in various applications:

  • As a height map in disguise
  • As a bump map for basic shading
  • As a displacement map for a geometry shader

Within Supreme Commander height maps are its core the same as bump maps: they both use only one channel and are therefore interpreted as a gradient between black (value of 0.0) and white (value of 1.0). One (major) difference is that height maps use 16 bits per pixel, where as a bump map generally only uses 8 bits per pixel.

bumpmap.jpg
The bump map that we'll work with

When you have a bump map then the job is a breeze. Open the bump map and save it as a .dds within Photoshop. A window pops up, the following parameters are relevant:

Format

The format of the dds file. The format BC3 RGBA 8bpp | interpolated alpha will result in the format of a purple normal map. The format BC5 RG 8bpp | normal map will result in the format of an orange normal map.

Image type

Allows you to convert a texture into a normal map of either kind, given the format. Either normal map options work - their exact computation differs slightly. For this article describing the difference is too much.

Height source

Determines what value should be used as the height. Generally bump maps will have the same value in all three channels. Generating from a diffuse texture on the other hand can significantly change the results, depending on the option set.

Essentially what this option is asking is how it can convert the given texture to a texture with only one channel - and then use that channel to construct the normal map.

example.png
A slice with a purple normal map on top of a slice with the orange normal map

The orange normal maps used in Supreme Commander are overall quite severe in their bumpiness. The orange normal map used in this article will be barely visible when placed as a decal. You can fix this by increasing the contrast of the bump map before generating a normal map from it.

The manual approach

This task is a bit more involved but can be done through a series of steps. We again assume that we start off with a bump map. Essentially both representations of a normal map have the same data that is stored in different channels. The steps are:

  • Turn the bump map into a purple normal map through the automatic approach
  • Open up the purple normal map
  • Create an alpha channel
  • Copy the red channel into the alpha channel
  • Make all of the blue channel black
  • Store the original bump map in the red channel
  • Save with the format BC3 RGBA 8bpp | interpolated alpha

example-manual-compare.png
A slice with the original bump map ton top of a slice with the orange normal map with the manual approach

The results are quite different and this manual approach is generally preferred over the automatic approach.

Under the hood

DDS Formats

There are numerous DDS formats out there and it is easy to get lost in the jungle. This section tries to shed light on this jungle to guide you through. Credits go out to @Balthazar for sharing his knowledge on this topic.

overview.png
An overview of common uses of various DDS formats. With thanks to Balthazar

Two major factors play a role in choosing the correct format. One is the amount of applicable compression reflected in the file size, the other is resulting quality (loss) over the compression. Choosing the correct format can, for example, significantly increase the load time when loading in maps with custom textures.

DXT 1

There are two formats, one without an alpha channel and one with a 1 bit alpha channel. The former is commonly used for any albedo (diffuse) textures that doesn't require an alpha channel. Seraphim Specular textures are also a good candidate for the former.

DXT 3

There is only one applicable format. Due to the explicit alpha format pixels that are completely transparent are discarded. It is therefore especially useful for textures for the UI, emitters or simple props that have basic transparency.

DXT 5

There are two formats but only the more common one is used: DXT 5 ARGB 8bpp | Interpolated alpha. Due to the interpolated alpha format completely transparent pixels are kept. This is useful for textures that do have an effect even though the alpha channel may be completely black. A common example is water, which utilises the alpha channal as foam rather than transparency.

Other more common usages are Seraphim albedo (diffuse) textures, other specular textures and normals. Generally if you are unsure, this is the most safe option to choose.

The alpha channels

The alpha channel is a common source of optimization. We'll shortly go over the various options to provide a better understanding of what they involve.

No alpha

There is no alpha channel. Commonly this means the texture is completely opaque .

One bit alpha

There is an alpha channel that can determine for each pixel whether that pixel is opaque or transparent - only the two outer extremes are available. This is generally also referred to as a binary mask.

Explicit alpha

The alpha channel is directly utilized to optimize the dds file overall - any pixel that is completely transparent is discarded. This means that if you save a file in the DXT 3 format information will always be lost if there are transparent pixels.

Interpolated alpha

The alpha channel is stored and is not used as an optimization technique, e.g., no information is lost when a pixel is transparent.

Sources

For more information on why the terrain uses a different type of normal map:

For more information on normal maps in general:

For more information about the DDS format:

A well written guide of how normal maps are used in another: Smash 4!

About you

If you have interesting sources, approaches, opinions or ideas that aren't listed yet but may be valuable to the article: feel free to leave a message down below or contact me on Discord. The idea is to create a bunch of resources to share our knowledge surrounding development in Supreme Commander.

If you've used this resource for one of your maps feel free to make a post below: I'd love to know about it!