Flow Restructure

Updated in the Dragontail Peak release: ridge carving returns, better basin angles, faster builds.

Makes terrain drain. Every closed basin either gets a channel cut through the ridge that traps it, or is filled until water can leave, so lakes, valleys and rivers all connect to the map edge or to a drainage network you supply.

This device may not work as intended when used in a tiled build.

When to Use

  • Before water and rivers: Run it before Create Water or any river device, so its rivers reach the edge. Create Water almost always needs one directly in front of it; otherwise the terrain’s closed depressions become lakes.
  • Combined or hand-edited terrain: Run it after any device that combines terrains or stamps features onto them.
  • Cleaner valleys and erosion: Even if you never show water, mountain valleys stay above the lowlands they drain into, erosion devices produce cleaner drainage basins, and neighboring valleys join up naturally instead of ending in pits.
  • Touching up finished terrain: In Repair mode it fixes only the spots an edit left undrained, and leaves the rest of the terrain exactly as it was.

Drainage Integrity

In nature water always flows downhill to an outlet: the sea, a terminal lake, or off the edge of the terrain. Procedural terrain, and especially terrain combined from several sources, is full of closed depressions where water would pool with nowhere to go. Rivers placed on such terrain stop dead, erosion devices leave puddles, and game-engine water never reaches the coast.

Flow Restructure fixes this with two tools:

  • Ridge carving finds the lowest point on the rim of each trapped basin (its pour point, the spot where water would first spill over) and cuts a channel down through it, so the basin empties through a gorge the way a real lake eventually breaches its dam.
  • Basin fill raises the floor of a basin until it drains, which turns the depression into a lake bed, a marsh, or a gently sloping valley depending on the angle you choose.

By default the device carves first and fills only what the cut cannot drain, so the result is a connected drainage network with as little change to the terrain as possible.

Another way to think of it: the device removes every spot where a lake would form. That helps even if you never show water.

How to Use

Connect your terrain and build with the defaults: water can leave at the map edge, trapped basins are carved open, and the few that cannot be are filled flat.

A terrain through Flow Restructure into Create Water, with its terrain and water wired to a Scene View
Flow Restructure placed directly before Create Water
  1. Connect the terrain.
  2. Leave Drain to: at its default so water can leave at the map edge. If the terrain has a coast on one side only, connect an edge mask and choose Borders in drainage mask.
  3. Build with the defaults.
  4. If you want lakes rather than gorges, lower Ridge Carving, or paint a map into it to keep lakes in chosen regions.
  5. If you want valleys rather than lakes, raise Basin Restructuring. A few degrees already turns a lake into a marshy flat.
  6. Put Create Water or a river device after this one. Its rivers will reach the edge.
  7. To touch up the result later, edit it (paint, stamp, combine) and follow the edit with a second Flow Restructure set to Repair. Use the same Minimum gradient as the first device. Only the spots your edit left undrained change.

This short video shows Flow Restructure used directly before Create Water to build a river system. It was recorded with an earlier version, so some parameters differ, but the workflow is the same:

Inputs

PortTypeRequiredDescription
PrimaryHeightfield or VDMRequiredTerrain to make drain. A VDM comes back as a VDM.
Drainage InputWater or Heightfield(Optional)Where water is allowed to end up, beyond the map edge. Water from Create Water or a river device: its lakes and rivers count as outlets, and the terrain under the water is put back afterwards so existing lakes keep their beds. A Heightfield mask: cells brighter than 50% gray are outlets.

A water input cannot be used together with a VDM input.

Outputs

PortTypeDescription
PrimaryHeightfield or VDMThe terrain with every basin draining.

Parameters

Mode (default: Restructure)

  • Restructure: carves and fills across the whole terrain, as described above.
  • Repair: fixes only what does not drain, and leaves everything else exactly as it was. Use it after making spot edits to terrain that already drains, such as the output of another Flow Restructure. Any basin your edits created is filled just enough to drain, and the rest of the terrain does not change, however far away it is. Water on the Drainage Input is never changed. A mask on it counts as an outlet and is never changed either, except with Borders in drainage mask, where only the part touching the edge is an outlet and the rest is ordinary terrain. Repair never carves, so Ridge Carving, Create basins from carving, Basin Restructuring, Preserve structure and Roughness are hidden while it is selected.

Drain to: (default: Map borders and drainage input) Where water is allowed to leave.

  • Map borders and drainage input: the map edge is always an outlet, and so is anything on the Drainage Input.
  • Drainage input: only the Drainage Input counts. Nothing drains off the edge. If nothing is connected to the Drainage Input, the map edge is used anyway.
  • Borders in drainage mask: water leaves the map only where a mask on the Drainage Input touches the edge. Useful when one side of the terrain is a coast and the others are not. With a water input, lakes that do not touch the edge are not outlets, but they still keep their beds.

