← labs
PLAINTECHNIQUES

Terrain Lab

Ways games hide that a ground texture repeats. Drag the white line: left of it is the plain texture, right of it everything switched on below. Drag the scene to look around.

Copies every control's setting as text, to paste in chat.

Town

Jacob's buildings, park props and town trees, with stone roads. To move, turn, size, lift, add, duplicate or delete things, and to paint or rub out stone roads, open the Build bar (bottom left).

Ground
0 · The land's shape

Changing the shape rebuilds everything (a second or two).

Mountain valley

Mountains on either side of a winding valley floor, with ridged peaks and spurs; the floor falls gently along the valley, so its water runs one way.

Terraces and ledges

Terraces: the height is stepped, a flat top then a short steep riser, in the parts of the land a slow noise picks, each ledge's level nudged so they wander. Erosion: tens of thousands of raindrops run downhill, picking up soil where they speed up and laying it down where they slow, carving gullies and leaving fans of soil at their feet. The steep risers get bare dirt from the mixing, gullies worn dirt, fans damp grass. Changing these rebuilds everything (a second or two).

Erosion and rain

Watching starts from the land before erosion; blue lines are this frame's drops running downhill. The trees and plants come back when it stops.

Cliff faces

Cliff faces: steep ground reads its picture from the side (triplanar, so it is not smeared down the face) and is banded into rock strata.

0b · Water

Found from the land: hollows are filled to the level they would spill at (ponds), and water runs downhill cell by cell, adding up, so rivers form where enough gathers and run into the ponds and out over their spill. Pond ground is flattened to its surface, river channels carved a little; the water is painted on the ground (no see-through mesh) with moving waves, sun glints and the sky reflected.

Rivers and ponds (rebuild)
Sky and clouds (reflected in the water)
Surface
Time of day

The sun crosses the sky as it would at about 45° north: the light, the sky, the haze and the clouds follow it, warm and low at the ends of the day, then blue hour and a moonlit night. The hill shadows are worked out again as it moves.

Light and shade

Worked out once from the land's shape, so it costs almost nothing a frame on any setting: where the ridges keep the sun off, how shut-in a spot is (ravines, gullies and hollows darker), and the shade under the trees, thrown away from the sun.

Real shadows only reach a square round the camera. Toward its edge (a round, ragged band) they fade into the baked shade, and each tree's and plant's sun shadow fades into an even shade, so there is no line where they stop.

5 · Mixing by the land

Several ground pictures laid over each other by maps worked out from the land itself, the way terrain tools do it: wet hollows lower than their surroundings, dry rises, forest floor under clumps of trees, lusher grass in the part shade round them, worn paths routed across gentle dry ground, bare steep slopes. Where two meet, the brighter (taller) parts of a picture come through first, so the edge follows the pictures. Noise only roughens the edges. Cost: about a dozen texture reads.

The land (these redraw the maps)

The edges

Tints (multiplied onto the lush picture: no extra texture)

The pictures (the base is the Ground texture above)

1 · Hex-tiling

The ground is cut into small hexagons. Each gets its own random shift and turn of the texture, and neighbours are blended where they meet, so no two patches line up and the grid of repeats disappears. Cost: three texture reads instead of one.

Sharp edges keep the texture crisp; soft ones blur it. Letting the brighter texture win makes the blend follow the picture (stones over soil) instead of a smooth fade.

2 · Large-scale variation

Big, slow patches of lighter, darker, greener and drier ground laid over everything, the way real ground is never one colour for a whole hillside. Read from noise, so it costs no texture at all.

4 · Stamps

Single leaves, twigs, cones, stones, moss, mushrooms, small plants and grass tufts from your sprite sheets, scattered by the shader: the ground is a grid of cells, and each cell may hold one object at a random spot, turn, size and tint, with a soft shadow. Cost: eight reads of the sprite atlas near the camera; none past the fade distance, and no extra draws.

3 · Far-away second scale

In the distance the ground picture is also read at four times the size, and its light and dark vary the brightness of whatever is there (grass, path, rock), so far ground shows big shapes instead of a fine repeating grain, without hiding what it is. Cost: one more read (three more with hex-tiling on).

7 · Forest (from the Tree Lab)

The trees are real meshes near you and octahedral imposters beyond a line, crossfading through a band: an imposter is one quad showing the tree as baked from the nearest of many views round it. The atlases are baked in the page from the same trees.

Families: pines on the slopes and heights, aspen in small one-colour groves, ash and oak in the valley; each kind holds a stretch of ground.

What costs what: a second of frames with each part switched off in turn, from where you are looking.

6 · Ground cover

The 16 ground plants picked in the Plant Lab (one sheet, one shared texture), each growing where its kind likes the ground: long grasses in the open and on dry rises, low grasses in the open and part shade, shade plants under the trees, shrubs along the forest's edge, cattails and marsh marigolds along the water.

loading…

How they grow (patches, clumps, loners)

Try these on the Growth Lab (a light, top-down view), copy them there and paste them here. Covers how they grow, each kind, the tree families, and how many and how big.

Patch kinds hold stretches of ground by themselves; clump kinds grow in small family groups; loners stand here and there. Set each kind's style below.

Plant kinds (on/off, style, size)

Each with the ground it likes. Only shows just that kind (handy for telling them apart); All on brings them all back.

Far off, plants blend toward one colour (the grass's, darker), so a far field reads as one tone instead of speckle

Lawn: short grass tufts (the Grass Lab's blades) on the bare ground near you.

Breeze: the plants, their far stand-ins and the lawn sway together, big plants less.

Coming next

Crossed cards: the same plants as two or three crossed pictures, to compare against the meshes for looks and cost. Rocks, logs and stumps as instanced meshes.