For his graduation work Cleon Mocika decided to create a planet generator in Unity. He started with getting accustomed to things like spherical coordinates, Delaunay triangulation (convex hulls) and Voronoi diagrams. As well as algorithms like Poisson sampling and its approximation Mitchell’s best candidate algorithm. His decision to research this can be distilled down to wanting to try and demystify some relatively advanced mathematical and geometrical concepts, and create something pretty and fun along the way. Here are some questions he tried answering with this project:
-How can we generate complex semi-random spherical polyhedrons, and present the process incrementally?
-How can we use the fact that we’re working in a three dimensional real time environment to our advantage?
-How can we determine a list of a few algorithms that combined will output drastically different results?
-How can we balance randomness and intent and use them both to enhance aesthetics?
-How can we determine biomes? What kind of control do we give the user? How can we save what we made?
Cleon spent the first half of the project researching ways to create geometry, which is generated from scratch, and implementing a seed system allows the randomness to be re-creatable. Established fields of study have already taken care of this, so we can borrow from their research without needing to reinvent the wheel. We use this to create a spherical Voronoi faced mesh, from semi-random input points. After that, we group tiles into plates, assigning land or water to each one.
Once we have the plates, we can move on to determining the heat and humidity for every tile. Combining these variables results in the biome. We then create materials for the biomes, and assign them to every tile. Now that the inner workings of the generator are in place, we can allow the user to control every aspect of it by creating a UI. Here is what you have control over: Temperature zones, humidity, layer display (temperature, humidity, biomes), you can toggle the display of the ocean, export the planet as an obj file, control the distribution of land relative to water, and input an arbitrary amount of tiles and plates. There is also a seed textbox in place for the user to input a value. Below is an example output of the temperature map, the humidity map, and the same planet shown as dry and humid.
Since each tile is individual selectable and customizable this can find its application in games such as risk or the settlers of Catan or even a massive intergalactic game where you need to explore planets.
This is was mostly a research project into the procedural generation of a planet, one can later explore the aesthetics and the use of textures. But already Cleon build in the possibility to extrude tiles for UI purposes, for instance zooming into the selected tile or even giving the planet a different type of surface, less faceted.