Random Planet Generator

So me and my collague found this brilliant blog post; Procedural Planet Generation by Andy Gainey a few days ago. Even though it looks beautiful and stuff, it’s written in javascript which isn’t a popular development platform here, so we decided to convert it to C# & Unity3D.

We’ve only done the icosahedron subdivision part for now, but still working on the rest actively.



You can find the Unity3D project files below but beware, it’s just a raw translation from Javascript to C# at the moment and looks quite ugly (I mean the coding style). I’ll do the refactoring and beautifying stuff when we’re done with it. That being said, we may not do a 100% conversion either and go on a different way at some point.

Anyway, I hope you guys find it useful, please do notify us about any bugs or issues in the C# version so we can fix it asap. Enjoy!


4 thoughts on “Random Planet Generator

  1. Could this be used to randomly “seed” a universe as well? Wondering if you’ve continued work on this as i’ve just recently stumbled on this while searching for a way to randomly seed a huge universe in a 2D top down style game. Looks very interesting!

    1. Hey Loren!
      Unfortunately I gave up on this shortly after posting this blogpost, but sure you can easily generate a solar system and galaxies using similar procedural generation algorithms. You can use this one for planets, then you’ll need one for solar system (to place planets), another one for galaxy (to place systems) etc.
      Please do let me know if you do something like that, I would love to see the results!

  2. Hey there! So I know this is an old project but is there a reason the planet comes out looking like it has giant holes all the way to center? Also is there a way I can keep it from generating sooo many triangles?

    1. Hey TJ!
      If I remember correctly, you get those holes when the center of the polygon is at the center of the sphere. Can’t remember why it did happen though but with center being at the center, you’ll have a cone instead of a polygon and get that weird look.
      Can’t do much about triangles though. As I said, it was using a center vertex, you can remove that and reduce tri count for each poly a bit but won’t be a huge difference I guess. Still worths a shot.

Leave a Reply