Products › BaseNode Packs › Procedural Toolkit › Tutorial: The valley

The valley

A winding valley, six metres long: hillsides cut into terraces, worn by landslides and by rain, rock on the cliffs, broken boulders at their foot, a few trees on the wet ground of the floor. Each step adds one idea, and a few lines, to the step before.

A green valley seen from above one end: terraced hillsides with bands of brown rock, a sandy river bed winding down the middle, trees on the floor, cracked boulders on the ledges
Where we are going. Eight steps, each one a few lines more.

You will learn

This page goes faster on the basics than Lunar ground, which starts from a flat square: a noise, SetPosition, a material. Read it first if those are new to you.

Before you start

You need Blender 5, the Base Node add-on, and the Procedural Toolkit pack, version 0.13.1 or later: it carries the three modules this tutorial assembles. The step files below are free to read, copy and change; the modules they use come with the pack, which is paid.

ModuleKindWhat it gives
terraingeometryTerrains on a grid of square cells: layered_noise, terrace, thermal_erosion, hydraulic_erosion and its maps, terrain_slope_mask.
fracturegeometryvoronoi_fracture: a closed mesh broken into convex pieces, the cut faces marked; explode pushes them apart.
lsystemgeometrylsystem_tree: branches grown by rewriting their tips, leaves at the last tips; branches_to_tubes gives them a body.

Every block below is a complete .bn file, its code beside the nodes it builds. Two ways to try a step:

The pictures are rendered from these exact files by render.py, with the same camera, sun and sky, except where a caption says otherwise.

1. A valley on a grid

Every pass of the terrain module works on a grid of square cells: erosion moves earth and water from a cell to its neighbours, and needs to know how far they are. Grid gives one: 181 × 121 points over 6 m × 4 m, a point every 3.3 cm both ways.

step1_valley.bn: valley

A smooth grey surface curved into a winding trough
Step 1. A smooth trough that winds. The sun is behind the hillside on the right, which stays in its own shadow, as in every picture of this page.

2. Layered noise

use terrain brings in the module. Its layered_noise is the noise of a terrain generator: rolling hills, mixed with ridged mountains by ridges, its space bent by a noise of its own, warp, so that the hills do not line up.

step2_noise.bn: valley

The trough, its hillsides now rough with bumps and ridges
Step 2. The hillsides break into hills and ridges; the floor barely moves.

3. Terraces

Rock lies in layers, some hard, some soft. The soft ones wear back and the hard ones stay as ledges: hillsides go up in steps. terrace makes those steps.

step3_terraces.bn: valley

The hillsides cut into flat ledges and steep steps that follow the contour of the slopes
Step 3. Terraces follow the contours: on the right, they cast their shadow down the hillside.

4. Thermal erosion

Fresh cliffs do not stay sharp. Frost and heat crack them, and what breaks off slides down until the slope can hold it. thermal_erosion does this: wherever the ground is steeper than talus, it moves some of it to the lower neighbours, 20 times over.

step4_thermal.bn: valley

Close to a terraced hillside: sharp ledges, steep straight cliffs
Step 3, close to a hillside: the terraces as terrace cuts them.
The same hillside after thermal erosion: the edges of the ledges rounded
Step 4, the same view: crests rounded, cliffs laid back to 50°.

From afar the change is small; it is what makes the next steps look natural. Water finds softer edges to run over, and the cliffs of step 6 are those still steep after the slides.

5. Hydraulic erosion, and its maps

Rain is what carves a valley. hydraulic_erosion rains on every cell for duration seconds of its own: 1.17 here, cut into 96 short steps. The water flows to the eight neighbours of each cell, faster down steeper drops. Running water picks up earth: more when it is deep, fast and on a slope. When it slows, it drops what it can no longer carry. At the end, what it still carries is laid down where it is.

step5_rain.bn: valley, valley_ground

The erosion also stores what happened on each point of the terrain, as named attributes. Three of them, seen from above:

Map from above: black hillsides streaked with thin blue rills, a wide bright band of water along the winding floor
terrain_water: the depth of water left at the end. It gathers on the floor: the border of the grid is a wall, and the water has nowhere else to go.
Map from above: the rills on the hillsides and the floor in light cyan, the ledges in faint lines
terrain_wetness: the mean depth over the 96 steps. It remembers the rills where water ran, even when it has gone.
Map from above: red hillsides cut by rills, yellow floor and yellow bands along the ledges
terrain_change: the height dug, in red, or laid down, in yellow. The hillsides lose earth; the floor and the ledges get it.

