Procedural Planets

GitHub

Overview

This was a project I worked on for 2 months from April 2023 to May 2023.

For this project, I wanted to build upon my previous procedural planet project using many of the techniques I have learnt since doing that project in December 2021.

Below is the demonstration I submitted alongside this project.

Mesh Creation

In a similar fashion to the previous project, I wanted to use icospheres as the base of my planets they are based on the shape of a regular polyhedron making them nice to work with mathematically and the distribution of vertices on an icosahedron is even compared to a model like the cubic sphere.  However, as this project was about evaluating the impact of different design decisions on the performance of a planet asset, I decided to look at the implementation of multiple different sphere constructions. 

In the project, I explored UV spheres, cubic spheres, icospheres and Fibonacci spheres. The conclusions of my work were that UV spheres were inappropriate for this type of project, Fibonacci spheres required too much computation and both cubic spheres and icospheres were good choices. When choosing between the two, the designer should consider the trade-off between the cube being a nicer mathematical shape to work with than the icosahedron and the vertex distribution of the icosahedron being more even than that of the cube.

Terrain

This version of the project uses Perlin noise to create undulating terrain much like the previous project. However, the implementation of Perlin noise is far simpler this time. Octaves, frequency and lacunarity are not modified in the generation of Perlin noise due to the fact that the noise output would not be normalised to a 0 to 1 range. Normalizing the values when using multiple layers of noise would require finding the highest and lowest noise values on the mesh. This could potentially mean cycling through all 60,000+ vertices an n² number of times for each mesh generation. This did not seem like a wise decision to make. As a consequence of the simplified noise, these planets do not have craggy, jagged mountain peaks or flat lowland plains.  

Texturing

The shader I wrote to texture the surface of the planets in this project built further upon the previous planet shader, still using height-based terrain texturing and triplanar mapping to texture the terrain so that you can have sand in the lowlands with a transition to grass and then rock and then snow as you climb up the mountains. This iteration of the shader, however, did not have the same bugs in it which lead to hexagonal artefacts appearing on the surface of the planet where icosphere faces met. 

In addition to this, I also introduced the blending of multiple rotations of the same texture technique which I used in the "A Very Important Message" game jam when texturing terrain. This technique eliminates the grid effect of tiling a texture by using a rotation generated with Voronoi noise and applying that to a texture and then blending multiple of these textures together with different inputs into the Voronoi noise generator.

As well as that the overall texture of the planet gets tinted in bands based on latitude in order to mirror climactic bands visible on terrestrial planets like Earth or the coloured bands present on gas giants like Jupiter.

Water

The water present in this iteration of the project is a significant improvement from the last version. This water is textured in a similar fashion to the rest of the terrain, using triplanar mapping, blended rotated textures and tinted climactic bands. Additionally, a Gerstner (or Trochoidal) wave effect has been added to the water, giving it some movement to improve the detail of the planet further. Finally,  the water is a sub-mesh of the planet this time, much like the terrain is a sub-mesh instead of the water and terrain being completely distinct meshes as they were in the original project.

Lighting

The previous project focussed on lighting the scene accurately to the real world by having a huge point light in the sun and then moving celestial bodies around the accurately portray a day/night cycle. This project, however, takes a more traditional video game approach to light and uses a directional light, which can be rotated to achieve a day/night cycle.

In addition to this, this project takes much greater advantage of the lighting. Normal textures are used on both the terrain and water to give greater detail to the planet's surface when up close. Additionally, the water uses a specular texture which makes it almost luminous, reflecting how reflective water is in real life. Finally, the normals on the water can be manually manipulated by the user to emphasise and diminish the appearance of the waves and ripples, which can have a very nice effect on the appearance of the water in the project.