voxolith

Bushes

@voxolith/gen-bush: multi-stemmed shrubs, thickets, brambles, flowering shrubs and hedges, with thorns, berries, blossom and four seasons.

The five bush presets: bush, thicket, bramble, flowering and hedge

@voxolith/gen-bush grows shrubs. A bush is not a small tree: it has no trunk. Several stems leave the ground together and lean outward, which is what gives a shrub its vase silhouette. A thicket scatters more clumps of stems around the centre, at unequal sizes, so undergrowth reads as undergrowth rather than as a ring of tidy bushes.

import { seededRandom } from "@voxolith/renderer/core";
import { generateBush, PRESETS } from "@voxolith/gen-bush";

const { entity, stats } = generateBush(PRESETS.thicket, seededRandom(42));
// entity.kind === "bush"; the anchor is the centre of the base, at ground level

Branch growth, clump placement, canopy carving and exposure shading come from gen-kit, shared with the tree and grass generators; what differs is the base.

How it works

Stems from the ground. Each clump seeds a ring of level-0 stems within baseSpreadRatio of its centre, each leaning out by leanDeg (plus a random spread) at a random azimuth. With clumps above 0, satellite clumps are placed around the centre at 55% to 105% of the main clump's size, which keeps a thicket from looking like identical bushes in a ring.

Skeleton. growBranches grows side shoots on each stem by the preset's branch levels, with a little gravity and a little upward bend toward the tip, then fitHeight scales it to height less the room the foliage needs on top.

Wood. Stems of at least a voxel radius are exact capsules; thinner ones are 6-connected DDA lines, padded to two voxels when they are nearly one thick. Shrub stems are thin, so most of the plant takes a flat per-stem twig colour; only the thicker basal wood gets a bark pattern. Thorns are added outward from the surface, so they break the silhouette instead of speckling it.

Foliage. Leaf clumps are placed along the outermost branch level and, larger, at every tip. Their density falls with health. The mass is hollowed below its hull, carved for sky holes and shaded by exposure, with accent and dead leaves chosen per clump.

Flowers, fruit and snow. Blossom (in spring) and berries recolour the outer rim of whole clumps, never single voxels, or they read as confetti. In winter, deciduous species drop their leaves and take snow wherever a column of sky is clear above; the hedge stays green.

Prune everything not 6-connected to the ground, then crop with the anchor at the base centre.

Parameters split into shape and foliage (which voxels exist) and look (which role each gets). Voxel values are tuned for a 64-tall bush and scale with shape.height. Roles are stems (dark, mid, light), twigs, thorns, leaves (light, mid, dark, edge, accent, dead), blossom, berries and snow; seasons change the palette behind the roles, not the roles themselves.

Presets

presetcharacter
busha single rounded shrub
thicketseveral staggered clumps of unequal size, for undergrowth
bramblelong arching canes, thorns and berries
floweringblossom on whole clumps in spring
hedgeclipped: dense, low and wide, with almost no visible structure; evergreen, so it keeps its leaves in winter

Finer scales

At 20, 50 and 100 voxels per metre, leaves, blossom, berries and snow refine from the coarse voxels (leaves as single leaves in the coarse shade, thorns as pairs of short needles); the stems are redrawn from the skeleton as thin capsule shells, much slimmer than the coarse bush could draw them, with faint streaks along them. Leaves, blossom, berries, snow and thorns are loose roles. See scales and refinement.

Development

bun run --cwd generators/bush verify           # connectivity to the ground, budget, determinism
bun run --cwd generators/bush preview species  # contact sheets into previews/ (also: seeds, seasons)
bun run --cwd generators/bush gen              # bake .vox files into out/

Bush

voxolith/bush starts from the bush preset.

Id
voxolith/bush
Version
0.1.0
Scales
10, 20, 50, 100 voxels per metre

Parameters

Shape

ParameterPathRangeDefault
Height
overall height in voxels (10 per metre); the whole shrub scales with it
shape.height12 to 12064
Stem lean
how far the stems lean outward from vertical, in degrees; higher opens the vase wider
shape.leanDeg0 to 50, step 122
Stem length
stem length as a fraction of height before the shrub is fitted to its height; longer stems give a leggier, more open shrub
shape.lengthRatio0.4 to 1.3, step 0.020.82
Stem radius
stem base radius as a fraction of height; higher gives thicker, woodier stems
shape.radiusRatio0.008 to 0.05, step 0.0010.022
Extra clumps
extra, smaller clumps of stems scattered around the centre; 0 is a single shrub
shape.clumps0 to 80

Foliage

ParameterPathRangeDefault
Clump radius
leaf clump radius in voxels at height 64; larger clumps give a fuller, rounder mass
foliage.clusterRadius1.5 to 8, step 0.13.6
Leaf density
fraction of leaf clumps kept; lower shows more of the twigs
foliage.density0.1 to 1, step 0.021
Sky holes
size of the sky holes carved through the leaves; 0 carves none
foliage.macroThreshold0 to 0.6, step 0.010.2

Look

