PCG Terrain
Unity, C#Repo Link
This was my final year project for my bachelor’s degree. The goal for this project was to produce an artefact that would procedurally generate terrain with moderate efficiency that could also generate terrain features, in a similar way to Minecraft.
The project made use of noise functions such as Perlin and simplex, to generate a height map for the terrain. This was then used to fill a voxel map to the heights dictated by the height map. A mesh was then generated based on the voxel map to create a visible object in the world. Additionally, the voxel at each point in the voxel map would be changed depending on the height, for example the top voxel would generally be a grass voxel while a few layers below that would be dirt and the rest would be stone.
Additionally, biomes were added to change how different parts of the world would spawn. Cellular noise would be used to determine the general biome for each chunk which would then determine the voxels within the chunk and the features that could spawn as well as their frequency, for example, forests would have frequent trees whereas a desert would have a lot of cacti. Furthermore, the biome would determine the maximum height for voxels on the heightmap as well as the easing type that is used to interpolate the heights from the height map.
A variety of features could also be placed on the terrain such as, caves and trees. Caves would be generated by creating a path based on a variety of path generating algorithms with the primary algorithm being Perlin worms. Additionally, forests would be generated by using Poisson disc sampling to select spawn points and placing trees there, with trees being generated by placing a vertical line of wood voxels and adding a hemisphere of leaf voxels at the top portion of the tree.
Overall, this project helped to develop my knowledge of procedural generation techniques which further developed my interest in procedural generation leading into my Masters degree that had a heavy focus on procedural generation.