top of page

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.

Diss_PlanetsRotationAndOrbit.gif
Dissertation: Bio
Diss_SolarSystemColor.gif
Dissertation: Image

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.

Dissertation: Text
Diss_LoadingCode.png
Dissertation: Image
Diss_Icosphere.png
Dissertation: Image

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.

Dissertation: Text
Diss_RandomiseVertices.png
Dissertation: Image

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.

Dissertation: Text
Diss_CalulatePointOnPlanet.png
Dissertation: Image
Diss_Icoplanet.png
Dissertation: Image
Dissertation: Image

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.

Dissertation: Text
Diss_PlanetWithWater.png
Dissertation: Image

Source code

To view all of the code, click the button below to go a GitHub repository with all of the .cpp and .h files.

Dissertation: Text
  • LinkedIn
  • Twitter

©2021 by Matt Davies. Proudly created with Wix.com

bottom of page