Island Terrain Generation Part 2

This is a follow-up to a previous post on Island Terrain Generation.

I actually had to re-write a lot of the algorithm from scratch, which I'll explain in a bit, but here it is:



Instead of triangulating an outline poly, I decided to generate a regular flat triangle mesh, rotate randomly chosen edges, then relax the mesh.  This made the island fully procedural, rather than the semi-procedural generation I wanted.  However, it was necessary to make progress.

Once I'd generated the distorted triangle mesh, I could randomly select a point on the mesh to be the peak of the island, and generate ridges/troughs growing out from that peak.  The ridges can split into multiple after a few steps, but they have to stop before they hit the edge of the mesh.

Once the ridges are grown, any untouched points can have elevations assigned according to how high their neighbouring points are.

I also force all the edge points to have elevation zero.

Then, I assign a colour to each triangle.  If it's got three points at zero elevation, it is sea.  If there are 1 or two points at zero elevation, then I check the normal vector: steep triangles are cliffs, shallow triangles are beach.  Everything else is green.

For the most part, I really like the look of the islands, and I could use the algorithm as-is to produce random islands around a low-poly environment.  Could be useful for some kind of flight game (like the helicopter game I keep promising myself I'll make).

I don't think this algorithm will scale too well though.  This is where I'll need to work on making a triangle mesh from authored inputs (like peak locations, coastline, etc.).  That should allow me to make different LoDs so nearby sections of islands can be a lot more detailed while more distant sections are quick and easy.

That, however, is work for another day.



Comments

Popular posts from this blog

Micro:Bit and SPI display

DCS World with TrackIR under Ubuntu

Cardboard Mock-up of USB Joystick