Hex Based Terrain Tiles

Hey all. Some of you are probably familiar with Zeustiak and his impressive work making a hex based world map generator. If not, enjoy the read:

Map Generator 3.0 - Please Critique! - Blueprint - Unreal Engine Forums!

I just happened to be wanting to kick the rust off my content creation skills at the time I came across that thread so I reached out to Zeustiak asking if he needed any help creating assets. As it turned out, he did. Since Z is doing all of his work in blueprint, procedurally generating the terrain seems a bit outside the realm of feasibility, so he’s been placing static meshes for each hex tile. I offered to make new, high quality tiles for him. So I’ve spent the last few weeks working out ways to create decent looking terrain tiles for a hex based map, as one might find in Civilization V for example. Follow me on my journey.

First off, here’s an obligatory image to catch your eye:

This is not using Z’s system, this is just me placing things in a level by hand to see how they look.

I’m going to use this thread to go through the process of how I make one of these tiles, both for posterity and to see if I’m insane for doing it this way.

First, a caveat. Most of the tools I use are dictated by the fact I am working on a Mac. This does limit the availability of some of the more popular tools so I’ve had to find other ways of doing a few things. I know I can install Windows or run a VM but part of my desire to do this is to see just how viable the Mac is as a games production platform. Until very recently, unless you were making a 2D iphone game, the Mac really couldn’t be taken seriously. I am happy that this is changing. But, I don’t mean this thread to be, or become, a platform discussion. I just want the facts to be known to avoid spending time on unnecessary questions. Now, on to the process.

Since I needed to make terrain, I turned to my longtime favorite terrain making program, Terragen. Using a combination of heightfield and displacement shaders, all masked through a hexagon mask image, I was able to extract good quality EXR height maps that I could then use to create the actual geometry.

Here’s the shader network I am using:

TerragenGraph.png

By right clicking on the Save Me node, I can save out the height field as a 32-bit EXR. Here’s an example (converted to an 8-bit PNG):

Figuring out what to do once I had this EXR took a little more doing… I tried a few different things, like using Terragen’s own micro-exporter to try and get a FBX mesh directly out of Terragen. Alas, it became very quickly obvious that Terragen’s output is not intended for use in a realtime environment. Even with details turned WAY down, the output contains hundreds of thousands of triangles and there are myriad issues with the mesh, including random holes in the mesh, lamina faces, non-manifold geometry, etc. Not something easily dealt with. So, I decided to try and use the EXR as a displacement map within Maya. This got me where I needed to be. By using Maya’s Modify->Convert->Displacement To Polygons function, I was able to take a flat hexagonal mesh:

and get a very mountain-y looking mesh:

Now, this looks good, but at 3.24 M polygons, it’s a bit too hefty for the purpose it is intended for. So, by tweaking down the values in the Displacement Map section of the attribute editor, going from:

highResDispSettings.png

to

lowResDispSettings.png

I was able to reduce the output mesh down to 2304 tris without it looking too horrible:

I’m reaching the limit of a post now so I’ll break here and pickup on the process in the next post.

Normally…

Now, as most of you know, since I have a nice high detail mesh, and an efficient low res mesh, I have the means for making a normal map. This will allow me to preserve much of the detail of the high res mesh and display it on the low res one. Now, being on a mac means I don’t have XNormal, which is by far and away the most popular way to make normal maps. Luckily, I have access to a different app that does a good job making normal maps as well as a few other handy features, the app Substance Designer. If you haven’t heard of SD, I’d recommend taking the time for a brief overview:

It’s basically one of the coolest things on earth when it comes to making textures and materials. And, more importantly for this current post, they have many texture “bakers” which take info from a mesh and create 2D image map data out of it. Be it the normal data of the high res mesh, the ambient occlusion lighting data from that same mesh, or a simplified height map from the low res mesh, it just takes a few clicks and you have it all, in whatever format and resolution you might need. Very very handy. Using SD made it simple to create the normal map I needed:

I also spent a bit too much time playing around with making a nice blending material with snow at the peaks and grass at the base, and such. Only to realize that it would be very very time consuming to have to make a substance for each combination of mesh and biome type that Zeustiak was asking for. So, I decided to do all the blending work inside UE itself in order to make more efficient use of time and re-use of resources. Still, I needed a blending map. To create a decent blending map for the materials in UE, I took the original EXR height map and adjusted its exposure and levels to get this:

Getting all this into the engine and properly set up took way less time then I would have expected, and is one of the ways in which UE really shines in my opinion. Once I had this workflow all smoothed out, I am now able to go from tweaking shaders in Terragen to find a mountain I like to having it in the engine in less then an hour. That’s pretty darn good IMOHO. It’s that speed of implementation that is key for modern production.

So, that’s how I made the terrain tiles for Zeustiak’s map generator. Any questions, thoughts, feedback, please fire away. And thanks for taking the time to read. Cheers,

J^2

Whew!

I finally got all the material instances created for all the tile variations. It was a bit of work, but worth it:

Now I just need to wait for Z to incorporate them all into his system so I can see how they look on a proper map.

Cheers,

J^2

They look quite excellent! :slight_smile:


Can’t wait to see how awesome they look when everything is polished, lighting is set to match the scene, and all the various mesh versions are spawned and randomly rotated for variety. :slight_smile:

This is good stuff :slight_smile:

Hey man, I know this is an old thread, but I’ve been working on a hex map project (coincidentally have been using Zeustiak’s map gen 2 as reference) and have come to the point where I want to upgrade my place holder tiles (simply different colours) to something more appealing. I was searching the web for a tile thread and came across this thread.

I was wondering if it would be possible to get a set of these tiles for use in my project?

If you, or anyone else, actually wants the assets, just let me know. I still have the Maya project lying around somewhere…

Cheers!

I too am working on a turn based hex game and in dire need of tiles like this. If you would like to share please pm me… thank J.J.

OK. I have the UE4 project recovered, updated to 4.26.2, all non-tile relevant code/BPs removed, and did some work getting the “Tile Builder” BP I had planned on finishing actually functional. I’m working on getting the assets project cleaned up as well (I’m gonna leave the various tests and experiments I did in place in case anyone finds them useful. Once everything is all ready, I will make a video explaining the state of the set, as well as how to use the Tile Builder. Should be online by tomorrow. Ish.

Well, that took less time then expected. Here are the mentioned downloads:

UE4.26.2 Project:

Source Files:

Quick and very poorly done video explanation of the set.

I’m happy to answer any questions and would appreciate any feedback.

Cheers!

J^2

1 Like