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):
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:
- 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.
- 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.
- 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:
The far view shows it best: the diagonal stripes of repeated texture across Oklahoma are gone.
One more close-up of Iowa:
And the steppe around Poltava, after:
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.


