Skip to content

3D Rivers are not perfect. #124

Description

@ETcodehome

If rare imperfect river flows are not something you can abide by you should avoid using the "Uplift" continent variety until a future point in time. Instead consider swapping to use the otherwise equivalent "multi improved" continent type.


Generally, the current technical approach results in gorgeous 3d rivers with nice valleys cohesively flowing downhill, and can be deterministically generated in a highly performant manner. There are a number of known limitations to the current approach, but broadly it is considered playable and functional, just not 100% perfect.

Specific issues with the implementation:

  • Meanders can sometimes backtrack across the flow gradient resulting in steps running along bends rather than across the river
  • Very small continents can produce sawtooth style geology banding in the surrounding river valley carving
  • Forks of rivers can traverse laterally across the underlying flow gradient which can result in anomalous flow ie down then up then down
  • Determinstic continent uplift particularly in presets with high heights relative to continent sizes can generate distinct uplift bands if other noise overlays have low strength.
  • rivers at highly degenerate continent edges will sometimes step down then back up following the uplift gradient.

I would fix all the above in a heartbeat if I had a reasonable technical approach for doing so. 3D rivers are a notoriously problematic technical domain to implement inside a 3d Voxel based world space. RTF was never implemented from the floor up with a terrain system driven by hydrology (the real way of doing this for more perfect results). The implementation costs of a rewrite to do so is a strong contributor to why we're all still waiting for the 0.0.7 RTF release.

The current approach and why it's a cheese

Fundamentally, the current approach generates a "pyramid like" shape known as a centroid underneath the preexisting noise layers of the continent. That height gets deterministically added to each cells height. This gives a river carver a "known" water level that the top of the river should be at. We feed these values through a step function to generate flats and falls from the underlying gradient. Lakes can spawn on flats only which eliminates a huge category of intersection and tile based height related bugs.

The surrounding terrain generates as standard terrain with mountains etc before rivers even come into the picture. When the river carver runs, it subtractively carves that noise down making the entire surrounding valley down to the deterministic surface level. The decoration logic to prettify the surroundings of the river is relatively sophisticated, but the river height is essentially following a fixed water table gradient fed through a step function.

The fortunate result is that despite its relative simplicity for gameplay purposes 99%+ of the time, it's convincing and works well.

  • Rivers can flow and ebb together without significant height steps.
  • You get pretty waterfalls at degenerate continent edges with occasional waterfall caves under them.
  • Rivers sensibly flow from highlands to lowlands and into the ocean
  • The cost to calculate them is relatively low ensuring fast world generation speeds (this is a big one, many "purer" approaches are extremely slow running many many iterations to determine height values or requiring calculating significant cost continent wide data)

We'd like to further improve the results, and already have over the couple months of development on the project. There are a few things we think we can improve further when I get a chance to spend some more time progressing them.

If you're a river world generation genius and have alternative implementation proposals, please feel free to contribute via raising a PR or discussing it with us on the Discord. It's a community fork and we'd strongly consider integrating suitable alternatives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3D RIVERSIssues relating to 3d rivers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions