What it looks like
The trunk flares at the ground and carries bark grooves that wind up it and continue through every fork. Branches divide cleanly, like an architect's sketch of a tree, never tangling or doubling back. Each branch ends in a rounded clump of foliage, and the clumps merge into one lumpy crown.
The crown is covered completely in separate leaves: no bare patches, and no visible rows or rings. Leaves point down-slope with a gentle, coherent swirl, and overlap like shingles, each sitting a little higher than the leaf it covers, so every leaf reads on its own. On top of the crown the leaf tips curl up; underneath, where a hanging leaf could not print, leaves lie flat against the clump in a low arch.
No two seeds grow the same tree, but every tree has the same character.
Using it in a tile
A tree's height is its top=, written like every top as a length above zero, where $bottom is the ground at the tree's foot: top="$bottom + 40dmm" is a 40dmm tree wherever it stands, and top="$groundHeight + 40dmm" reaches 40dmm over the ground height, shorter on a mound and taller in a hollow. Without top= a tree is 40dmm over its foot.
The top is a cloud like every top: a low surface, a high surface and one weighting, worked out at each branch tip. The tree's own region is a disc round its trunk, so $d is 0% at the trunk and 100% at the crown's rim, $a runs round it, $x and $y are the tile's, and parent($region) is the region the tree stands in (its scatter's, else the tile). A dome is top="$bottom + 40dmm - 6dmm * $d * $d"; a grove taller in the middle is top="$bottom + 36dmm + 20dmm * (1 - d(parent($region), %))", read at each tip in the grove's region. Each tip rolls smoothly inside its cloud (neighbouring tips alike, so the crown is not speckled) and the weighting is read by the tip's rank over the whole crown, so top="$bottom + high(34dmm .. 44dmm)" gives mostly tall tips. The crown is stretched or squeezed to meet its tips, and it stays under the cloud's high: the tips stand a clump's depth under it, so the clumps and leaves above them do not pass it. A top that leaves a tip no room above the bare trunk is refused where it is low (trunk height is the height of the crown's base).
A tree goes anywhere in its area, kept a crown's radius from the tile edge, or where at= says. Grass grows round the trunk when it is listed after the tree; a dirt listed after the tree banks against the trunk:
dharmatiles version="1.0.0"
use "parts/grass" long-grass
tile size="2x2" seed=84 {
stack {
base
dirt clods=none
tree top="$bottom + 49dmm" { // or: tree at="(1sq, 1sq)" top="$bottom + 49dmm"
trunk height="30dmm" // bare trunk below the crown
crown width="30dmm" clumps=32 shape=round branching=normal
leaf length="4.5dmm" width="3dmm"
}
long-grass // after the tree: grows round the trunk
}
}
leaves clumps-only leaves off the separate leaves; leaves bare makes a winter tree. The six branching knobs (branch split=… eagerness=…) are expert controls, allowed only in a parts file:
dharmatiles version="1.0.0"
use "parts/trees" oak
tile size="2x2" seed=3 {
stack {
base
dirt
scatter count=2 { oak } // a definition whose stack is one thing is a thing
oak at="(1sq, 1sq)" top="$bottom + 60dmm" // a call's top= is its tree's
}
}
A top that reads d(parent($region), %) is read in the region the tree stands in, so a grove is taller in the middle (library/tests/plants/2x2-grove.dtile):
dharmatiles version="1.0.0"
tile size="2x2" seed=8 {
region clearing { within "28dmm" of=center }
stack {
base
dirt clods=none
scatter at=clearing count=5 gap="4dmm" {
tree top="$bottom + high(34dmm .. 40dmm) + 22dmm * (1 - d(parent($region), %))" {
trunk height="13dmm"
crown width="14dmm" clumps=24 shape=round branching=normal
}
}
}
}
Reference
at= region, pointControls
| Control | Takes | Default | What it does |
|---|---|---|---|
trunk | group | — | the bare trunk |
trunk height | length (dmm), 0 to 200, or a range, or a weighted range | 18dmm | bare trunk below the crown |
trunk width | length (dmm), 0.5 to 40, or a range, or a weighted range | grows with the branches it carries | trunk thickness at the ground |
crown | group | — | the crown |
crown width | length (dmm), 2 to 200, or a range, or a weighted range | 30dmm | crown width |
crown shape | word | round | silhouette
|
crown clumps | count, 8 to 200 | 32 | clumps of foliage, one per branch end |
crown clumpSize | length (dmm), 1 to 20, or a range, or a weighted range | 5.5dmm | size of each clump |
crown branching | word | normal | few long limbs, or many forks; the only branching control in a tile
|
leaves | word | on | separate leaves, just clumps, or a winter tree
|
leaf | group | — | one leaf |
leaf length | length (dmm), 0.5 to 20, or a range, or a weighted range | 4.5dmm | leaf length |
leaf width | length (dmm), 0.5 to 20, or a range, or a weighted range | 3dmm | leaf width |
top | height | its own height, not held to a level | how high the top stands, as a height worked out where it stands: $bottom + [4dmm .. 9dmm] |
Expert controls (parts files only)
| Control | Takes | Default | What it does |
|---|---|---|---|
branch | group | — | the generator's six branching knobs (expert: parts files only) |
branch split | angle (deg), 1 to 89 | — | half-angle of the cone a branch keeps |
branch eagerness | number, 0 to 1 | — | 1 splits early, 0 only near the tips |
branch target | number, 0 to 1 | — | aim point in the attractor cloud, 0 low to 1 high |
branch balance | number, 0 to 1 | — | how evenly a fork shares its attractors, 0 to 1 |
branch exponent | number, 1 to 8 | — | pipe-model exponent |
branch minRadius | length (dmm), 0.2 to 5 | — | branch radius at a tip |
In the library
1x1-grass-tree.dtilelib:tiles/ground/1x1-grass-tree.dtile2x1-tree-row.dtilelib:tiles/ground/2x1-tree-row.dtile2x2-glade.dtilelib:tiles/ground/2x2-glade.dtile2x2-grass-tree.dtilelib:tiles/ground/2x2-grass-tree.dtile1x1-water+grass-tree.dtilelib:tiles/water/1x1-water+grass-tree.dtile
Generated from dharmatiles elements tree by cargo xtask docs.
Sizes
- Tree.
40dmmover its foot by default (top="$bottom + 40dmm"), 20 to 120dmm at the trunk, and the crown stays under it; the 1×1 library tile uses44dmmwith a24dmmcrown, the 2×2 tile49dmmwith a30dmmcrown. - Leaves. 4.5 mm long, 3 mm wide, 0.24 mm thick, rooted 0.75 mm into the clump. A full tree carries about 2,000–2,400 leaves.
- Trunk and branches. Branch tips are 1 mm in radius; the trunk is as thick as its branches need (a pipe model), so it is never set directly. Bark grooves are about 0.8 mm deep and 2.25 mm apart.
Edges and neighbours
- A trunk is kept at least one crown radius in from every tile edge, so the crown stays over its own tile.
- Grass stays out of a circle round the trunk and grows taller close to it, so the tree sits in a small tuft.
- The tree does not change the tile edge; the ground around it meets other tiles as described on the tile system page.
Rules
What this element always does. A change to one of these is a change to the element.
- Leaves are visible, discrete and big enough to print (
4.5dmm×3dmm× 0.24 mm), on a blobby, slightly cartoonish crown of clumps (32 by default). - Leaves are placed organically: no visible order, complete coverage, each pointing down-slope with smooth variation. Overlapping leaves sit at different heights.
- Leaves on the crown's underside are flattened until they print, never culled; the underside is an end-to-end arch.
- Wood and clumps are bevelled wherever they would hang.
- Only the crown's branching is a tile control (open, normal, dense); the branch details are expert controls in parts files.
- A tree's height is its
top=, a cloud like every top;$bottomis the ground at its foot. The height at the trunk is 20 to 120dmm over its foot, or the build stops with the top's span. The crown's tips roll smoothly inside the cloud and the crown, its clumps and leaves included, stays under the cloud's high. A tree sets$x,$y,$d,$a,$bottomand$region; a call'stop=(oak top="$bottom + 60dmm") is the tree's inside it.
Printing and painting
- No supports. Print base down. Branches grow at least 26° above horizontal (the skeleton aims for 35°), which keeps them inside the 55°-from-vertical overhang limit: 35° above horizontal is the same line as 55° from vertical.
- Leaves print as small plates. On top of the crown each leaf is a tilted plate that bridges from its rooted base. Underneath, leaves lie flat on the clump in an arch and inherit its slope, so no leaf hangs in the air.
- Strong enough to handle. Each leaf is one watertight solid rooted into its clump, and the wood is one closed volume from root to clump.
- Painting. Prime, base-coat the wood brown and the crown green, then drybrush the crown lighter: the shingled leaf edges catch the brush and the gaps between leaves stay dark. The bark grooves take a wash.
- Checked on every build. Any branch below 26° raises a warning naming it.
How it is made
Step by step
A tree grows toward its crown: a cloud of points fills the crown's shape, and branches grow from the trunk toward them, forking only in between. Printability is built in, not checked afterwards: no branch climbs at less than 26°, every clump is cut to stand on its own branch, and leaves on an underside lie flat.
What the program does, in order:
- Crown: the crown's envelope (round, cone, wide or tall) and its attractor points, sampled over its surface by area and grouped about 20 mm across.
- Skeleton: space colonisation: every attractor becomes a branch end, every branch lands on its attractor, forks happen only in between, and no edge is below 26°.
- Wood: a smooth tube along every branch, barked with grooves that run through the forks, the trunk flared and sunk into the ground, all one closed volume.
- Clumps: a rounded cone of foliage at each branch end, noised, cut so it stands on its own branch with no hanging underside.
- Leaves: separate leaves over the clumps, shingled; tips curl up on top and lie flat underneath, where a hanging leaf could not print.
- Place: at
at=, or anywhere in its area with the trunk a crown's radius from the tile edge and clear of other solids.
The code: crates/dt-elements/src/tree/.
Seen from the language
The guide pages that use tree: Placement and scatter, Names, Heights, Clouds, Worked tiles.
