All dev logs

Eliminating Terrain Texture Tiling with Hex Shaders

Getting rid of the repeating grass pattern on the map's wide plains.

The grass was tiling

The terrain on the world map is rendered with a handful of terrain textures: grass, sand, rock, snow, and so on. Each one is a single square image, seamlessly repeating over and over across the world. Up close, you might just see half of the image, or one or two repetitions, and it works. But on big, flat areas, like the American Midwest or the Ukrainian steppe, your eye starts picking out the patterns, especially the larger patterns.

It's easiest to see from straight above. Here's Iowa, before (top) and after (bottom):

top-down view of Iowa in Atomic Dawn, before and after the anti-tiling change

In the top half you can count the copies. In the bottom half, you can't.

What changed

Three things, all in the terrain shader:

  1. Hex tiling. Instead of laying the texture down as one repeating square, the ground is cut into small hexagons, and each hexagon gets the texture at its own random rotation and offset. Where hexagons meet, they blend together, so there are no visible seams. The texture itself is unchanged. It's just never laid down the same way twice in a row, so there's no pattern for the eye to lock onto.
  2. Large-scale variation. On top of that, the grass now drifts slowly between slightly lusher and slightly drier, and slightly lighter and darker, over long distances.
  3. Satellite color. The game already has a satellite color map of the world, but before it was only used when zoomed far out. Now its local variations (fields, woodlands, dry patches) tint the ground at every zoom level, adding more variation for the eye.

Here's Kansas from a few distances, before on top and after below:

close-up view of the Kansas plains in Atomic Dawn, before and after
mid-zoom view of the Kansas plains in Atomic Dawn, before and after
far view of Kansas and Oklahoma in Atomic Dawn, before and after

The far view shows it best: the diagonal stripes of repeated texture across Oklahoma are gone.

One more close-up of Iowa:

close-up view of Iowa in Atomic Dawn, before and after

And the steppe around Poltava, after:

the steppe around Poltava in Atomic Dawn, after the anti-tiling change

What's next

Hex tiling reads the textures more often than before, so I still need to check that the game holds its frame rate on mid-range hardware. If it turns out too expensive, the first thing to cut is the extra work when zoomed out, where the repetition is least noticeable anyway.