Skip to content

Customising grass and bushes ​

Every setting of grass and bushes, group by group: what each group is for, a small example you can see, and a table of its fields with their defaults. The look (FoliageLook, given to foliage) is how it is drawn on each screen; the rules (FoliageStyleDef and foliagePack) are what it does in the game. The end of the page has ten looks to copy.

ts
// src/view.ts: in your view's ground.cellLayers
import { foliage } from '@v12-engine/client'

// say only what you change: every field has a default
export const grass = foliage({
	height: 0.8, // world units: a unit stands about 1.5, a tree 3.5 to 4.7
	density: 5, // tufts a cell
	colors: { foot: [0.2, 0.4, 0.12], tip: [0.6, 0.78, 0.3] }
})

Done: knee-high green grass, five tufts a cell, on every cell of the layer.

Sizes are in world units, distances and radii in cells (one cell is one world unit), angles in degrees, colours three numbers from 0 to 1 (red, green, blue), and times in seconds.

What is drawn ​

A style is drawn as grass made in code, or as your own models (bushes). One layer can mix both: each style says its own.

ts
import { foliage } from '@v12-engine/client'

export const field = foliage({
	draw: 'grass', // value 1 of the layer: grass
	density: 4,
	styles: {
		// value 2: bushes from the shared art, picked by weight
		2: { draw: 'models', models: [{ src: 'forest/bush_common_flowers.glb' }, { src: 'forest/bush_common.glb', weight: 0.3 }], density: 0.7, height: 1.2 },
		// value 3: nothing drawn, though the rules may still hide and burn it
		3: false
	}
})
FieldDefaultWhat it does
drawmodels where models names any, else grass'grass' or 'models'
modelsYour models: { src, scale, weight } each. src is a path under the game's assets, weight how often it is picked (1)
styles[n]A look for the cells painted with value n, over the layer's; false draws nothing there
seed0The layout's seed: the same seed lays the same field on every screen
seeThroughyesGrass round your own units is drawn see-through, so you see them
shadownoModels cast shadows: true, 'near' (near the camera only) or false. Grass never does

Models do not take shape, light, scatter, colors.foot, tip, stops, saturation or ground, nor a style's own wind. See Make bushes of my own.

Shape ​

What one tuft is made of. A tuft is flat blades leaning out from one foot, a blade tapers and curves, a cross is two or three crossed cards with a picture, a mesh is a model of yours used as a tuft.

ts
import { foliage } from '@v12-engine/client'

export const shapes = foliage({
	shape: { kind: 'blade', blades: 4, width: 0.05, curve: 0.4, droop: 0.25 }, // long blades that hang over
	styles: {
		2: { shape: { kind: 'tuft', blades: 8, width: 0.2, spread: 0.15 } }, // broad leaves: a low shrub
		3: { shape: { kind: 'cross', cards: 3, texture: 'textures/fern.png' } }, // a picture of yours on three crossed cards
		4: { shape: { kind: 'mesh', src: 'plants/clover.glb' } } // a small model of yours as each tuft
	}
})
shapeDefaultWhat it does
kind'tuft''tuft', 'blade', 'cross' or 'mesh'
blades5Blades a tuft (tuft, blade)
width0.09A blade's width at its foot, for a tuft a unit tall
taper1How much a blade narrows: 0 as wide as its foot, 1 a point
curve0.3How far a tip leans out from its foot, for a tuft a unit tall
droop0How far a blade's tip hangs down past its highest point
spread0How far apart the feet of a tuft's blades stand: 0 is one foot
segments[3, 2, 1]Parts along a blade near, further off and far: fewer is lighter
cards2Cards of a cross, 2 or 3
textureThe picture on a cross, by its path under the game's assets
alphaCutoff0.5How see-through a pixel of the picture is before it is left out
srcThe model a mesh is

Size ​

How tall it stands, and how much each tuft or bush differs from the next.

ts
import { foliage } from '@v12-engine/client'

export const sizes = foliage({
	height: 1, // world units
	sizes: {
		each: [0.6, 1.4], // each its own size, from 0.6 to 1.4 of the height
		noise: { amount: 0.5, scale: 10 }, // taller in patches about 10 cells across
		edge: { cells: 2, to: 0.4 } // shorter over the last 2 cells of a patch, down to 0.4 at its edge
	}
})
FieldDefaultWhat it does
height0.6 grass (FOLIAGE_HEIGHT); models as madeHow tall, in world units. A model is scaled to it where it is given
sizes.each[0.8, 1.25]The smallest and biggest, of the height
sizes.width[1, 1]The narrowest and widest, of each one's width
sizes.noisenoneBigger in patches: { amount, scale }, amount 0 to 1, scale cells across
sizes.edgenoneSmaller towards a patch's edge: over cells cells, down to the part to
noise8Cells across the patches of sizes.noise, colors.patches and placing.clump where they say no scale

