/Planet-Generator

A procedural planet generator addon for Godot with terrain LOD.

Primary LanguageGDScriptOtherNOASSERTION

Planet-Generator Planet-Generator icon

This is a procedural planet generator addon for the Godot Engine using layered noise functions and dynamic LOD (terrain chunks), written in GDScript.

It's licensed unter MIT, so you can use it for pretty much anything as long as you retain the original license file.

Table of Contents

Features and Roadmap

List of completed features and planned features:

  • editor integration
    • configurable ShapeGenerator resource
    • configurable PlanetSettings resource
    • configurable NoiseGenerator resources to layer noise
    • context-aware editor plugin to ease creation of new planets (settings, noise layers, materials?)
    • custom inspector plugin for creating and editing above resources
    • preview texture for NoiseGenerator resource
    • node based editor for terrain shape / noise generators to allow mixing etc.
  • graphics
    • basic terrain coloring based on height using a gradient texture
    • basic atmosphere shader
    • basic water
    • texture mapping (triplanar)
    • better water with reflections and adjustable sea level
    • cloud layer around planet
    • bloom and lens flare effects
  • terrain generation
    • quadtree for automatic LOD subdivision of terrain patches
    • seamless terrain patches
    • terrain collision using PhysicsServer
    • height curve for fine-tuning height levels
    • different types of NoiseGenerators
      • NoiseGenerator (standard)
      • RidgedNoiseGenerator (generates mountainous ridges)
      • simple erosion (morphological erosion, dilation, etc.)
      • generators for other interesting terrain patterns
    • multiple noise maps:
      • height map
      • biome / terrain type map
      • rivers
    • more detail on ground level: vegetation, rocks, etc. using instancing
    • allow generator to output not just straight to geometry but also to heightmaps, values, etc. for offline use
    • allow building terrain from different inputs like procedural noise but also heightmaps, values, files, etc.
    • allow mixing of inputs, see also "editor integration" (e.g. heightmap and noise)
  • documentation
    • installing the addon
    • basic usage
    • creating new planets
    • extending the addon
  • demo scenes with a spaceship to explore planets
  • other improvements
    • allow for larger scale (1 Godot unit = 1m? 1km?)
      • use a scene origin shifter to keep player close to origin and thus mitigate lack float precision
      • enlarge scale, but shrink the universe while inside the editor to make it more maneuverable
      • use another atmosphere shader which doesn't glitch at higher scale
    • add simple planetary orbits
    • add gravity
    • graceful loading and unloading of the addon, solar systems and planets
    • simple benchmark and diagnostics HUD
    • performance optimization:
      • multithreaded terrain generation using WorkerThread
      • JobQueue for TerrainJob which feeds the worker threads with jobs
      • explore computing terrain data on the GPU (shaders, rendering to a viewport)
      • rewrite core parts in C#? (as parallel branch?)
      • rewrite core parts as GDNative module with C or C++? (as parallel branch?)

Usage

You need the Godot Engine to use this addon (tested with Godot 3.x.x).

Quick Start

To quickly get started, open the downloaded folder like a normal project in Godot and run it. You can then navigate a spaceship around the solar system demo scene. The keys are:

  • Mouse to rotate ship
  • WASD for movement
  • hold Shift for faster speed increment
  • hold Control to rotate the camera
  • Esc to release/capture the mouse
  • F1 to switch generating wireframe meshes on/off
  • F2 to switch random coloring of terrain patches on/off

Using the addon

Download and install the addon as described here Installing plugins - Godot Engine documentation.

TODO: Add detailed documentation for setting up planets and their parameters.

For now, check out the solar system demo in demos/solar_system_demo.tscn to see how the planets are configured and play around with the settings. A planets needs a PlanetSettings resource, which contains a ShapeGenerator resource, which in turn has a list of one or more NoiseGenerator resources where you can define what the terrain will look like.

Contributing

  • Found a bug? Please open an issue and add all relevant details.
  • Got an idea for the project? Open an issue or, if you want to implement it, open a pull request with your feature.
  • Want to help out with anything? Clone/Fork the repository and start coding! Pull requests are very welcome.

Screenshots

Click to enlarge:

flight towards earthlike planet a procedural moon appears behind the procedural horizon typical scene the in Godot editor

Credits