ParameterPathRangeDefault
Season
leaf colours and density; in winter every species but the hedge is bare, with snow on its upper faces
look.seasonspring, summer, autumn, wintersummer
Health
1 healthy; lower thins the leaves and turns more of them dead brown
look.health0 to 1, step 0.050.9
Thorns
thorn spikes on a fraction of the stem surface; 0 is a smooth shrub
look.thorns0 to 0.5, step 0.010
Berries
fraction of leaf clumps whose outer rim carries berries
look.berryFraction0 to 0.5, step 0.010

Presets

Parameterbushthicketbramblefloweringhedge
Height6456646448
Stem lean2228341812
Stem length0.820.821.050.820.82
Stem radius0.0220.0220.0130.0220.022
Extra clumps04002
Clump radius3.63.22.63.43.8
Leaf density110.6211
Sky holes0.20.20.30.20.08
Seasonsummersummersummerspringsummer
Health0.90.90.90.90.9
Thorns000.2200
Berries000.1200

Roles

Voxel values are these roles, in this order (value 1 is the first). The colours are the defaults; a host maps each role to a palette slot and can restyle it.

  • 1Stem dark stem.dark
  • 2Stem mid stem.mid
  • 3Stem light stem.light
  • 4Twig twig
  • 5Twig dark twig.dark
  • 6Thorn thorn · may float when refined
  • 7Leaf light leaf.hi · may float when refined
  • 8Leaf mid leaf.mid · may float when refined
  • 9Leaf dark leaf.lo · may float when refined
  • 10Leaf edge leaf.edge · may float when refined
  • 11Leaf accent leaf.accent · may float when refined
  • 12Dead leaf leaf.dead · may float when refined
  • 13Blossom blossom · may float when refined
  • 14Berry berry · may float when refined
  • 15Snow snow · may float when refined

Thicket

voxolith/thicket is the same generator starting from the thicket preset.

Id
voxolith/thicket
Version
0.1.0
Scales
10, 20, 50, 100 voxels per metre

Parameters

Shape

ParameterPathRangeDefault
Height
overall height in voxels (10 per metre); the whole shrub scales with it
shape.height12 to 12056
Stem lean
how far the stems lean outward from vertical, in degrees; higher opens the vase wider
shape.leanDeg0 to 50, step 128
Stem length
stem length as a fraction of height before the shrub is fitted to its height; longer stems give a leggier, more open shrub
shape.lengthRatio0.4 to 1.3, step 0.020.82
Stem radius
stem base radius as a fraction of height; higher gives thicker, woodier stems
shape.radiusRatio0.008 to 0.05, step 0.0010.022
Extra clumps
extra, smaller clumps of stems scattered around the centre; 0 is a single shrub
shape.clumps0 to 84

Foliage

ParameterPathRangeDefault
Clump radius
leaf clump radius in voxels at height 64; larger clumps give a fuller, rounder mass
foliage.clusterRadius1.5 to 8, step 0.13.2
Leaf density
fraction of leaf clumps kept; lower shows more of the twigs
foliage.density0.1 to 1, step 0.021
Sky holes
size of the sky holes carved through the leaves; 0 carves none
foliage.macroThreshold0 to 0.6, step 0.010.2

Look

ParameterPathRangeDefault
Season
leaf colours and density; in winter every species but the hedge is bare, with snow on its upper faces
look.seasonspring, summer, autumn, wintersummer
Health
1 healthy; lower thins the leaves and turns more of them dead brown
look.health0 to 1, step 0.050.9
Thorns
thorn spikes on a fraction of the stem surface; 0 is a smooth shrub
look.thorns0 to 0.5, step 0.010
Berries
fraction of leaf clumps whose outer rim carries berries
look.berryFraction0 to 0.5, step 0.010

Presets

Parameterbushthicketbramblefloweringhedge
Height6456646448
Stem lean2228341812
Stem length0.820.821.050.820.82
Stem radius0.0220.0220.0130.0220.022
Extra clumps04002
Clump radius3.63.22.63.43.8
Leaf density110.6211
Sky holes0.20.20.30.20.08
Seasonsummersummersummerspringsummer
Health0.90.90.90.90.9
Thorns000.2200
Berries000.1200

Roles

Voxel values are these roles, in this order (value 1 is the first). The colours are the defaults; a host maps each role to a palette slot and can restyle it.

  • 1Stem dark stem.dark
  • 2Stem mid stem.mid
  • 3Stem light stem.light
  • 4Twig twig
  • 5Twig dark twig.dark
  • 6Thorn thorn · may float when refined
  • 7Leaf light leaf.hi · may float when refined
  • 8Leaf mid leaf.mid · may float when refined
  • 9Leaf dark leaf.lo · may float when refined
  • 10Leaf edge leaf.edge · may float when refined
  • 11Leaf accent leaf.accent · may float when refined
  • 12Dead leaf leaf.dead · may float when refined
  • 13Blossom blossom · may float when refined
  • 14Berry berry · may float when refined
  • 15Snow snow · may float when refined

See the API reference for generateBush and the parameter types.

On this page