HSEG Devlog 2
Tags: devjournal, unity3d, programming, csharp
Published: 2022-05-28 07:55:08

And so, I began work on creating a planet generator.
At this stage, I've essentially just been following Sebastian Lague's procedural planet generator tutorial on YouTube. This was good and bad in a few respects. For instance, I was essentially just copying code into Unity, not learning the basics of how to use C# or really even just Unity for that matter. I did however learn a lot about noisemaps and terrain generation and should be able to do it myself once I properly understand the language.

The following screenshots, originally posted as comments on their relative GitHub commits, show the progression of the planet generator:

![It all starts with a cube.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4g6vwczerpef5xzqxnt.png)
 ![It becomes stretched out into a sphere, and they can have different resolutions.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/88gby1x5dni17qlsb3lt.png)
 ![A higher resolution means more triangles per side, higher resolutions mean more mesh detail.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4vlbrwpgjf1oykcwooe.png)
 
Then, colors and sizes were added.
![A yellowish planet.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq2u7mvwx2jv8nxsjcqa.png)
 ![A purple planet.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhm50i7i54out5rxfyvt.png)
 ![The same purple planet, but larger.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7d7lsj2dkq6m6vy6en6.png)
 
Then began work on the actual noisemaps and terrain generation.
![Normal sphere with no noise.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtibkzfsrqg2lwc169gd.png)
 ![Noise applied to the sphere.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar94cllgdwbr5hw0tpon.png)
 ![Created variables which allow you to change the noisemap, thus editing the shape of the planet.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmug5mfny75yt3nycb7z.png)
 ![Same case, cool shape.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tpbmbgu0063nzynarspg.png)
![Created the ability to use multiple layers of noise and some extra settings.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/thq89g9jea2ehzicbtlq.png)
  ![Added a "minimum noise" option to create oceans.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0pj6nmcoyub2uw6vkh53.png)
 ![Same case, but continents instead of mountains.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r8se9jfdhankcoffv2la.png)
 ![Added the ability to use another form of noise layers, the previous now being sub-layers. This allows you to mix different types of terrain, i.e. continents with mountains.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtt24nj0j312tnz4n9xa.png)
 
And then, filters to put on noise layers, for even more specific terrain.
![Created a new noisefilter to make ridgelike terrain.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmo5ic3x137x5e67vila.png)
 ![More detailed version of last image.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8j3hk21urqlc7zy6k1i2.png)
 ![Same case, but with the normal continent layer enabled.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbqtq4rc970f2p3fgwzu.png)
 ![Made a simple way to create new noiselayers. Noiselayers also now able to have special settings that only apply to them.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rmwn2toercg22sdqu5kx.png)
 ![Added a way to only render one face of the cube-sphere, to reduce lag when rendering high resolution planets.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dneg27aappjp8nmj5vq.png)
 
From there, I could start on shaders.
![Shaders set up, not properly rendered.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vk6ca4ob6lpuode080wb.png)
 ![Shaders properly rendered.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/agzo3acny9c8cdxn6iub.png)
 ![Added an editable color gradient to change the color of terrain based on the height.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho4g0qqbg6qeexf3stq7.png)
 
Then, biomes.
![Grassy, to sandy, to icy. The biomes use their own noisemaps to make them more natural, and blend together.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0iacap29asvt301a4kxo.png)
 ![Accidentally made this.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xaehcov0e56xk7211rn.png)
 
And that's that. The planet generator code was done, I had nothing left to do with it, and it was good.
But there was one big problem...