Making mountains over a hex Tile Map
In what will hopefully be a recurring series on the things I worked on the past few years, I thought I’d spend some time explaining how I made the mountains in Fireborne, and took the most advantage of Jonah’s fantastic texture maps.
To start things off, I need to explain a little bit how the tile system works, and specifically how it blends texture maps.
The terrain (the planet) was rendered using hexagons, joined by skirts, so that the hexagons could be moved up and down, and oriented. The surface of each hexagon remains flat. By the time I added the displacement mapping, having flat hexagons wasn’t as relevant as in the beginning, but it did make some of the calculations easier. In any case, each hexagon displays only one texture set (set meaning color/bump/normal maps), skirts quads blend two texture sets together, and skirt tris can blend 3 sets.
Anyway, making mountains goes like this:
Get some really good art
This is kind of obvious, but really, you can’t get decent results without good source art. In this case, Jonah actually sculpted a number of base partial mountain shapes in Zbrush (and of course textured them as well). Those gave me all the maps I needed for the generation. One thing to note is that the textures do not need to tile. That’s right, because of the skirt blending, there was no need for repeating textures.
Generate base shape
First, you need to make the basic shape of your mountain, figuring out the heights of your tiles, and then orienting them roughly along the slope. Then you need to number the tiles as they go up the slope. Valley tiles get the number 0, and the numbers go up as you get closer to the peaks.
The second step is to assign textures to the tiles according to the number. So valley tiles get more grassy textures, foothills get a mix of rock and grass, and peaks get white tops.
Using the normal of the tiles, find the orientation of the texture that best fits the mountain. In this case, Jonah’s textures have a definite up/down orientation, so we want to make sure and line them up.
Blend the textures
Thanks to the skirts, the next step is to blend the tiles together, smoothing out the textures.
Add Normal Map
The next two steps are actually inherent part of the tile rendering system I wrote, but you can see how much they individually add to the final look. First we blend the normal maps. That is in fact a non-trivial operation, because you have to properly account for the orientation of each tile (that you just arbitrarily rotated).
Add Displacement Map
Finally take advantage of tessellation and displacement maps. Of course, this is again all possible because the source textures have all that information (color,bump,normal).
Now, this doesn’t generate perfect mountains every time either. If for instance, the shape you generated to begin with has a few too many peaks right next to one another you can get bad results.