Final-Year Dissertation

Mathematical Realism in Procedurally-Generated Terrain

Summary

Procedural Content Generation (PCG) is widely used not just within the games industry, but in software development as a whole. Specifically in games, it is most often used to generate worlds (such as in Minecraft and Terraria), levels (such as in The Binding of Isaac), and textures, to name a few examples. I was particularly interested in its uses for generating 3D terrain meshes, and whether the more common methods for terrain generation produce content realistic enough for other purposes aside from videogame worlds, such as real-world simulations. I produced a terrain generator in Unreal Engine 5 using noise maps, extracted heightmap data, and analysed it using various geomorphological heuristics in order to determine the level of non-visual realism produced.

BACKGROUND

This project was developed as part of my dissertation during my final year of university. Aside from the programming aspect of this project, it also involved rigorous research into geography, geomorphology, and even philosophy and neuroscience, as well as the use of various tools that I wasn’t familiar with before undertaking this project.

The first problem I encountered was the definition of ‘realism’ itself. The way we experience everything around us is through our five senses. This experience, thankfully, abstracts only to sight in the case of computer-generated terrain, as it is the only way that we can meaningfully interact with such media. In the case of 3D terrain, it is key that we understand the difference between visual and mathematical realism. Although something may look ‘realistic’ to us, e.g. the world in The Legend of Zelda: Breath of the Wild, it does not necessarily mean that it fits the criteria for use in real-world simulations.

I decided to develop my world generator using noise maps, such as Perlin/Simplex Noise or Fractal Brownian Motion (FBM), as these are the more commonly used PCG algorithms when it comes to terrain synthesis.

The Results

Developing the terrain generator itself was not the hardest aspect of writing this dissertation. Although when I started work on this topic I knew relatively little about how algorithmic noise worked, and how it is used to generate terrain, grasping the concepts behind the Perlin and Simplex Noise algorithms was fairly straightforward, due to me already being familiar with the concept of interference.

The main issue I had to tackle during the development of the program itself was optimisation. Terrains took far too long to generate, and rendering anything larger than a 200×200 terrain at reasonable framerates was near impossible for my home computer at the time. To put this in perspective, I wanted to generate terrains of size 1000×1000 and run calculations on the result. The low framerates were handled by generating two additional LoDs for each chunk, one with 50% of the original mesh’s vertices and one with 25%, resulting in much smoother fly-over performance. The issue with slow terrain generation was a result of poor optimisation in the early stages of development, as I was trying to create a working prototype as quickly as possible. Multiple instances of for-each loops iterating over every single vertex one after another when they could all be combined into one single for-each loop were identified and quickly optimised. This reduced generation times for 1000×1000 terrains from roughly 25-30 seconds down to less than 5 seconds.

The actual write-up for this project involved a lot of research in the field of geomorphology, since after all the objective of this dissertation was to assess the mathematical realism of procedurally generated terrain. Heuristics such as fractal dimensionality, slope-area relationships, curvature analyses, among several other statistical properties of terrains were applied. In order to actually run said calculations on these terrains, they were simply exported as text files containing the (x, y) coordinates of each vertex, as well as its elevation. These ‘point-clouds’ were then either used directly by programs I wrote, or, in the case of curvature analysis, imported into QGIS for further statistical analysis. The conclusion of this dissertation, perhaps not unexpectedly, was that these algorithms can generate certain terrain features in a realistic manner, but overall they might not be able to be used for simulating real-world scenarios.

Wireframe view of a single chunk of terrain, produced by my program

Terrain of size 1000×1000 (100 separate chunks), generated in under 5 seconds

Levels of Detail (LoDs) implemented to improve fly-over performance

Get in touch with me for a full demo