*Mega Thread* Unreal Engine Procedural Hexagonal Terrain Generation on a Sphere

Hey fellow game developers,

I wanted to share my journey in creating a tile-based hexagonal terrain around a sphere in Unreal Engine using procedural mesh. My goal is to develop a detailed, strategically rich 4x game environment, complete with cliffs, height variations, biome blending, and other features.

What I’ve Accomplished So Far:

I started by generating an icosahedron using procedural mesh sections. To achieve flexibility in the number of hexagons, I linearly divided the icosahedron. Each hexagon was then represented as its own class/actor, allowing for individual hexagon data and material assignment. This approach not only gave me granular control over each hexagon but also allowed for further subdivision of hexagons individually, facilitating the implementation of Level of Detail (LOD) strategies.

Here are some pictures of my development endeavors:


Fig 1: Zelda planet

UnrealEditor_WaVV4eAmEf
Fig 2: Assigning different materials


Fig 3: The current planet


Fig 4: using a singular mesh. (Note: A height artifact of the code is still visible)


Fig 5: Icosahedron

However, a major setback emerged as the individual hexagon approach significantly increased draw calls, causing a considerable slowdown. To address this, I plan to re-merge hexagons into larger meshes, potentially upgrading them to static meshes. My concern is maintaining the ability to assign separate materials and facilitate texture blending.

Considered Redesign:

In considering a redesign, I explore creating hexagon tile variations as distinct meshes, positioning them on the sphere based on corresponding locations. Adjusting vertex positions to navigate the irregular grid formed by mapping hexagons to a sphere presents a challenge. Although promising, implementation details are still in progress.

Triangle Meshes:

Realizing that hexagons are essentially a triangular grid in disguise, I’m contemplating using triangle meshes instead. This choice reduces the number of variations required.

Further Complications:

While merging static meshes may pose challenges in retaining separate materials, it will certainly improve performance. Nevertheless, I am uncertain how to assign distinct materials to merged meshes and fear it may default to a singular material, limiting the desired visual diversity.

In summary, I’m seeking advice, suggestions, and shared experiences from fellow developers working on similar projects. How have you tackled the balance between detailed terrain and performance optimization? Any insights into mesh merging while retaining material flexibility would be greatly appreciated.

Let’s collaborate and elevate our procedural hexagonal terrain endeavors!

1 Like