0
\$\begingroup\$

Background

I'm making several individual terrain tiles inside of blender for use within a Unity 3D 5 game. Each tile is square and is made to represent a segment of a world. In game the tiles are randomly* chosen and placed between each other. However these tiles do not always have matching sides.

Why the tiles

To allow for greater terrain sculpting possibilities such as caves, precision-placed landmarks e.t.c. but still allow for a procedurally generated feeling; randomly placed static tiles are used.

There are mountain tiles and there are plane tiles. Mountain tiles have a more extreme terrain and are mostly next to other mountain tiles so that bigger mountains can be formed. Plane tiles are similarity placed next to other plane tiles.

The game is "low poly" and so is the terrain. This makes it hard to have flat sides on every tile at the same height for easy "stitching".

Concrete question

How can I match these edges runtime to ensure that there are no visible tile edges?

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

You might consider something like Wang Tiles. The idea is that you have a predetermined set of edges for your tiles. You can randomly generate tiles, still, so long as the edges match.

For example, you might have 4 possible sides:

  • A: Low terrain
  • B: Mid terrain
  • C: High terrain
  • D: Water

You can generate the first tile by randomly choosing the 4 sides. The tile to the right has to have the same edge on the left as the first tile, but the other 3 sides can be randomly chosen. On the next row, you have to match 2 sides, but the other 2 can be randomly chosen, etc.

You can use more than 4 types of edges. That's just an example.

\$\endgroup\$
1
\$\begingroup\$

You can do some cool things if you allow the tiles to overlap a little and then interpolate bits that overlap. For the parts that overlap you need to calculate each tile's contribution (weight) to the overall height which I'll refer to as H(x,y). Then when you sample H(x,y) you find each tile that overlaps that point and sum the weighted local heights of those tiles. I've made a quick diagram that I hope explains this in more detail, each of the colored H(x,y)'s represents the heightmap of a specific tile, with x and y still being in absolute world coordinates.

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .