This project was solely made as study case between Unity and Unreal, and multithreaded/shader-based algorithm optimalizations.
The planets are generated as a cube, with all of the vertices normalized to an equal distance, generating a sphere. After that, a simplex noise algorithm generates the mountains and oceans, which then get shaded with the planet shader I wrote.
As Unreal does not support Compute Shaders, Unity has a significant edge in algorithm optimalization. The only alternative would be the more risky CPU based multithreading, which poses serious risks of memory leaks.
You can find the Unreal version of this project here:Learn More
Compute shaders are a very efficient way of handling Vector-based calculations. Vertex positions (Vector3) and Colors (Vector4) can be processed at high speeds on the GPU thanks to the more favoring hardware architecture. This has made it possible to generate planets with over 2.500.000 vertices at the same speed 25.000 vertices would be calculated without the shader. That is an optimalization of 100x!
Compute shaders use the programming language HLSL. In principle it is similar to C# in Syntax and once you got the base functions defined, everything inside of the pixel/vertex shader function conforms to what you would expect if you were writing a C# script.
Unlike normal shaders, compute shaders are capable of sending the resulting data back to the CPU so the CPU can process the crunched numbers. Unlike multithreading, this does not happen async. The shader will crunch the numbers for all vertices, then return the data in a single pass. This removes the need for async handling.
Unlike in Unreal, Unity does not support button definitions within a C# script. A separate C# editor script will have to be written to allow for buttons to pop up within the editor.
This tool also offers the option to save the generated meshes to be used in Runtime environments. There is the option to link the generated mesh to the generator as well, so that if you make a change to the mesh with the generator, each instance of the saved mesh automatically gets updated as well.