Products › BaseNode Packs › Scatter & Biomes › Tutorial: Forest edge

Forest edge

A hillside with a path up it: pines and round trees in groves on the gentle slopes, glades between them, bushes at their feet, rocks on the steep bank, grass wherever the others leave room, and nothing on the path. Nothing is placed by hand. Rules decide where each thing grows, and the camera decides what is worth keeping.

Beside a dirt path on a hillside: tufts of grass, low bushes and grey rocks in the foreground, pines and round trees behind, a bare bank of earth and a grassy crest under a blue sky
Where we are going: the last step, seen from the path. Seven 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 Scatter & Biomes pack, version 0.13.1 or later. The pack is sold by the author of Base Node, apart from the open source project: the steps below are free to read, copy and change; the modules they use are not. The hillside, the path and the trees, bushes, rocks and grass are made with plain nodes, in the step files themselves.

ModuleKindWhat it gives
scattergeometryscatter: points by density and spacing where its rules allow (slope, altitude, attribute, distance to paths, noise), each storing how far inside the rules it is; place_instances: an instance on each, aligned, spun, tilted and sized for a seed; avoid: a layer kept off another.
biomesgeometrybiome_layer: one layer in one node, from its rules to what the camera sees; lod and frustum_cull for the camera; camera_view to read one; biome: four layers from four collections.

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. The hillside is 180 m wide; the camera stands at its foot, 11 m up.

1. A hillside and a path

Something to scatter on. A grid 180 m wide, a point every 50 cm, lifted by hill_height; a path that winds up it, as a curve laid on the same heights.

step1_hillside.bn: forest_edge, hill_height, hill_path, meadow

A bare green hillside under a blue sky, a dirt path winding up it, a band of bare earth across the slope
Step 1. The hillside, the bank across it, the path.

2. Trees by density and spacing

use scatter brings in the module. Its scatter puts points on the faces of a mesh, so many per square metre, and removes those closer than spacing to another: a Poisson disk. A pine on each point, and the hillside is planted.

step2_scatter.bn: forest_edge, pine

The hillside covered in identical pines, evenly spaced, on the path and the bank as well
Step 2. A plantation: 1,135 identical pines, on the path, on the bank, up to the crest.

3. Kept by slope and altitude

Trees do not root on a steep bank, and they stop below the top of a windy hill. Two rules of scatter say so, in the same call: slope_max and altitude_max.

step3_rules.bn: forest_edge

The pines now stop below the grassy crest and leave the bank bare, still standing on the path
Step 3. 579 pines: the crest and the bank are bare, the edge of the forest is ragged. The path is still planted.

4. A clear path, and glades

Two more rules. paths takes the curve of the path and keeps the trees clearance away from it. noise breaks the forest into groves with glades between them: an even forest looks planted.

step4_clearings.bn: forest_edge

The path now clear of trees, the pines in groves with grassy glades between them
Step 4. 288 pines in groves, the path clear.

5. No two trees alike

Every tree is still the same pine, the same way round, the same size. place_instances replaces InstanceOnPoints: it picks one of several trees, turns it and sizes it, at random for the seed.

step5_variety.bn: forest_edge, broadleaf

Groves of pines and round trees of different sizes, some leaning slightly, smaller toward the glades
Step 5. The same 288 points; pines and round trees, small ones at the edges.

6. Four layers that keep off one another

A forest edge is more than trees. use biomes brings in biome_layer: a scatter, an avoid and a place_instances in one node. Four of them, from the tallest to the smallest, each one kept off the layers before it.

step6_layers.bn: forest_edge, bush, rock, tuft

The hillside populated: groves of trees, bushes and grass between them, grey rocks scattered across the slope and on the bank, the path clear
Step 6. 78,128 instances: 257 trees, 990 bushes, 1,858 rocks, 75,023 tufts of grass.

7. What the camera sees

75,023 tufts of grass, most of them behind the camera or too far to be more than a pixel. The last step gives the layers a camera: an Object input of the graph, read by camera_view. Each layer then keeps only what that camera sees, and makes it simpler far away.

step7_view.bn: forest_edge, pine_proxy

LayerStep 6Step 7Kept
Trees25714054 %
Bushes99025125 %
Rocks1,85842123 %
Grass75,0233,9775 %
All78,1284,7896 %
The populated hillside from the same camera: trees, bushes, rocks and grass, the far trees on the crest as simple cones
Step 7, from its camera: nearly the picture of step 6, with 6 % of its instances. On the crest, the proxies; in front, two trees whose feet are more than half a frame below it are gone.
The hillside from high above: the instances fill a wedge that opens away from the camera, bare grass on either side
Step 7 from high above, still culled for the camera of the other pictures: its frustum is the wedge. Grass only near its tip.

A culled point is gone for every render pass, its shadow too: a tree just out of the frame casts no shadow into it. Widen margin when long shadows come in from the side.

The knobs

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

WhereInputWhat it does
forest_edgeseedAnother forest: every layer, its glades and its sizes change together.
forest_edgetree_lineHow high the trees climb, and the bushes 3 m above them.
forest_edgecameraThe camera the layers are culled for. Move it: what is kept follows.
biome_layerdensity, spacingHow many per square metre, and how close they may stand.
biome_layerslope_max, altitude_min, altitude_maxWhere the layer may grow.
biome_layerclearance, noise, noise_sizeHow far from the path; how patchy, and in patches how wide.
biome_layerradiusHow far it keeps from the layers in its avoid.
biome_layerlod_distance, cull_distance, thinning, marginWhere the proxies start, where the layer stops, how much it thins between, how far past the frame it reaches.

Try: on step 7, set tree_line of forest_edge to 30: the trees climb to the crest and none below moves. Then set radius of the bushes to 0: they crowd against the trunks.

To scatter on your own terrain, use your mesh instead of ground and your curves instead of path: the layers stay as they are. Mind the scale: densities are per square metre and distances in metres, so a terrain modelled at another scale needs them scaled too. For four collections instead of meshes made in the file, biome does the four layers of this step in one node.

Take it to Blender

The finished forest edge, in one file. Drag the card onto empty space in Blender's 3D Viewport and keep Instantiate the Example: a new object carries forest_edge. Pick your scene camera in its camera input. 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/forest_edge/.