hydraulic_erosion also lets slopes slide at each step, past 45° (its own talus): the banks the water undercuts fall in. The material of this step reads two of these maps with an Attribute node, by name: sand where earth was laid down, dark where the ground stayed wet. The maps above were made the same way: a material that shows one attribute and nothing else, set up by render.py.

The valley in colour: green hillsides with fine rills, a sandy bed winding along the floor
Step 5. A bed of sand along the floor, laid there by the water; fine rills down the hillsides.

Try: hydraulic_erosion(duration: 2.34), twice as long. The rills cut deeper, the bed widens, and the water washes the terraces away; the erosion runs twice as many steps.

6. Rock on the cliffs

Grass does not hold on a cliff: bare rock shows there. terrain_slope_mask is 1 where the ground is steeper than min_angle and fades out over softness below it.

step6_cliffs.bn: valley, valley_ground

The valley with bands of brown rock along each step of the terraces
Step 6. Rock on the face of every terrace, grass on the ledges.

7. Boulders at the foot of the cliffs

Cliffs shed rocks, and rocks break when they land. voronoi_fracture breaks a mesh: it scatters points inside it, and cuts out around each point the part of the mesh that is nearer to it than to any other.

step7_boulders.bn: valley, Stone

  1. One boulder. An IcoSphere, made lumpy by a noise along its normals, flattened, and sunk 3 cm so that it sits in the ground.
  2. Broken. count: 8 pieces, a gap of 1 cm between them, then explode pushes each one 1.5 cm away from the centre. Each cut is a Boolean, so we break one boulder and copy it, instead of breaking every copy.
  3. Where. BlurAttribute spreads valley_cliff over six rings of neighbours: it is above 0.2 next to a cliff. With a second terrain_slope_mask for flat ground, that is where a falling rock stops: at the foot of a cliff, sometimes on the ledge above it.
  4. Copies. InstanceOnPoints sets the broken boulder on each point, turned and sized at random.

voronoi_fracture marks the faces its cuts made with fracture_inside. The material Stone reads it: dark weathered skin outside, fresh pale stone in the cracks.

Close to a terraced hillside: three grey boulders on its ledges, each split into pieces by pale cracks
Step 7, from near the ground: boulders split by pale cracks, on the ledges of a terraced hillside.

8. Trees on the wet flats

Last, a few trees, where trees grow: on flat ground that the water keeps wet. lsystem_tree grows one by rewriting: a trunk; then each tip goes on, and opens three side branches, shorter and tilted; then again, four times.

step8_trees.bn: valley

From the valley floor: trees with thin branching trunks and round crowns on the sandy bed, terraced hillside with boulders behind
Step 8, from the floor of the valley: trees on the sandy bed, boulders on the ledges behind.

The knobs

Every pass has its inputs, on its node in the Geometry Node editor. A few worth turning:

WhereInputWhat it does
valleyseedAnother valley: the noise, the boulders and the trees change together.
layered_noisescale, ridges, warpHow many hills across, how sharp their crests, how twisted.
terracestep, softnessHow high each terrace, how steep its cliff: 1 smooths them away.
thermal_erosiontalus, iterationsThe steepest slope that holds, and how long the ground has to slide.
hydraulic_erosionduration, rain, capacityHow long it rains, how hard, how much earth the water can carry.
terrain_slope_maskmin_angleFrom which slope the rock shows, and the boulders fall.
voronoi_fracturecount, gapHow many pieces, how wide the cracks.
lsystem_treeiterations, branches, angle, decayHow many levels of branches, how many per tip, how open, how fast they shorten.

Try: on step 8, set seed of valley to 7, then set softness of terrace to 1: no more terraces, and most of the rock goes with them.

Mind the size of the grid: erosion works on every point, at every step. 181 × 121 points build in a few seconds. Twice as many along each side are four times as many points, and hydraulic_erosion cuts the same duration into twice as many steps, to erode about as much: it takes four to eight times as long.

Take it to Blender

The finished valley, in one file. Drag the card onto empty space in Blender's 3D Viewport and keep Instantiate the Example: a new object carries valley. A click on the card downloads the file.

The steps before it, to start again from any of them:

The files, with the script that renders this page's pictures, are in examples/tutorials/valley/.