About water: Pixelated water

Parts

Tools

Map editing tools, such as:

What is this all about

Water that is pixelated has been a common discussion between map developers in various Discords, fora and other chat applications. As an example:

Water is always pixelated

This is a bug within the editor: some setting is off and the high fidelity version of the water isn't generated properly in turn. This happens both in the editor and, because it uses the same code to generate the water, in game too.

A clear example is the map 'Open Waters':
example-bug.png

The top left corner has the smooth, correct version of the water. Where as the bottom right corner has the incorrect, pixelated water.

Typically this can be fixed by just saving the map again. There are cases when this doesn't work however. In those cases you have to change some setting of the water, such as notch up the water slightly, just to notch it back down to the value it was before. I assume some state is corrupted, disabling the generation of high fidelity water. By changing the settings all of the state is replaced and then high fidelity water can be generated both in the editor and in game.

Solution in the GPG edtior

You can adjust the height water property in the GPG editor by enabling the water layer, edit the water properties and then change the surface height just to change it back again.

example-correction-gpg.png

Water is pixelated when you zoom out

Considering the engine is from 2007 this is likely intended behavior instead of a bug. Which makes it impossible to address directly, we can only circumvent it. The behavior only applies in game - the old GPG editor and the new Ozonex editor do not have this issue.

Lets start with an example:

example-zoom.png

If you look closely you'll notice that the top part of the island is pixelated where as the bottom part is sharp. If you zoom out further the rest of the island is pixelated too. If you zoom in further all of the islands shores are sharp again.

I suspect this is an optimization from the engine- graphic cards weren't as good in 2007 as they are now. Rendering high fidelity water at such heights is, generally, aesthetically the same as rendering a lower quality version of the water. One can describe it is as a Level of Detail (LOD) for the water.

The change of water is visible because of the surface color of the water in combination with the color lerp. The water at the shore has a constant color applied to it. Because bits and pieces of water dissapear when you zoom out, the color at those pixels jump slightly. This causes the pixelation to be (clearly) visible. As an example:

example-lerp.png

I've increased the contrast of the shores to clearly show that the water is still being changed, but that the change is less visible. the change is aesthetically the same when the water has no surface color at all near the shore.

The color lerp stands for 'Color Linear Interpolation' which takes the depth as an argument of its function. The min (no depth, at the shore) and max (deepest point of the water) are then used to interpolate the surface color which is then added to the color of the water. I'm not going in depth any further because that is beyond the point of this article :).

Solution in the GPG editor

You can adjust the color lerp min water property in the GPG editor by enabling the water layer, edit the water properties and then change the color lerp min property. The lower the properly the less visible the change will be.

Discussion

The problem with regard to the water becoming pixelated when you zoom out has been investigated previously. There are a few console commands that can be run in the console to prevent the problem from happening. As an example:

  • ren_Shoreline: Enables / disables the (fancy) shorelines overall.
  • ren_ShorelineCutoff: The default cut-off range where the fancy shorelines are replaced with less fancy shorelines. This is by default set to 1000. Therefore the problem is less present on smaller maps.
  • ren_RegenShore: Generates the (fancy) shorelines with the latest set value to ren_ShorelineCutoff. This works once, but if you zoom back in and out then it is reset again.

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!

A work of art is never finished, merely abandoned