Portfolio logo

S

Procedural world generator

About

A procedural world generator made with Unity.

Generates infinite terrain using multiple perlin noise maps, each biome has a set of low-poly vegetation & rock props that get spawned.

As the player you can walk around in first-person, and switch to a flying cam to quickly get around, some of the generation settings are also adjustable in the preview screen!

This took about 2 months to build, the source code is available on Github and you can download the project on itch.io.

World generation

The data consists of 3 noise maps, a biome map, a list of props, and a water layer.

The noise maps are generated with perlin noise and are used to create height, humidity, and temperature maps.

These 3 maps are used to create a biome map, that looks at e.g. height for ocean or mountain biomes, and humidity for forest or grasslands.

I've previously generated terrain with just a heightmap, but then the biomes have a very clear pattern, adding in temperature and noise maps creates much more interesting results!

To get the 3D terrain, the height map is used to set the height of each point on a 2D mesh chunk, this gives us the shape of the terrain.

Then, a texture is generated for each chunk that uses the biome map to set a color for each tile, some extra calculations are also done to smooth out the biome transitions.

For props I just used random values, these are then saved to the chunk they're in to prevent it from generating differently each time you visit.

And finally water, this is a transparent 2D mesh where a perlin noise map is moved across it, gradually changing the height of each point, doing it like this is means a lot of calculations for the cpu, but after a bit of optimization it didn't really matter.

Assets used

The trees, rocks, bushes & flowers were not made by me, all are free assets from the Unity asset store, I left links to each asset / pack on the Itch.io page.

First person view of a desert biome with mountains in the distance
First-person view of a lake with a mountain range in the distance
World preview screen with adjustable settings