Parts

Requisites

Image editing tools, such as:

Map editing tools, such as:

On the 30th of September, 2020 the Ozonex editors renders water differently than in the game. Thus it is not representative to what you would see while playing. On the contrary, the GPG editor utilizes the exact same procedures as the game does and is therefore representative. If the Ozonex editor correctly represents the water when you read this then do notify me and I'll remove this paragraph 🙂 .

For this article I assume that you have extracted all the textures the game has to offer. If you have not done so and / or do not know how to extract all the texture, I advise you to check the FAQ in the overview article. There is entry explicitly on how to do this properly to allow the GPG editor to generate the correct relative paths to the textures.

Definitions

Environment map
An environment map is a look-up table for the environment commonly used for reflections. It tries to answer the question: 'If I look into the mirror, what is it that I see?'. They are typically generated beforehand and are therefore static. Completely generating these from scratch for every frame is extremely expensive and would stall any game to a hold. Only recently, with ray tracing and de-noising technologies, are we able to partially compute these reflections in real time.

Environment maps are also commonly named cube maps or sky boxes. The former because each part of an environment map represents a side of a cube. That cube is always rendered last - behind everything else. The latter is because typically it is a sky that is being represented.

This is quite the information and I encourage you to look at the following article:

Environment maps

It is important to understand the goal of this article. Personally I like to work backwards: we start looking at the end result along with the context and then try to understand how this is accomplished.

cubemaps_skybox.png
An environment map from the OpenGL tutorial series on learnopengl.com

Water in Supreme Commander uses environment maps extensively to allow the reflections of the water to match the environment. Unit reflections are also taken into account - these are generated dynamically. Both of these effects can be especially seen when you flatten the water.

flat.png
A piece of water that has been flattened - clearly showing the environment map used for reflections

In the tool window we can see that the default environment map is:

/textures/engine/waterCubemap.dds

When we load it in we can argue that it is cloudy on almost every single custom map out there. The various sides of the environment map are available in the various different layers.

gimp.png
The default environment map opened in Gimp

Environment maps available by default

The game provides a bunch of environment maps by default. These are used throughout the default skirmish and campaign maps. Assuming that you have extracted the textures properly previously, you can find them at:

%InstallationFolder%/textures/environment/

Inside you'll find a bunch of environment maps:

  • EnvCube_Desert01a.dds
  • EnvCube_Desert02a.dds
  • EnvCube_Desert03a.dds
  • EnvCube_Evergreen01a.dds
  • EnvCube_Evergreen03a.dds
  • EnvCube_Evergreen05a.dds
  • EnvCube_Geothermal02a.dds
  • EnvCube_Lava01a.dds
  • EnvCube_RedRocks05a.dds
  • EnvCube_RedRocks06.dds
  • EnvCube_RedRocks08a.dds
  • EnvCube_RedRocks09a.dds
  • EnvCube_RedRocks10.dds
  • EnvCube_Tropical01a.dds
  • EnvCube_TropicalOp06a.dds
  • EnvCube_Tundra02a.dds
  • EnvCube_Tundra03a.dds
  • EnvCube_Tundra04a.dds
  • DefaultSkyCube.dds
  • DefaultEnvCube_TEST.dds
  • DefaultEnvCube.dds

There is no easy way to view these through the Windows Explorer. I'll show a few of them as an example.

EnvCube_Desert01a.png
EnvCube_Desert01a,dds

EnvCube_RedRocks08a.png
EnvCube_RedRocks08a.dds

EnvCube_Tundra03a.png
EnvCube_Tundra03a.dds

The images appear to be of low quality but remember - water doesn't reflect them equally because of the noisy surface. In practice it is more of a look-up map for coloring the water than accurately reflecting the environment.

Changing the environment map

Using the Ozonex editor

On the 30th of September, 2020 the Ozonex editors renders water differently than in the game. Thus it is not representative to what you would see while playing. On the contrary, the GPG editor utilizes the exact same procedures as the game does and is therefore representative. If the Ozonex editor correctly represents the water when you read this then do notify me and I'll remove this paragraph 🙂 .

Using the GPG editor

Select the Water layer (F9) and then click on 'Water Properties' in the toolbar of the editor. The tool window will respond and change into a 'Water Properties' window. For this article we're interested in the 'Texure Maps' and particularly in the 'Environment' texture.

settings.png
Showing the properties in which we're interested in for this article

Assuming that you have extracted the textures correctly previously, click on the '(...)' button next to the environment texture and navigate towards:

%InstallationFolder%/textures/environment/

Choose any of the environment maps that are available and start experimenting with them.

result.png
A visual comparison of the changes to the surface of the water. Especially visible when the water is flattened

Custom environment maps

You can store environment maps inside your map folder. For stratum textures, decal textures and props there is a specific location where these should be stored. For water there is no hierarchy that you need to use in order for the game to find the files. It is good practice to store them inside the 'env' folder that the other textures require in order to function.

As an example, you can store them in:
%MapName%/env/

If you know more on how to format the environment maps such that Supreme Commander can interpret it properly, feel free to contact me and I'll update this article.

When you upload the map to the vault the name of the folder of your map can be changed when it doesn't represent the map version correctly. The path to your custom water textures is not adjusted accordingly, in turn the game cannot find the corresponding textures.

To approach this you can use the Ozonex editor to bump your map version to create a new folder with the correct version. Then you can use the GPG editor to set the corresponding paths to the new folder. When uploading to the vault the name of the folder of the map matches its map version and therefore no longer needs adjusting. The path remains correct and everyone can load in the custom water textures.

Frequently asked Questions (FAQ)

The environment reflections are gone

error.png
Water with and without environment reflections

The editor or the game cannot find your environment map and therefore uses the default texture to make sure at least some texture can be loaded and shown. The default texture doesn't have the correct layout and therefore there are generally no reflections.

One cause is that the textures that you unpacked are at the wrong location. Make sure that the paths are:
Good: /textures/environment/EnvCube_Desert02a.dds
Bad: /gamedata/textures/environment/EnvCube_Desert02a.dds

Another cause when you use custom textures is that the map version got bumped but you didn't update the path accordingly. As an example, when uploading to the vault the folder name is adjusted if it doesn't match the map version accordingly.

Sources

For more information on environment maps:

For more information on how one frame in Supreme Commander is rendered:

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!