Rotation and lean ​

Which way each is turned, and how it leans.

ts
import { foliage } from '@v12-engine/client'

export const leaning = foliage({
	rotation: {
		yaw: [0, 360], // each turned its own way
		lean: [5, 15], // each leans 5 to 15 degrees...
		leanTo: 'wind', // ...downwind, as the map's wind blows when it is laid
		faceWind: 0.5, // and half turned to face downwind
		upright: true // upright on slopes, not square to them
	}
})
rotationDefaultWhat it does
yaw[0, 360]Degrees: one way for all, or each its own between two
lean0 grass, 6 modelsDegrees, at most or between two
leanTo'random''random', 'wind', or degrees from north
faceWind0How far each turns to face downwind, 0 to 1
uprightyesUpright on a slope, or at right angles to the ground

Colour ​

Colours go up a blade from its foot to its tip, with more stops between if you want, and each tuft differs a little from the next.

ts
import { foliage } from '@v12-engine/client'

export const coloured = foliage({
	colors: {
		foot: [0.15, 0.32, 0.08], // dark at the ground
		tip: [0.7, 0.8, 0.35], // light at the tips
		stops: [{ at: 0.6, color: [0.42, 0.6, 0.2] }], // a green a little over half way up
		vary: 0.15, // each lighter or darker than the next
		hue: 0.03, // and a little greener or yellower
		patches: { amount: 0.4, scale: 12, to: [0.75, 0.65, 0.35] }, // dry patches about 12 cells across
		ground: 0.2, // takes a fifth of the ground's colour under it
		dry: { to: [0.7, 0.6, 0.35], amount: 0 }, // dried out: 0 now; raise it with the season
		tint: [1, 1, 1] // multiplies everything, models too
	}
})
colorsDefaultWhat it does
foot, tipgreensThe colour at the foot and the tip of a blade (grass)
stopsMore colours up a blade: { at, color }, at 0 the foot to 1 the tip
vary0.12 grass, 0 modelsHow much lighter and darker each is, 0 to 1
hue0How much each differs in hue, 0 to 1
saturation0How much each differs in strength of colour (grass)
patchesnonePatches of another colour: { amount, scale, to }
ground0How much of the ground's colour under it it takes (grass)
drynoneEvery colour turned towards to by amount, 0 to 1
tintwhiteMultiplies every colour, models too

See-through colours ​

Any colour can take a fourth number: how much of it is seen, from 0 (not at all) to 1 (whole). Blades that fade towards their tips, a style half seen, patches that thin the field out.

ts
import { foliage } from '@v12-engine/client'

export const ghostly = foliage({
	colors: { foot: [0.2, 0.42, 0.12], tip: [0.55, 0.72, 0.28, 0.2] }, // the tips a fifth seen
	styles: { 2: { colors: { tint: [1, 1, 1, 0.5] } } } // the whole of style 2 half seen, its bushes too
})

It is drawn as a dither: a stipple. A fixed pattern of the pixels is left out, so nothing is blended or sorted, and the pattern stays put as the camera moves. Up close you can see the dots; it is not smooth glass. A whole colour costs nothing more.

ColourIts fourth number
foot, tip, stopsHow much is seen at the foot, the tip and between
tintHow much of the whole style is seen, grass and models
patches.to, dry.toTurned towards as far as the colour is: thin patches, grass that dries to nothing
ruined.crushed, ruined.burntHow much of crushed, cut and charred grass is seen
scatter coloursHow much of each kind of flower is seen

The glow of fire (fire.color) and a light's colour take three numbers only: they are light added.

Placing ​

Where tufts and bushes stand in the cells of their layer, and where they never grow.

ts
import { foliage } from '@v12-engine/client'