Ridge Carving (default: 0.75, range: 0 to 1) Accepts spatial input How deeply the rim of each trapped basin is cut at its pour point. At 1.0 the channel is cut all the way down to the basin floor and the basin empties completely. At lower values the cut goes only part way, leaving a shallower lake that the fill then completes. At 0 nothing is cut and every basin is filled instead. Paint a map into this parameter to allow carving in some regions and keep lakes in others.

Basin Restructuring (default: 0 degrees, range: 0 to 45 degrees) Accepts spatial input The slope that filled basins take toward their outlet. At 0 a basin fills flat, like a lake surface, raised only by the tiny gradient water needs to drain. Small angles of 1 to 5 degrees make marshy flats and alluvial fans; 10 to 20 degrees turns a lake into a sloping valley floor; the upper end restructures the basin into terrain that matches steep surroundings. The slider is logarithmic, so the low end has fine control. Paint a map to vary the character across the terrain.

Create basins from carving (default: on) Lets a filled basin drain out through the carved channel below it instead of filling all the way up to its original pour point. Off, every basin fills to its original rim regardless of the cuts, which gives results that stay closer together across different build resolutions at steep basin angles.

Preserve structure (default: 1.0, range: 0 to 1) Accepts spatial input How much of the terrain’s own small-scale relief survives inside filled areas. At 1.0 the basin angle shapes only the broad form of the fill and the original surface detail shows through on top of it. At 0 the fill is a clean sloped surface with the detail replaced.

Roughness (default: 0.5, range: 0 to 1) (Advanced) Adds fine variation to filled surfaces so large fills do not read as perfectly smooth planes. 0 gives a smooth fill. Roughness varies the slope of the fill, so it has no effect while Basin Restructuring is 0, and the higher the angle, the stronger it is. The variation never breaks drainage.

Minimum gradient (default: Smallest) (Advanced) Filled areas are never dead flat: each cell is kept a hair above the next one downstream so water has somewhere to go.

  • Smallest: the least slope the terrain can represent. Fills look flat.
  • 16-bit export safe: a slightly larger step that survives export to a 16-bit heightmap such as PNG 16 or RAW 16. Choose this when the output goes to a game engine as a 16-bit file, so lakes still drain after the export rounds the heights.

Height range

A heightfield result stays inside the 0 to 1 range. If a fill would push terrain above the top of the range, the highest ground is compressed gently toward 1.0 instead of being clipped flat, and nothing goes below 0. In Repair mode the top is clipped instead, because compressing it would change high ground far from your edits. With Minimum gradient set to 16-bit export safe the top is also clipped rather than compressed, since compressing would erase the drainage step. A VDM is not limited in either direction.

VDM Terrain

A VDM input is restructured in place and returned as a VDM with its displacement intact, so overhangs and lateral detail survive. The basin angle means the same thing for a VDM as it does for a heightfield.

Tips and Tricks

  • Painting a map into Ridge Carving is the easiest way to decide where you get gorges and where you get lakes.
  • Keep Create basins from carving on unless you are deliberately comparing results across build resolutions at steep angles.
  • Choose 16-bit export safe before exporting heightmaps for an engine, not after. The flat fills that Smallest produces will not survive a 16-bit round trip.
  • For basin-and-range desert, set Ridge Carving to 0 and Basin Restructuring between 0.5 and 2 degrees to get playa flats; for alpine terrain leave carving on and raise the angle so the few remaining fills read as valley floors.
  • The device is fast enough to run at full build resolution; there is no need to run it at a reduced resolution and blend.
  • Running Restructure a second time on its own output reshapes the terrain again. To fix a finished terrain after an edit, use Repair instead.

Limitations

  • Results at different build resolutions are close but not identical: a coarse preview may pick a slightly different channel for a basin whose rim has two nearly equal low points. Judge final channel placement at the resolution you will export.

Older Versions

Devices saved by Hurricane Ridge builds and by the earlier Dragontail Peak releases had basin fill only, with Quality and Soft clip settings in place of the current Mode and Minimum gradient. When you upgrade one, it comes forward with Ridge Carving at 0 and Create basins from carving off, so it still only fills; raise Ridge Carving to use the carving. Preserve structure acts much more strongly in the current version, so an upgrade resets it to 1.0. A device that already had Preserve structure at 1.0, with no map connected to it, and Basin Restructuring at 0.5 degrees or less (the old default was 0.475) upgrades with only small changes; any other device is reported as changing significantly. Devices from Artist Point and earlier keep the carving strength they had, but the new model gives a visibly different result.

Updated on December 3, 2026
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support

Start the discussion at forum.world-machine.com

Historical Comments

Leave a Comment