Dissertation
About the project
Engine: Unreal Engine
Language: C++
​
Fascinated by both procedural generation and space, I wanted to combine these 2 subjects for my dissertation. I chose to create procedurally generated planets in a solar system using fractal Perlin noise.
​
The project was definitely a challenge, but taught me a lot about Unreal Engine, C++ and games development.


Generating the sphere
To generate the planets, I started by hard coding the icosphere's vertices and triangles, then iterating over the lists and subdividing each triangle into 4 new triangles and normalizing the new vertex.
​
To optimise the code to generate the icosphere, each subdivision was run on my machine and the final list of verts and tris were stored to text files, then a bool controlled whether the code would read the values from the text file or run the generation code. This meant the generation code only needed to be run once.
​
The code snippet below shows the code used to load the data from the text files.


Sphere to planet
To turn the sphere's into a planet I iterated over each vertex, then I found a new point for the vertex using Unreal Engine's 3D Perlin noise function, to add detail into the planets surface, a number of octaves was specified, and the Perlin noise function was used multiple times with decreasing amplitude.
​
The Evaluate function below shows how the point on the planet was generated.

The Evaluate function is used to get the elevation of each vertex, the vertex is then multiplied by the planet radius and the evaluate return value.




Water level
To add a water level to planet, a sphere is spawned in by the planet and the actor reference is stored. The water sphere's position and rotation are set in the Tick function to match the planet's transform values.
