Skip to content

LODs and wind data ​

The Tree output node holds what a game engine needs beyond the mesh: the levels of detail (LODs), the wind data, shadow meshes, collision capsules and the impostor.

FieldKeyWhat it does
LODslodsdetail fraction of each LOD, from 1.0 (everything) down; default [1.0, 0.5, 0.2]
Switch sizeslod_screen_sizesscreen-height fraction where each LOD ends (empty = suggested)
Wind datawind_datawrites the wind channels (on by default)
Merge by materialmerge_by_materialone mesh part per material in each LOD
Shadow proxiesshadow_proxyalso writes a cheaper shadow-casting mesh per LOD
Collision capsulescollisionwrites trunk and bough capsules into the export manifest
Species tagspeciesa free tag in the export manifest, for scatter tools
Impostorimpostorthe octahedral impostor: see Impostors

How the LODs are made ​

Lower LODs are not made by decimating triangles. They are rebuilt from the skeleton:

  • the thinnest stems are dropped first (by radius rank; LOD stem drop on the Bark mesher tunes how fast);
  • fewer sides around each tube and fewer rings along it;
  • leaves are merged into fewer, larger cards that keep the total leaf area within about 10 %, so the crown does not thin out; below Clusters below they become a few card clusters.

The broadleaf preset at LOD 0 (1.0), LOD 1 (0.5) and LOD 2 (0.2)

broadleafDetailTrianglesVertices
LOD 01.011,86510,803
LOD 10.53,1473,818
LOD 20.28001,230

(Numbers from an export of samples/broadleaf_textured.treegen.json.)

Each LOD is its own mesh named <name>_LOD<n>, which is the name Unity uses to build an LOD Group. A suggested switch size for each is written in the export manifest. Every mesh stays under 65,535 vertices per part.

Design the lean LOD first and add detail upward, so every LOD keeps the silhouette. Check each LOD in the preview with the LOD buttons.

Shadow proxies ​

With Shadow proxies on, each LOD gets <name>_LOD<n>_Shadow: cheaper, no wind data, leaves as clusters. In an engine, set the proxy to cast shadows only and the LOD meshes to cast none.

Wind data ​

With Wind data on, every vertex carries the numbers a wind shader needs, in standard channels every importer keeps. The layout is called treegen_wind_v1.

ChannelMeaningRange
COLOR_0.rflutter weight: 0 on wood near the stem, 1 at leaf edges0–1
COLOR_0.gphase: random per stem (per leaf on cards), so neighbours do not move together0–1
COLOR_0.bbranch bend weight: 0 at the stem base, growing to the tip0–1
COLOR_0.acrown ambient occlusion (darker inside the crown)0–1
TEXCOORD_1.xypivot of the stem this vertex bends around: x, y (meters)—
TEXCOORD_2.xpivot z—
TEXCOORD_2.yhierarchy level: 0 trunk, 1 deepest level0–1

In Unity these are color, uv1 and uv2 (FBX: the vertex colour layer and UV sets 1 and 2). The meaning is also written into the export manifest.

A stem that survives into a lower LOD keeps exactly its LOD 0 pivot, phase and level, and a merged leaf card takes the values of a leaf it replaces, so wind does not jump at an LOD switch. Shaders should still fade the wind out before the last switch.

See the channels in the preview ​

The shading row of the preview shows one channel as grey: R flutter, G phase, B bend, A crown AO.

The preview showing the R channel of the vertex colour

Plain viewers tint the tree

glTF viewers (and Blender's default import) multiply the base colour by COLOR_0, where the wind data lives, so a tree with wind data looks dark or coloured there. For a render or a plain viewer, turn Wind data off. In an engine, the tree's shader reads the channels as data.

No engine shader that reads this layout ships yet (Engine shaders).

Collision and placement data ​

The export manifest also carries what a scatter tool needs: the species tag, the height, the crown radius, the trunk base radius and collision capsules along the trunk and main boughs.