Unity3D Low-Poly Terrain Goes Modular

All I wanted was a low-poly old-school terrain for my game.

Since I’ve decided to have first-person 3D exploration, I knew I would need some kind of terrain. In the beginning I went for the most straightforward solution: Unity’s built-in terrain, but that soon turned into a fruitless search for a way to make the terrain’s polys render sharp or “unsmoothed”. Turns out you can’t do it natively, so I’ve looked into the asset store. Surely somebody must have stumbled into the native terrain’s limitations. After a couple of minutes I’ve narrowed down the search to a script, which basically transform the terrain into a number of meshes, but I found the results unsatisfactory, as it didn’t give me enough control over the final result.

There had to be another way.

I’ve created a test Unity scene and imported a simple grid-turned-terrain blender model into it. It looked fine; it had the sharp edged faceted look I was searching for, but it was uncomfortable for me to design the terrain and essentially the game world in blender, when Unity was clearly a superior tool for the task.

Next I’ve come to the idea that I would have a huge grass plane representing the ground and start building the world from its center. I would create modular mountains and hills in blender, and place them on top of the plane. This idea really enticed me as I could organically compose the world from wherever I wanted, like lego pieces on a large table. But, it didn’t occur to me that I couldn’t do much with that single large plane. I couldn’t paint roads on it and even if I could, I definitely couldn’t carve rivers into it. That’s how my plan fell into the water…

Until one day, when the thought of lego blocks came back to me.

Tiles in the Unity editor

Like I did for the mountains, I used blender to create equally-sized terrain tiles representing road sections, river sections and other basic terrain elements. I would then import the meshes into unity, create prefabs and easily snap them together with the handy V-key shortcut. Voila, I had a modular terrain, which allowed me the same organic way of composing the world as a large plane would. I did run into an issue though: where the tiles met, I would get visible seams as you moved across the terrain, but I fixed it by attaching a script to each tile, which scales the tile up by a minuscule amount, just enough to overlap the tiles and hide the gap.

The initial blunder into paper prototyping

Building a nice terrain does require a huge amount of pieces though, and an intelligent naming convention helps a lot to distinguish all of the pieces as you go. I’ve spent several days prototyping the tiles on graph paper prior to firing up Blender and I am grateful I did. I keep the paper tiles as a handy reference as I am building the terrain.

What the paper prototype couldn’t do, was define the right scale of the tiles in the world. The first iteration proved the tiles were way too large for the player character and the mountains, so I scaled them down to 75%. I wanted to scale them down even further (to 50%), but the relative size of the roads and rivers got too small.

A this point I will either keep the scale at 75% or create new tiles with larger roads and rivers.

Anyway, to be continued…

Be sure to follow ongoing and more detailed development of the game on Patreon.

Liked it? Take a second to support Damjan on Patreon!

Leave a Reply