export const placed = foliage({
	density: 6, // tufts a cell
	placing: {
		clump: { amount: 0.6, scale: 6 }, // thicker in clumps about 6 cells across
		edge: { cells: 2, to: 0.3 }, // thinner over the last 2 cells of a patch
		jitter: 0.9, // scattered: 0 stands in rows, 1 anywhere in the cell
		slope: [0, 30], // none on slopes steeper than 30 degrees
		notTiles: ['sand', 'rock'], // never on these ground tiles
		keepOff: { roads: true } // and off the `road` tile too
	}
})

By itself, grass keeps off water, the walls of cliffs, the ground under buildings and scenery that blocks the way. It does grow on the road tile, as on any ground painted with the layer: keeping off roads is yours to ask for, with keepOff.roads: true. Models keep off nothing unless their look says keepOff.

FieldDefaultWhat it does
density3 tufts, 0.7 modelsA cell. A part of one is a chance of one. Fewer at the player's lower Tall grass setting
placing.clumpnoneThicker in patches: { amount, scale }
placing.edgenoneThinner towards a patch's edge: { cells, to }
placing.jitter0.8 grass, 0.7 models0 in rows to 1 anywhere in the cell
placing.slopeevery slope[least, steepest], degrees
placing.tilesevery tileThe tile ids it grows on alone
placing.notTilesThe tile ids it never grows on
placing.keepOff.water, cliffs, buildings, doodadsyes for grass, no for modelsfalse grows through it (reeds in water: keepOff: { water: false })
placing.keepOff.roadsnotrue keeps it off the road tile

What the screen keeps off is the screen's alone. To the rules the cells are where they were painted: grass kept off a road on the screen is still there to them, so paint it away (clearFoliage, or the editor's brush) where it should not be. Grass on the road tile, on water, under a building or on cells that block the way never burns, whatever the look says.

Wind ​

How a style moves in the map's wind (MapEnvironment.wind) and in gusts.

ts
import { foliage } from '@v12-engine/client'

export const windy = foliage({
	wind: { sway: 1.2, stiffness: 0.2, waves: 1.5, sheen: 0.5 }, // a soft meadow: big waves, shining as it bends
	styles: { 2: { wind: { stiffness: 0.85, waves: 0.2, flutter: 0.6 } } } // reeds: stiff, tips shivering
})
windDefaultWhat it does
sway1How much it sways, 0 for none
stiffness0.40 soft to 1 stiff
waves1How much it joins the waves that roll downwind over a field
flutter0.3Tips shivering in a strong wind
lean1Leaning downwind as the wind gets up
speed1How fast it sways
sheen0.3Lighter tips as blades lie over: what shows the wind from above

The map's wind is { around, strength, gusts }: degrees it blows towards from north, 0 (still) to 1 (a gale), and how much it comes and goes. Set it in the editor's Look panel or with world.setEnvironment({ wind }). Bushes follow the layer's wind, not a style's. See Make grass follow the wind.

Walked on ​

How grass and bushes move as units go through them, and whether grass lies down and leaves a trail. It is each screen's alone.

ts
import { foliage } from '@v12-engine/client'

