Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.71k stars 159 forks source link

Procedural planets with terrain #252

Open creative-brain opened 3 years ago

creative-brain commented 3 years ago

I would like to create procedural planets using HTerrain as all the functionality is already there, except the sphere shape of the terrain.

Would it be possible to alter the generation of the current flat terrain into 6 faces rotated to a particular directions to form a cube? Then it would be possible to inflate them as shown here. Maybe the inflation could be done more easily by using the sphere brush and simply elevate each face to form a full sphere. Then one could apply the noise on top of the "inflate brush" to generate random terrain shape or load predefined heightmap.

Zylann commented 3 years ago

I have thought about this, unfortunately, despite the idea being simple, this means modifying a TON of places in the plugin, if not ALL of them (from tool scripts to shaders) just to take spherification into account. Some places may even need a complete rewrite because spherical worlds can't do the same calculations as a planar world. Heightfield colliders also can't be used.

It's easy to make a generator script that makes a planet out of 6 planes (and if you need one, it's the fastest way instead of using this plugin), but hterrain does way more than this. It has editor authoring integration, with a wide range of variants and options that are ALL designed for a single, planar terrain. It means adding an entire additional workflow to stitch 6 nodes in a spherical topology and have all these tools being aware of that "mode", while even simple 2D stitching isn't yet implemented (and stitching is more than just moving two terrains next to each other).

None of this is particulary hard, just time-consuming and tricky to integrate on top of the existing functionality. Given the time I have to work on this, it's very unlikely to happen in the near future.

creative-brain commented 3 years ago

With a proper guidence I would be willing to invest my time to write a simple plugin based on yours. It should contain only basic functionality though. You wrote it shouldn't be particulary hard but maybe there's not that much of work on this afterall. Will you please guide me?

Zylann commented 3 years ago

From what I could gather in a few minutes:

This is not a complete list, and it's very high-level, there is probably way more details to think about.