Open-source procedural tree & plant generator for the web, built on Three.js (WebGPU).
▶ Use Live NOW! (WebGPU-capable browser required — Chrome/Edge)
A fully procedural tree and plant generator: pick a species, tune its parameters, and get a unique, textured, wind-animated 3D plant you can drop into a scene or export to glTF.
Status:
v0.1.0-alpha. Thirty-eight species, full LOD + export pipeline, and a living scene are in — but it's early and rough in places. Expect sharp edges.
- Thirty-eight species across two biomes
- Temperate: White Oak · Red Maple · Norway Maple · Sycamore Maple · Small-leaved Lime · Common Lime · English Oak · Horse Chestnut · London Plane · European Ash · Walnut · Tulip Poplar · Sweetgum · American Beech · Ponderosa Pine · Loblolly Pine · Douglas Fir · Cultivated Apple · Sweet Cherry · Paper Birch · Quaking Aspen · American Sycamore · Flowering Dogwood · Weeping Willow · Coppiced Common Hornbeam · Common Juniper · Bilberry · European Red Raspberry
- Desert: Joshua Tree · Saguaro · Creosote Bush · Blackbrush · Big Sagebrush · Date Palm · Pomegranate · Common Fig · Olive · Athel Tamarisk
- Palm fronds. A pinnate frond builder (curved, drooping rachis + V-folded leaflet cards in several planes) on the dichotomous trunk — see
docs/frond-builder.md. - Two generators. A Weber–Penn parametric model for broadleaves & conifers, and a from-scratch dichotomous L-system for the desert plants and the shrubs — succulents (merged-tube mesh, rib crests, areole spines) and multi-stem shrubs (root-crown stem splay, spray-card foliage).
- Real fruit. The orchard trees, the fruiting shrubs and the European urban trees hang actual fruit meshes from their fruiting twigs — gravity-oriented instances with anti-clip placement, never overlapping each other. The apple and cherry are AI-generated, retopoed and rebaked down to game weight, and present at every LOD: real geometry near, baked into the branch cards and the impostor far. The juniper cone, bilberry, raspberry and the urban trees' samaras, lime bracts, acorns, conker husks, plane balls, ash keys, walnuts and olives, and the date palm's LOD0 date bunches, are built by hand in Blender (
scripts/bake_shrub_fruit.py,scripts/bake_tree_fruit.py: a detailed high, an authored low of 120–530 triangles drawn on it, base colour, normal and roughness baked from the high); the shrubs hang theirs on the outer face of their leaf sprays, where they show. Pomegranate and fig use small procedural fruit instead, textured from their leaf atlas (seedocs/foliage-materials.md"Leaf atlas + atlas fruit"). - Real morphology. Each species' branch angles, taper, gnarl, and crown shape are dialed to reference photos, not generic defaults.
- Foliage as cards. Base-anchored single leaves, needle sprays, and top-anchored hanging vines with backlit translucency (Barré-Brisebois SSS), dome-normal canopy shading, and per-instance wind.
- LOD chain + impostors. LOD0 full geometry → reduced-geometry LOD1 → baked branch-card LOD2 → a multi-view impostor: LOD0 photographed from 144 directions over the sky above the plant (a hemi-octahedral grid, horizon to straight down), drawn as one camera-facing quad that shows the three nearest views, one picked per pixel by weight, with depth-corrected parallax, so an orbit or a fly-over never swaps a picture. It is lit by the scene's own sun, sky and shadows on LOD0's baked shading normals, self-shadows and casts from its own sun-facing views, glows when backlit, sways with LOD0's wind, and is drawn as LOD0's leaves are, a speckle of alpha-tested texels at LOD0's density: next to LOD0 from the same camera it keeps the tree's silhouette and brightness from every side and against the light. Just past the switch it thins to the rung it replaces, then holds LOD0's density. Baked off-thread in a Web Worker (~0.5 s) so the viewer never stalls; the grove draws every far tree as one instanced impostor. Per-LOD density & branch-prune dials. (notes)
- Foliage that holds up at range. Every alpha-cut foliage texture — leaves, sprays, needles, fronds, spines, grass, scrub, the baked branch cards and the impostor — gets a coverage-preserving mip chain: colour averaged by alpha, empty texels filled from coarser levels, and each level's alpha scaled so the share passing the material's cutoff matches level 0. Distant crowns keep the density and colour they have up close instead of thickening into dark blobs.
- A living scene. Instanced forest ring with per-instance LOD, wind-animated grass & desert scrub, procedural rocks, fallen dead limbs resting on the terrain, PBR terrain with slope/height material blending, volumetric-ish clouds, and a movable sun.
- Forests to the horizon. Environment → Forest to the horizon plants a species mix (broadleaf: white oak, red maple, tulip poplar, sweetgum; conifer: Douglas fir, ponderosa and loblolly pine) on hills extended to a hazy rim 6 km out, and draws it in bands from the camera: each species' LOD2 near, its multi-view impostor (growing in over the LOD2 tree), a sparse subset that widens to keep the canopy closed, then a canopy shell: the terrain under forest rises to the canopy height and wears crowns seen from above, baked from the mix's own impostors and driven by a canopy field made from the very trees the forest draws, so its stands and clearings line up with them. Matched to the trees it replaces within ±3.5 % luminance from any height and sun direction; 300-475 k trees for +1.7 to +3.3 ms of GPU at 720p; the shell itself is free. Also in the headless API (
buildHorizonForest). (notes) - Ambient audio. Per-biome wind bed (seamless loop) + randomly interspersed bird calls, with a mute toggle.
- glTF export. One click writes a
.glbwith merged per-LOD meshes and standardKHR_materials_*extensions (incl. leaf transmission). The far LOD exports as two crossed cards cut from the impostor's own views (colour, normal map, transmission), with the whole impostor atlas in aSEEDTHREE_impostormaterial extension for engines that run an impostor shader. Species can opt into one leaves primitive per LOD and single-sided dome-normal leaf cards for engines that flip back-face normals (foliage.mergeExportPiles/foliage.singleSidedExport, seedocs/foliage-materials.md).
A WebGPU-capable browser — recent Chrome or Edge (Chrome 113+). There's an automatic WebGL2 fallback, but WebGPU is the intended path.
npm install
npm run dev # http://localhost:5390Then use the control panel to pick a species, reshape it, reseed, tune LODs, and export a .glb. Drag to orbit; the corner speaker button toggles ambient sound.
npm run build # production bundle in dist/
npm run preview # serve the built bundleTextures and audio ship in the repo, so a clone runs out of the box — you don't need to regenerate anything. But they're made, and the tooling is included:
- Textures from photographs. The European urban trees' leaf cards and bark tiles are cut from CC0 / public-domain photographs of the real trees (iNaturalist, Wikimedia Commons) by
scripts/texture/leaf_card_from_photo.pyandscripts/texture/bark_tile_from_photo.py; each recipe inscripts/texture/recipes/records the photo, its licence and every choice made on it, so the texture can be rebuilt from scratch. - Textures from an image model (bark albedo, leaf/needle/spine alpha cards of the other species) come from OpenAI Codex CLI's
$imagegen(gpt-image-2). Scripts inscripts/texture/chroma-key the alpha, dilate, and derive normal/roughness/translucency maps.- Date palm: leaflet sheets, date bunch, and leaf-base trunk tile are text-prompted
$imagegen(the dead-leaflet sheet is an image edit of the generated live-leaflet sheet), packed bycompose-frond-atlas.mjs/compose-palm-bark-atlas.mjs; the rachis/peduncle strips are procedural. - Pomegranate, fig, athel tamarisk: bark tiles, leaf/branchlet cards, flower cards, and fruit-skin swatches are text-prompted
$imagegen, packed into one leaf atlas per species bycompose-leaf-atlas.mjs. - No photographs were used as image inputs; the Wikimedia Commons photos cited in the species files were morphology reference only.
- Date palm: leaflet sheets, date bunch, and leaf-base trunk tile are text-prompted
- Wind beds are generated with Stable Audio 3 via a local ComfyUI, then analyzed and flattened into seamless loops by
scripts/audio/. Bird calls are trimmed xeno-canto recordings. - Mip chains aren't shipped or left to the GPU: when a species loads, SeedThree builds coverage-preserving mips for its foliage maps, and every bake gets the same chain (
src/core/coverage-mips.js, notes indocs/foliage-materials.md). Whatever a card's transparent texels hold — black, or a leftover chroma key — never bleeds into distant foliage.
It's a cross-tool collaboration: the engine, PBR derivation, and scene are written by Claude Code; Codex paints the textures; Stable Audio scores the wind.
New plants are added by dropping in a preset and a small set of textures — no engine changes. This is designed to be done by a coding agent (Claude Code, Codex, etc.): the textures are best cut from photographs of the real species, or else generated with an image model like gpt-image-2, and any fruit is built by hand in Blender. There are three steps.
Export a species object and register it in src/species/index.js (import + add to the SPECIES map). The preset chooses which of the two generators runs — pick the one that matches the plant:
A) Broadleaves & conifers → Weber–Penn parametric model. Copy the closest existing species (white-oak.js is the template; pine.js for conifers) and retune the parameters to reference photos.
export const redcedar = {
name: 'Eastern Redcedar',
latin: 'Juniperus virginiana',
bark: 'redcedar_albedo.png', // → assets/bark/ (+ derived _normal/_roughness)
leaf: 'redcedar_needle_albedo.png', // → assets/leaves/ (+ derived _normal/_roughness/_translucency)
biome: 'temperate', // 'temperate' | 'desert' (picks the environment + soundscape)
tileWorldSize: 1.2, // bark tile size in metres
controls: broadleafControls, // sliders exposed in the UI
foliage: { mode: 'leaves', leavesPerBranch: 9, size: 0.7, downAngle: 60, tint: 0xbfcbb0 },
params: { // Weber–Penn — arrays are [trunk, L1, L2, L3]
scale: 12, levels: 3, ratio: 0.02, baseSize: 0.15, shape: 0 /* 0=conical…5=flame */,
attractionUp: 0.0, length: [1.0, 0.4, 0.3, 0.25], downAngle: [0, 80, 74, 68],
curve: [2, 14, 18, 0], branches: [0, 46, 16, 0], radialSegments: [12, 6, 4, 3],
/* …see white-oak.js / pine.js for the full field list… */
},
};A preset may list synonyms, other Latin names the species is tagged under (OpenStreetMap counts Platanus × acerifolia apart from Platanus × hispanica, for one), for tools that match trees by name.
Rules of thumb: length[childLevel] is a fraction of the parent's length (small terminal values → short leafy twigs, not bare whips); high downAngle + attractionUp: 0 reads as a conifer, up-swept angles as a broadleaf; shape sets the crown silhouette.
Keep the foliage even. By default every limb gets the same number of twigs and every twig the same number of leaves, whatever their length. Under a shape that shortens the upper limbs (hemispherical, spherical, flame...) the short shoots at the top then carry as many leaves as the long ones below, in a fraction of the volume: a dark pile on the crown, and a ball of leaves on any short stub. Space them by length instead: params.branchSpacing[level] (metres between twigs along a limb, with branchMin/branchMax) and foliage.lengthScaled: 1 (each twig carries leavesPerBranch in proportion to its length, the full count on the longest tenth). See norway-maple.js.
B) Desert succulents (saguaro, Joshua tree, yuccas) → dichotomous L-system (Lindenmayer). These aren't branch-and-leaf trees, so they run a completely different generator: set foliageType: 'rosette' (or cactus: true) and describe the plant as an L-system — a branching grammar of fork rules (probability, depth, split angle), segment length/taper, rib count, arm gating, and rosette-leaf or areole-spine placement — which builds a single merged-tube mesh. Copy saguaro.js / joshua-tree.js; the grammar, parameters, and mesh construction are documented in docs/dichotomous-generator.md.
Leaf-atlas species (optional). A Weber–Penn species can also carry flowers and fruit on its leaf texture instead of separate materials: compose one atlas with scripts/texture/compose-leaf-atlas.mjs and map the pieces with foliage.leafUV (leaf cards), foliage.accents (flower cards) and fruit.atlas (procedural fruit) — see pomegranate.js / fig.js / tamarisk.js and docs/foliage-materials.md "Leaf atlas + atlas fruit".
C) Palms → foliageType: 'fronds'. A single unbranched dichotomous trunk plus the pinnate frond builder (curved rachis, V-folded leaflet cards, dead-frond skirt, fruit bunches) — copy date-palm.js; the parameters and the frond/bark atlas layout are documented in docs/frond-builder.md.
The loader auto-derives map names by suffix, so naming matters: <x>_albedo.png → <x>_normal.png, <x>_roughness.png (+ _translucency.png for leaves).
Needs Python 3 with opencv-python, numpy and pillow. Use CC0 or public-domain photos only, so the textures stay free to ship: iNaturalist observations can be filtered to CC0 photos (photo_license=cc0 in its API), and Wikimedia Commons has per-organ categories (<Latin name> (leaves), (bark), (trunks), (fruit)) whose licence each file page states. Write a recipe per texture (copy scripts/texture/recipes/norway_maple_*.json); the scripts download the photo once into a git-ignored sources/ folder.
Leaf card — one whole leaf, front-lit, ideally clear of its neighbours (a leaf over bark, pavement or a hand segments best). The recipe names points on the leaf (fg), on every leaf touching it (other), the leaf's base (where the veins meet the petiole) and the tip of its terminal lobe; the tool cuts the leaf out (a watershed that splits touching leaves along their real edge, then GrabCut), divides out its shading, grades it into the library's brightness (grade.lum: the broadleaves' effective leaf albedo, texture × tint, runs 0.07–0.22), turns it upright into the 1024² card and draws the petiole from the photo's own colours:
python scripts/texture/leaf_card_from_photo.py scripts/texture/recipes/<leaf>.json --preview check.png
node scripts/texture/derive-pbr.mjs assets/leaves/<leaf>_albedo.png
node scripts/texture/derive-translucency.mjs assets/leaves/<leaf>_albedo.png
node scripts/texture/derive-leaf-roughness.mjs assets/leaves/<leaf>_albedo.png assets/leaves/<leaf>_translucency.pngIf the base and tip are hard to place, the leaf's outline is mirror-symmetric about its axis: the terminal lobe lies on it, the basal sinus opposite.
When the cut goes wrong, draw its outline over the photo before changing anything (cut_out is importable) and fix what it shows. Each recipe option answers one kind of photo:
green.paper: a leaf laid flat on pale paper (a glossy leaf's sky-blue sheen fails the green test, so the paper is found instead);hull: a rough polygon round the leaf, nothing outside it is leaf (stops a leak where a soft, out-of-focus edge meets the same green behind it); open the green test right up (h: [0, 360]) when the leaf carries a sky sheen;green.close: bridges pale veins that would otherwise cut a lobe from its leaf;bg: points that must be background (shadows, the gap under a lobe);inpaint:[x, y, radius]blemishes (galls, holes, glare) filled before the cut;petiole.gain: darkens a pale petiole graded up together with a dark leaf.grabcut: false: keeps the watershed's cut, for a leaf whose paler parts share colours with what lies behind it;drop_dark: removes the shadowed gaps between overlapping leaflets of a compound leaf (after the pin-hole fill, so a gap ringed by leaflets and the rachis stays open);fill: polygons put back into the outline: an insect's bite, a tear, a leaflet's stalk that fails the green test (on a card repeated over a crown, one bite becomes every leaf's);clone:[x, y, radius, dx, dy]paints sun glare, a blotch or a filled bite with the leaf's own texture from the spotdx, dyaway (a smoothinpaintof a large patch reads as a grey smear);smooth: blurs the cut before thresholding it, for an entire, smooth-edged leaf (the olive's);radial: a polar opening and closing about the base, for a needle tuft: keeps the long radial needles and drops the blocky pieces of an out-of-focus tuft behind;cut: "colour"withsharp: needles against clear sky (a watershed has nothing to grow along a needle a few pixels wide): the colour test alone inside thehull, kept only near crisp edges so an out-of-focus branch behind drops out (the ponderosa pine's tuft);compound: composes a pinnate leaf (or a leafy shoot) from one photographed leaflet, a terminal one overpairsof scaled, angled copies on a drawn rachis, when no photograph shows the whole leaf flat and clear (see the walnut and olive recipes).
Bark recipes can also tone green algae patches toward the bark's own colour. A frame-filling bark close-up on a trunk far wider than the frame is near enough flat: give flat: {cols: [x0, x1], width_m} instead of trunk, with the metres those columns span judged from the bark's plates or fissures.
Bark tile — a trunk seen straight on, in soft light. The recipe gives the trunk's left and right edges, the rows to use (clear of paint, wounds and branch scars) and the trunk's radius in metres; the tool unrolls the cylinder so the fissures keep their spacing, divides out the light, tones down big lichen patches, white-balances, and makes the tile seamless by a minimum-error seam cut. It prints the metres of bark the tile covers: that is the species' tileWorldSize. A trunk photo holds only a few decimetres of bark, and a tile that small repeats every few decimetres up and round the trunk (a woven look), so set grow_to_m (about 1.2): the tool image-quilts the photo's own bark, at its true scale, out to that size. Keep light.sigma broad (about 0.22) so the plates keep their own shading.
python scripts/texture/bark_tile_from_photo.py scripts/texture/recipes/<bark>.json --preview repeat.png
node scripts/texture/check-tile.mjs assets/bark/<bark>_albedo.png
node scripts/texture/derive-pbr.mjs assets/bark/<bark>_albedo.pngModel the fruit in Blender as a detailed high and an authored low drawn on it (never decimated), bake base colour, normal and roughness from the high, and export a GLB with the maps embedded: add a kind to scripts/bake_tree_fruit.py (or bake_shrub_fruit.py for shrubs; the shared parts are in scripts/fruit_bake_lib.py) and run it with blender -b --factory-startup --python scripts/bake_tree_fruit.py -- <kind>. Budgets: a berry 100–150 triangles, a larger fruit or a small cluster a few hundred. Hang it with fruit: { mesh, perBranch, chance, startFrac, maxCount } in the preset (spray-cluster shrubs add outside so the fruit sits on the sprays' face).
Generate two source images with your image model, then run them through the pipeline in scripts/texture/.
Bark — prompt for a seamless, tileable bark albedo, then derive PBR:
node scripts/texture/derive-pbr.mjs assets/bark/redcedar_albedo.png # writes _normal + _roughnessLeaf / needle card — generate the foliage on a flat magenta #FF00FF background (for a clean alpha key), then cut it out and derive maps:
node scripts/texture/chroma-key.mjs raw.png assets/leaves/redcedar_needle_albedo.png
node scripts/texture/dilate-alpha.mjs assets/leaves/redcedar_needle_albedo.png --passes 4
node scripts/texture/derive-pbr.mjs assets/leaves/redcedar_needle_albedo.png
node scripts/texture/derive-translucency.mjs assets/leaves/redcedar_needle_albedo.png # writes _translucencyArt-direction gotchas learned the hard way:
- A needle spray must be a single feather/frond branchlet — one central woody axis with needles emanating ~45° on both sides, fully inside the frame. A radial burst from one point reads as a grass tuft on the tree, not a conifer.
- Bark must tile with no visible seam (offset-check it); a leaf card should fill the frame with a little margin so alpha-dilation and mip-mapping don't clip it.
- Re-run
derive-pbrandderive-translucencyevery time the albedo changes: the maps are read from the albedo's own pixels, so maps left over from an earlier albedo won't line up with the leaf. - Fill the transparent texels, all of them. SeedThree's own coverage mips fill them from coarser levels, but an exported
.glbcarries the PNG as it is, and other engines build plain mips from it.dilate-alpha --passes Nonly pads N px, so a thin spray on a big atlas keeps black texels that bleed into those mips (dark/navy cards at distance). Use--fill(pull-push), and for a sparse spray on a brown twig add--fill-rect <leaf rect>so the far mips stay leaf-green instead of mixing twig/fruit colours into olive-brown.
If you use OpenAI Codex CLI: it can't always save into the workspace, so prompt it to "generate the image only — do not save/read/list/search files", tag the prompt with a unique marker, then harvest the bytes with scripts/texture/harvest-codex-image.mjs --match <marker> <out.png>.
npm run dev # pick your species in the panel; check LOD0→impostor, wind, and GLB export
npm testThe bar a new species should pass before it ships:
- Beside the reference, every time: the habit from eye height at a few tree-heights' distance, a close look at leaves and bark, and the fruit, each next to a photo of the real species (crown shape and density, how low the crown starts, how the limbs leave the trunk).
- Even foliage, seen from above too: look down on the crown and along its silhouette, over a few seeds. The top must be no denser or darker than the sides, and there must be no balls of leaves on short stubs or where twigs gather (see "Keep the foliage even" above).
- Leaf card: coverage of the card 0.34–0.42 like the library's, the leaf's effective albedo in the library's range, no background colour along the margin, and the petiole at the bottom centre.
- Bark: true to scale (
tileWorldSizeis the metres of bark the tile covers), a tile of about a metre or more (the library's bark tiling runs 0.6-3 m), seamless (check-tile.mjspasses) and with no single feature that repeats loudly; look at the trunk from a couple of metres. - Impostor: at its switch distance, beside LOD2: the same colour and density. Foliage finer than a bake texel (narrow leaves, palm leaflets) fails the bake's alpha cut and leaves the impostor its bare branches;
impostorSupersample: 2bakes it at twice the resolution so the leaves land as coverage. A solid plant (a cactus) setsimpostorMinGain: 1: the switch's density match may thicken its impostor but never punch holes in its body. - LODs: every rung lighter than the one before; LOD0 in line with the library (a large broadleaf with its fruit lands around 70–100k triangles).
- Fruit: at its real size, hanging where the species carries it, and visible from where people stand.
That's the whole loop: preset in → textures made → registered → it's a first-class species with LODs, forest instancing, wind, and export, same as the built-ins.
src/
core/ generators (weber-penn, dichotomous), meshing, LOD, cards, impostor, wind, terrain, grass,
the horizon forest (forest-scatter, horizon-terrain, canopy-shell, horizon-forest)…
species/ one preset file per plant; mixes.js = the horizon forest's species mixes
audio/ ambient soundscape (wind bed + bird scheduler)
ui/ control panel
scripts/
texture/ photo or Codex image → alpha cutout / seamless tile → PBR/translucency maps; recipes/ = the photo recipes
bake_*_fruit.py, fruit_bake_lib.py hand-built fruit: high → authored low → baked GLB (Blender)
reference/ reference tooling; snapshot-stats.mjs dumps per-species generate() stats (seeds 1–3) for regression diffs
audio/ Stable Audio generation + seamless-loop tooling
assets/ committed textures & audio
docs/ spec notes + media
MIT ©
By SkyeShark (Utah Teapot) and Claudes.
Not originally inspired by EZ-Tree but subsequent post-release features were.