export const trodden = foliage({
	walked: { bend: 1.2, radius: 'size', flatten: 0.7, recover: 10, who: 'all' },
	styles: {
		2: { walked: { flatten: 0.9, recover: 0 } }, // wheat stays down until it grows again
		3: { walked: { flatten: 0.3, trail: false } } // reeds spring back at once
	}
})
walkedDefaultWhat it does
bend1How far it bends away from who is in it
radius1.6Cells round them, or 'size': by each unit's size, at most 3.2
wobble1How far it swings back as it settles
settle1.2Seconds the wobble takes
entry2How much harder it moves as one steps in
who'all''all', 'friends' (yours and allies'), 'none', or a function: the layer's alone, a style's is not read
flatten0How far it lies down underfoot, 0 to 1 (grass)
recover8Seconds to stand again; 0 for never, until it grows back
trailyesOne moving through leaves laid grass behind

walked: false turns it off. A hidden enemy is not sent to your screen, so it moves no grass there. For grass the rules crush, see trample below.

Light ​

How grass is lit. Bushes are lit as models.

ts
import { foliage } from '@v12-engine/client'

export const glowing = foliage({
	light: { translucency: 0.5, specular: 0.2, footFade: 0.25, shadows: true }
})
lightDefaultWhat it does
shadowsnoShadows fall on it
normals'up''up' (soft and even) or 'true' (by the way each blade faces)
translucency0Light through the tips from behind, 0 to 1
specular0How much it shines
footFade0How far up from the foot it fades into the ground, of its height

Grass never casts shadows.

Distance levels ​

Further from the camera, fewer tufts are drawn and each is lighter, so a big field stays cheap. Bushes switch to their lighter model files.

ts
import { foliage } from '@v12-engine/client'

export const far = foliage({
	levels: { mid: 40, far: 80, cull: 140, midKeeps: 0.6, farKeeps: 0.2, fade: 6 }
})
levelsDefaultWhat it does
midFrom this many cells away, fewer are drawn (models: their .lod1 file)
farFrom this far, the fewest (models: their .lod2 file)
cullneverNone past this
midKeepsfewer and fewerThe part kept from mid to far, 0 to 1
farKeeps0.25The part kept from far
fade4Cells one level fades into the next over

The player's Detail setting brings every level nearer: half as far on Near, three quarters on Medium. Bushes with no levels use the game's levels for that model.

Ruined ​

How cut, crushed and burnt grass looks. What makes it so is the rules': ruin, trampling, fire.

ts
import { foliage } from '@v12-engine/client'

export const ruined = foliage({
	ruined: {
		stubble: 0.1, // cut grass stands at a tenth of its height (a bush's stump the same)
		crushed: [0.55, 0.5, 0.3], // the colour crushed and cut grass turns to
		burnt: [0.08, 0.07, 0.06, 0.6], // charred, a little see-through
		paint: { cut: 'mown', burnt: 'ash' } // painted on the ground under it, or false
	}
})
ruinedDefaultWhat it does
stubble0.15Cut height, of its height
crusheda dry brownThe colour of crushed and cut grass
burntnear blackThe colour of what is burnt
paint{ burnt: 'ash' }Ground paint under cut and burnt: 'ash', 'mown', a picture's path, or false

Fire ​

How burning grass looks and sounds: blades char from the tip down with a glowing edge, with flames, smoke, embers, a few lights and a crackle along the front. Each part can change or be turned off; fire: false turns it all off.

ts
import { foliage } from '@v12-engine/client'

export const burning = foliage({
	fire: { color: [1, 0.5, 0.15], scorch: 0.8, embers: false }, // the layer's glow and ash; no embers
	styles: {
		2: { fire: { bright: 1.3, smoky: 0.5 } }, // dry grass: big, bright, little smoke
		3: { fire: { bright: 0.7, smoky: 2, sound: false } } // a thicket: low flames, thick smoke, quiet
	}
})
fireDefaultWhat it does
flameslow flames over the groundAn effect by name (burning-ground, one of your view's), or false
smokesmokeAn effect by name, or false
embersembersAn effect by name, or false
lightyesWhether the front lights what is round it: true, false or { color, range, intensity }
colororangeThe flames and glowing edge, three numbers. The layer's alone
bright1How big and bright it burns
smoky1How much smoke, 0 for none
scorch1How dark the ash left under it is, 0 to 1, or false. The layer's alone
sound, catchesa crackle, a whooshSounds by name, or false

How many flames, smoke and embers play follows the player's Effects setting, and the lights show only at the Lights setting's All.

Sound and leaves ​

ts
import { foliage } from '@v12-engine/client'

export const rustling = foliage({
	sound: 'rustle', // the client's own rustle as one moves through it; none when left out
	volume: 0.5, // 1 the loudest
	leaves: 'leaves' // the ready-made effect of leaves flying, where one steps in
})
FieldDefaultWhat it does
soundnoneA sound by name ('rustle' is the client's own), or false
volume0.7How loud, 1 the loudest
leavesnoneAn effect by name played where one steps in, now and then as one moves

Flowers and small plants ​

scatter mixes a few plants into a style of grass. They are laid with the grass, sway, burn and are cut with it.

ts
import { foliage } from '@v12-engine/client'

export const flowery = foliage({
	scatter: [
		{ density: 0.15, height: 0.35, colors: [[0.95, 0.88, 0.35], [0.85, 0.4, 0.62]] }, // yellow and pink heads on short tufts
		{ density: 0.05, src: 'plants/fern.glb', sizes: [0.7, 1.3] } // a model of yours, now and then
	]
})
A scatter entryDefaultWhat it does
densityHow many a cell: 0.1 is one in ten cells
heighthalf the grass'sWorld units
colorswhiteThe colours of their tips, one picked for each; a fourth number is how much is seen
sizes[0.8, 1.2]Each its own size, of the height
shapea short tuft of three wide bladesAny shape
srcA model as their shape

Grass only: models do not scatter.

Grass from ground tiles ​

on grows grass on every cell painted with some ground tiles, kept in step as the ground is painted.

ts
import { FOLIAGE_TILE_STYLE, foliage } from '@v12-engine/client'

export const lawns = foliage({
	on: { tiles: ['grass', 'darkGrass'], density: 2, height: 0.4 },
	// grass from tiles is drawn as style 255 where `on.style` says none: give it a look of its own
	styles: { [FOLIAGE_TILE_STYLE]: { colors: { tip: [0.5, 0.68, 0.3] } } }
})
onDefaultWhat it does
tilesThe tile ids it grows on
style255 (FOLIAGE_TILE_STYLE)The style it is drawn as
density1Tufts a cell, where style is left out
height0.7 of the layer'sWhere style is left out

It is the screen's alone: it hides nobody and never burns, until growOnTiles paints it into the layer for the rules. A cell painted with the layer wins over its tile. See Grow grass on ground tiles.

Presets ​

presetFoliage (looks) and presetFoliageStyles (rules) share their names. Take one whole, or spread it and change what you want.

ts
import { defineCellLayer, presetFoliageStyles } from '@v12-engine/engine'
import { foliage, presetFoliage } from '@v12-engine/client'

export const grassLayer = defineCellLayer({
	id: 'grass',
	name: 'Grass',
	values: [
		{ value: 1, name: 'Meadow', foliage: presetFoliageStyles.meadow },
		{ value: 2, name: 'Wheat', foliage: { ...presetFoliageStyles.wheat, trample: 'none' } } // wheat nobody crushes
	]
})

export const grass = foliage({ ...presetFoliage.meadow, styles: { 2: { ...presetFoliage.wheat, height: 1.3 } } })
NameHeightLooksTo the rules
meadow0.5short blades, a few flowersburns, grows back after 90 s
tallGrass1.4tall, droopinghides (1.4 tall), burns, grows back after 120 s
dryGrass0.6short, straw-colouredburns fast and hot, grows back after 150 s
reeds1.8stiff, brown heads; grows in waterhides, slows to 0.85, burns a little
wheat1.1dense, gold, leans downwindhides units up to 1.1 tall, burns, crushed underfoot
snowGrass0.4short, pale patcheshardly burns, grows back after 180 s
thicket1.4wide dark tufts, red berrieshides, slows to 0.6, burns long
hedge1.5dense, stiffhides, nothing walks through it

All are grass made in code: none needs a model or a picture.

Styles: a look for each patch ​

Each value painted on the layer is a style. Its look goes in styles under the same number, laid over the layer's look field by field: a group such as colors is laid field by field too, so a style that says only colors.tip keeps the layer's foot.

ts
import { foliage } from '@v12-engine/client'

export const patches = foliage({
	height: 0.8,
	colors: { foot: [0.18, 0.38, 0.1], tip: [0.55, 0.75, 0.3] },
	styles: {
		2: { height: 1.4, colors: { tip: [0.7, 0.72, 0.35] } }, // taller and yellower; the same foot
		3: { colors: { tint: [0.6, 0.6, 0.6] } } // the layer's grass, darker
	}
})

A value with no look of its own is drawn as the layer. A layer has up to 255 styles.

How looks are laid over each other ​

OrderWhere it isWho writes it
1foliage(look) in your viewyour code
2the game's cellLayers.jsonthe editor, Set for › Every map (the game's)
3the map's MapEnvironment.bushesthe editor, Set for › This map; and the rules, world.setEnvironment({ bushes })
4client.foliage(layer).setLook and setStyleyour code, on one screen

Each lies over the one before, field by field (layFoliageLook). false at any step draws nothing, and what is laid over a false starts from nothing. For the editor's file to play, the view lays it over the code: layFiles(view, [[CELL_LAYERS_FILE, file]]). Change a look in play from the rules for every player:

ts
import type { World } from '@v12-engine/engine'

export function autumn(world: World): void {
	const bushes = world.map.environment?.bushes ?? {}
	const grass = bushes.grass || {}
	// the map's whole `bushes` is replaced: keep what was there, change the part you mean to
	world.setEnvironment({ bushes: { ...bushes, grass: { ...grass, styles: { ...grass.styles, 1: { colors: { tip: [0.85, 0.65, 0.3] } } } } } }, { over: 20 })
}

The rules of a style ​

What a style is to the game: whether it hides, slows, burns, grows back and is crushed. It goes on the layer's value, beside its name.

ts
import { defineCellLayer } from '@v12-engine/engine'

export const grassLayer = defineCellLayer({
	id: 'grass',
	name: 'Grass',
	values: [
		{ value: 1, name: 'Meadow', foliage: { flammable: 0.6, burns: 6, regrows: 90 } },
		{ value: 2, name: 'Tall grass', color: [0.6, 0.7, 0.3], foliage: { conceals: true, height: 1.4, flammable: 1, regrows: 120 } },
		{ value: 3, name: 'Bramble', foliage: { conceals: true, speed: 0.6, flammable: 0.4, burns: 12, fuel: 1.5 } },
		{ value: 4, name: 'Hedge', foliage: { conceals: true, walkable: false } }
	]
})
FoliageStyleDefDefaultWhat it does
concealsnoHides who stands in it from teams with nobody in the same patch and nobody within reach
concealsTalleryesWith false, a unit taller than height is seen over it
height1How tall it stands to the rules, in cells (a unit stands twice its radius)
speed1Multiplies the speed of who walks through it; the ways go round slow ground where that is quicker
walkableyesWith false, nothing on foot goes through, whatever its state
flammable0How easily it catches, 0 (never) to 1
burns6Seconds a cell burns
fuel1How hot it burns: how much likelier it lights its neighbours
regrowsneverSeconds after it was burnt, cut or crushed that it starts to grow back; false for never
grows10Seconds it takes to grow back once it starts
trample'none''crush': laid flat for good under who walks over it

A style's rules are laid the same way as its look: the pack's style for the layer, then the code's value, then the game's data.json, then the map's definitions (the editor's Gameplay, Set for). foliageStyle(game, layer, value) reads the result.

The pack's options ​

ts
import { foliagePack } from '@v12-engine/engine'

export const grassPack = foliagePack({
	layer: 'grass',
	style: { flammable: 0.5 }, // every style of the layer, where it says nothing of its own
	conceal: { reach: 2, rustle: true }, // how hiding works
	tramples: (_world, unit) => unit.def.radius >= 1, // who crushes styles with trample: 'crush'
	fire: { damage: 8, wind: 1.5, jump: 0.7, maxBurning: 3000 },
	also: [{ layer: 'bush', conceal: { reach: 1 } }] // more layers of the same pack: fire passes between them
})
foliagePackDefaultWhat it does
layerThe layer of cells
styleWhat every style of the layer is where it says nothing
concealreach (2 cells), hides (units on the ground), seenBy, rustle (no), rustleEvery (0.3 s), heightOf (twice the radius)
tramplesevery unit that walksWho crushes a style with trample: 'crush' (never buildings, flyers or ships)
alsoMore layers, each with layer, style, conceal, tramples
fireonFoliageFire, or false for grass that never burns
FoliageFireDefaultWhat it does
spreadyesWhether a burning cell lights those beside it
every0.25Seconds between a burning cell's tries
wind1How much the wind decides the way: in a gale a try downwind is about 7 times likelier, upwind a seventh
slope1How much faster uphill: about 2.7 times on a 45° slope
jumpneverFrom this wind strength (0 to 1), it jumps a gap of one cell downwind
wet0How wet everything is, 0 to 1 (nothing catches)
weatheryesRain and snow damp it and put it out
maxBurning4000The most cells burning at once, over all the pack's layers
lastsneverSeconds after which a fire dies
damagenoneDamage a second to units in a burning cell, dealt by whoever lit it
damageTypemagicThe damage's type
lightsnoBurning grass sets alight what burns on or beside it, with burningPack: see Let trees burn

Ten looks to copy ​

Each is a whole look for ground.cellLayers in your view; where it needs rules of its own, they are beside it.

A lawn ​

ts
import { foliage } from '@v12-engine/client'

// short, even, bright: a park or a castle garden
export const lawn = foliage({
	height: 0.25,
	density: 8, // thick
	shape: { kind: 'blade', blades: 6, width: 0.05, curve: 0.15 },
	sizes: { each: [0.9, 1.1] }, // all nearly the same height: freshly mown
	colors: { foot: [0.12, 0.35, 0.08], tip: [0.35, 0.7, 0.2], vary: 0.06 },
	placing: { jitter: 1, keepOff: { roads: true } },
	wind: { sway: 0.4, stiffness: 0.7, waves: 0.3 }, // short grass hardly moves
	ruined: { stubble: 0.3, paint: { cut: 'mown' } }
})

A wild meadow with flowers ​

ts
import { foliage } from '@v12-engine/client'

export const wildMeadow = foliage({
	height: 0.7,
	density: 5,
	shape: { kind: 'blade', blades: 5, curve: 0.35, droop: 0.1 },
	sizes: { each: [0.6, 1.3], noise: { amount: 0.4 } }, // uneven: taller in patches
	colors: { foot: [0.18, 0.38, 0.1], tip: [0.6, 0.76, 0.3], vary: 0.18, hue: 0.04, patches: { amount: 0.3, to: [0.7, 0.68, 0.35] } },
	placing: { clump: { amount: 0.4 }, edge: { cells: 2, to: 0.4 } },
	wind: { stiffness: 0.25, waves: 1.3, sheen: 0.4 },
	scatter: [
		{ density: 0.2, height: 0.45, colors: [[0.95, 0.88, 0.3], [0.95, 0.95, 0.98], [0.8, 0.35, 0.6], [0.45, 0.5, 0.95]] }
	]
})

Waist-high wheat that leans with the wind ​

ts
import { presetFoliageStyles } from '@v12-engine/engine'
import { foliage } from '@v12-engine/client'

// the rules: hides units up to 1.1 tall, crushed under feet, burns
export const wheatRules = presetFoliageStyles.wheat

export const wheat = foliage({
	height: 1.1,
	density: 8,
	shape: { kind: 'blade', blades: 4, width: 0.04, curve: 0.12 },
	sizes: { each: [0.92, 1.08] }, // a crop: all one height
	rotation: { lean: 6, leanTo: 'wind', faceWind: 0.3 }, // laid leaning downwind
	colors: { foot: [0.5, 0.46, 0.2], tip: [0.95, 0.82, 0.42], stops: [{ at: 0.8, color: [0.88, 0.72, 0.34] }], vary: 0.06 },
	placing: { jitter: 0.4 }, // nearly in rows, as sown
	wind: { stiffness: 0.4, waves: 1.8, sheen: 0.7 }, // big golden waves
	walked: { flatten: 0.8, recover: 0 } // a path through it stays until it grows again
})

Reeds at a shore ​

ts
import { foliage } from '@v12-engine/client'

export const reeds = foliage({
	height: 1.8,
	density: 4,
	shape: { kind: 'blade', blades: 3, width: 0.05, taper: 0.8, curve: 0.08 },
	colors: { foot: [0.24, 0.32, 0.14], tip: [0.62, 0.6, 0.36], stops: [{ at: 0.7, color: [0.44, 0.52, 0.24] }] },
	placing: { clump: { amount: 0.5, scale: 4 }, keepOff: { water: false } }, // they grow in the water
	wind: { stiffness: 0.8, waves: 0.4, flutter: 0.5 },
	walked: { flatten: 0.3, trail: false }, // they spring back
	// brown heads standing a little over the reeds
	scatter: [{ density: 0.3, height: 2, shape: { kind: 'blade', blades: 1, width: 0.12, taper: 0.2, curve: 0.05 }, colors: [[0.36, 0.24, 0.14]] }]
})

Dry savanna ​

ts
import { foliage } from '@v12-engine/client'

export const savanna = foliage({
	height: 0.9,
	density: 3,
	shape: { kind: 'tuft', blades: 7, width: 0.06, curve: 0.45, spread: 0.05 },
	sizes: { each: [0.5, 1.4], noise: { amount: 0.5, scale: 14 } },
	colors: { foot: [0.45, 0.38, 0.2], tip: [0.88, 0.78, 0.5], vary: 0.2, ground: 0.25, patches: { amount: 0.4, scale: 16, to: [0.6, 0.48, 0.28] } },
	placing: { clump: { amount: 0.7, scale: 5 }, notTiles: ['rock'] }, // tussocks with bare ground between
	wind: { stiffness: 0.5, waves: 0.8, sheen: 0.5 },
	fire: { bright: 1.3, smoky: 0.6 } // it goes up fast
})

Snowy tundra tufts ​

ts
import { foliage } from '@v12-engine/client'

export const tundra = foliage({
	height: 0.3,
	density: 2,
	shape: { kind: 'tuft', blades: 6, width: 0.07, curve: 0.25 },
	sizes: { each: [0.5, 1.2] },
	colors: {
		foot: [0.36, 0.38, 0.3],
		tip: [0.7, 0.72, 0.62],
		ground: 0.4, // takes much of the snow's colour under it
		patches: { amount: 0.5, scale: 6, to: [0.9, 0.92, 0.95] } // frosted patches
	},
	placing: { clump: { amount: 0.8, scale: 4 } }, // sparse clumps
	wind: { sway: 0.6, stiffness: 0.7, flutter: 0.5 }
})

A dark swamp ​

ts
import { foliage } from '@v12-engine/client'

export const swamp = foliage({
	height: 1.2,
	density: 4,
	shape: { kind: 'blade', blades: 4, width: 0.07, curve: 0.5, droop: 0.4 }, // limp, hanging blades
	colors: { foot: [0.06, 0.1, 0.05], tip: [0.25, 0.3, 0.12], vary: 0.1, ground: 0.3, tint: [0.85, 0.9, 0.8] },
	placing: { clump: { amount: 0.6 }, keepOff: { water: false } },
	light: { footFade: 0.4 }, // rises out of murk
	wind: { sway: 0.3, stiffness: 0.6, waves: 0.2 } // still air
})

An alien purple field with see-through tips ​

ts
import { foliage } from '@v12-engine/client'

export const alien = foliage({
	height: 1,
	density: 5,
	shape: { kind: 'blade', blades: 3, width: 0.08, taper: 0.5, curve: 0.6, droop: 0.3 },
	colors: {
		foot: [0.15, 0.04, 0.25],
		stops: [{ at: 0.5, color: [0.55, 0.15, 0.75] }],
		tip: [0.4, 0.95, 0.9, 0.25], // cyan tips a quarter seen: drawn as a stipple, not glass
		hue: 0.08,
		vary: 0.2
	},
	light: { translucency: 0.8, specular: 0.4 }, // glows against the light
	wind: { speed: 0.5, waves: 1.5, sheen: 0.6 }, // slow, heavy waves
	scatter: [{ density: 0.1, height: 0.6, colors: [[1, 0.5, 0.2]] }],
	fire: { color: [0.4, 0.6, 1] } // blue fire
})

A hedge maze wall ​

ts
import { defineCellLayer } from '@v12-engine/engine'
import { foliage } from '@v12-engine/client'

// the rules: nothing walks through, it hides, it hardly burns
export const maze = defineCellLayer({ id: 'hedge', name: 'Hedge', values: [{ value: 1, name: 'Hedge', foliage: { conceals: true, walkable: false, flammable: 0.2 } }] })

export const hedge = foliage({
	height: 2,
	density: 10, // a wall: very thick
	shape: { kind: 'blade', blades: 10, width: 0.16, taper: 0.6, curve: 0.3, droop: 0.3, spread: 0.2 },
	sizes: { each: [0.95, 1.05], width: [1.3, 1.6] }, // clipped: all one height
	rotation: { lean: 2 },
	colors: { foot: [0.08, 0.2, 0.06], tip: [0.22, 0.4, 0.14], vary: 0.08 },
	placing: { jitter: 0.3, edge: { cells: 1, to: 0.9 } },
	wind: { sway: 0.2, stiffness: 0.95, waves: 0 },
	walked: false, // nothing goes in
	seeThrough: false
})

A berry thicket of bush models ​

ts
import { defineCellLayer } from '@v12-engine/engine'
import { foliage } from '@v12-engine/client'

// the rules: hides, slows to 0.6, burns long and hot
export const thicketLayer = defineCellLayer({
	id: 'bush',
	name: 'Bushes',
	values: [{ value: 1, name: 'Berry thicket', foliage: { conceals: true, speed: 0.6, flammable: 0.4, burns: 12, fuel: 1.5, regrows: 240 } }]
})

export const thicket = foliage({
	models: [{ src: 'forest/bush_common_flowers.glb' }, { src: 'forest/bush_common.glb', weight: 0.5 }],
	density: 1.2, // models a cell: more than one, so they touch
	height: 1.3,
	sizes: { each: [0.8, 1.3] },
	rotation: { lean: 8 },
	colors: { tint: [0.85, 0.95, 0.8], vary: 0.1, patches: { amount: 0.3, to: [0.9, 0.7, 0.6] } }, // reddish where the berries are
	walked: { bend: 1.2, radius: 1.8 },
	leaves: 'leaves', // leaves fly as one pushes in
	shadow: 'near'
})