A couple of days ago I got inspired by this image of a “tiny planet”:
So I set out to try and create a random planet generator that could create this kind of cartoony planets.
After working on it for some days, I’m starting to see some results. I know that the textures are pretty much crap, and the colors aren’t exactly an artist-rendering, but I feel I’m going in the right direction with this.
I’ve been using a LibNoise Unity port for just about anything, and I think I’ve gotten to a point where I can start generating all kinds of planets.
Right now you can modify the planet parameters “live” in a low res version, after which a high res version is rendered. (almost) Everything is threaded, so doesn’t freeze up Unity or anything.
The next thing I’d like to add is a brush modelling tool, so you can sculpt out some custom terrain on the planet. I don’t know if I will implement it, but it might be an interesting project.
Been making some code improvements here and there, so I decided to create some presets.
After 5 minutes of fiddeling I got an earth-like planet and a moon-like thingy:
I’m going to merge the sculpting part with the generator part, so you can generate a planet and then sculpt it to your liking.
I’m also going to look into a decent ocean shader.
Thanks! There is still some deformation at the poles, because it’s basically heightmap painting, but it’s managable.
I’m glad you like it Collision meshes are fully working now. I’m looking into giving the option to generate biomes on the planet surface that can be textured and adjusted separately.
I’ve also generated some octahedrons to use as a basemesh. Previously I was generating them in the script itself, but now it seems like it makes things just more complicated. Now it just uses the mesh given to the meshrenderer, so a developer can choose any type of mesh to start from.
Although I’m starting to think I should be using a classic sphere. Octahedron sphere have this diamond shaped artifact at the poles, which result in a very disturbing “cross shaped hole” when using a heightmap.
So with a single preset I’m able to generate an endless stream of variations of that preset. Below you see the preset I used above, each with a different seed. It never outputs the same planet twice, while it keeps the same look and feel for each planet.
(Oops, forgot to animate one)
And one more preset before I go to sleep: a lava planet (I’m not an artist, so I know this can be made a whole lot better). It’s possible I might create different setup inspectors for different planet types, so the settings in the inspector make more sence for these kinds of things…
I’ve been experimenting with some atmospheric glow. I forgot how hard writing shaders can be! But after a lot of swearing and figuring out some odd things I still don’t fully understand, I’m almost finished with the atmosphere.
After this it’s time to add some textures! I’m still not sure on how to implement this in the most user-friendly way…
Should it be height-based? Downside is it will only allow 1 texture for each height range, so a desert and a medow on the same height wouldn’t be possible… On the other hand, it might be the most intuitive. It would be possible to link it to the markers used in the gradient for the height-coloring, + it would also make it easy to create some debugging coloring.
Should it be based on a separate generated biome map? I’m reluctand to add another level of complexity on top of the generated planet.
Should it be a combination? The biome map being applied to the “intermediate” heights, while mountains and oceans have a default texture slot.
Or should I implement all of it, and leave the choice to the user?
When I finish up the atmosphere shader, I’ll put up some new screenshots!
So another badly needed update on this project! This is actually 2 updates in 1
First update:
As I said in my last post, I’ve started working on an atmosphere shader. As it turns out: shaders aren 't really my thing
However, here is a first attempt at a cartoony atmosphere shader: (sorry, the ocean/water has been turned off in the screenshots)
Still a lot of finetuning needs to be done, but I’m slowly getting there!
Update 2:
I noticed on the forums that there are more and more people working on something similar, so I started looking into what it is that I myself am actually looking to get from this project.
So the goal of this project has shifted/expanded to do the following:
create a random tiny planet with collision mesh
add a or several pathfinding solutions for the terrain
generate biomes (forests etc…) and populate them with props
generate small towns to place on the planet
To do this I’ve actually reworked a lot, and I’ve created some kind of grid system that is able to generate a mesh from the grid, add pathfinding (A* and FlowField) to that grid, and a cellular automata algorithm for controlled biome generation.
Below a first attempt at forest generation:
Update 2bis:
I think I’ve worked out how to remove the distortion at the poles. Still some experimentation to do, but I think I’m almost there
Now that I’m using a grid to define my ‘terrain’ I can actually use all kinds of grids to work with this. Below you see a hex grid, with some different forrest types generated, while a flowfield has been generated for the entire map towards the sphere in the bottom right corner and an A* agent has found a path to the sphere on top.
Screenshots below might not be shiny-fancy-graphics-pictures, but the next step in my world generation was generating random villages and towns, and that is what you see below: random streetmaps with spots for houses along the streets
Next step: creating a more complex planet with all previously implemented systems. So a planet with randomized forests and 1 or 2 towns, on which the 2 types of AI can walk around and find their way based on the type of surface they are on.
After that, I’m going to try to implement all of my old code (so the initial project code) into the new project, so that I can actually create the nice(r) looking planets from the first screenshots in this topic with all the forest, AI and town systems. March is going to be an exciting month!!!