Bonsai Wire Was Correct and Looked Wrong
The blog’s backlog file has carried an entry since April called “Bonsai wire was correct and looked wrong”. It remembers a pitch-tuning saga: a helix built to real-bonsai maths, a coil that looked like a compressed spring, and a retreat from a pitch of 1.5 wire diameters to 3. The point of the entry still holds. The history behind it is thinner than “saga”, and one of its claims of realism turns out not to be true.
What went in
On 27 April the prototype’s 3D viewer could wire a branch, bend it and take the wire off, but the wire itself was invisible. Wiring set a flag on the branch and the branch curved. Pull request #19, “visible copper wire coil on wired branches”, added add_wire_coil to the mesh builder: a copper tube wound round any branch whose wired flag was true, built after the branch’s bark.
The coil has three numbers, and the commit message gave each one a real-bonsai justification:
- Thickness. The wire’s radius is 15% of the branch’s base radius for an unbent branch, rising to 30% at a 60° bend, floored at 0.002 display units so a sapling’s wire still shows. The message cites real practice as a “gauge ratio 0.33–0.5 of branch diameter, denser for harder bends”.
- Pitch. The distance along the branch for one full turn is 3 wire diameters:
_pitch = 3 * (2 * _wire_r). - Turns. The branch’s length divided by the pitch, at least one.
The helix is built the same way the trunk is: as rings stacked along a path (Drawing a Circle With Six Lines of Code covers the rings). Walk a parameter s from 0 at the trunk to 1 at the tip, 8 samples per turn and never fewer than 20. At each sample the wire’s angle round the branch is s × turns × 360°, and its centre sits that far round the branch’s cross-section, at the branch’s tapering radius plus the wire’s own. Round that centre goes a ring of six vertices, and neighbouring rings are stitched into a tube.
The subtle part is which way the rings face. A ring square to the branch axis would tilt against a wire climbing round the branch, so each ring is square to the helix’s own direction at that point, built by a new helper, build_oriented_ring. Twelve days later, when branches learned to curve, the coil had to take its sideways directions from the branch at each sample rather than once per branch; How a Branch Learns to Curve tells that part.
The spring
The pitch is where the entry’s story lives, and the record holds one sentence of it. The code comment and the commit message say the same thing:
Real-bonsai max-contact is 1.5×, but at our render contrast that ends up looking like a compressed spring.
No commit in the history ever had a pitch of 1.5. The pull request is a single commit, written at 10
UTC and rewritten at 10, which is the “amend” the backlog remembers. The pull request opened at 10 and merged seven seconds later, with “Needs in-IDE verification” still in its body. I could not run GameMaker from where I worked, so whatever screen showed the spring, the sources do not say whose eyes were on it or what changed in those eight minutes. The memory says the pitch was tuned. The history says one number was chosen, and the reason it was not the realistic one was written down beside it.The geometry behind the spring is simple once it is written as gaps. With a pitch of p wire diameters, the gap between neighbouring turns is p − 1 diameters. At 1.5 the gap is half the wire’s width. At 3 it is twice the wire’s width. On a real tree you look at that from a few centimetres away. A thin tube on a screen, seen across the whole tree, gets a few pixels per turn. The turns run together into a ribbed bar, and a ribbed bar wound round something reads as a spring.
I can show the scale of the problem with today’s viewer, though not April’s. The wired test tree has an 11 cm branch bent 40°, and its coil runs 22.2 turns, which The Viewer Grows Back derived by hand. On the desktop screenshot below that coil spans, by my eye, about 75 pixels. That is a turn every three or four pixels, round a wire that, by the same rough measure, is about a pixel thick, drawn without anti-aliasing. At a pitch of 1.5 it would be 44.4 turns in the same span, and the half-wire gaps would be smaller than a pixel. There would be nothing to draw them with.

Four minutes after #19 merged, the commit for #20 added the anchor: a 1.5-turn wrap round the trunk where the branch starts, ending on the side the branch leaves from. Its pitch is commented matches branch coil pitch, so the anchor took the eye’s spacing too.
The claim that was not true
Rereading #19 for this post, I checked the thickness against its own justification, and it does not match. The bark is drawn at a radius of girth / 1000 × 4 display units. The wire’s radius is 0.15 to 0.30 of that same radius, so the wire’s diameter is 0.15 to 0.30 of the branch’s diameter. The cited rule is 0.33 to 0.5. The coil is about half as thick as the realism it quotes. My best guess is that the comparison mixed the wire’s diameter with the branch’s radius, but that is a guess.
Nobody noticed, because it looked fine. The pitch departed from realism on purpose and said so. The gauge departed from it by accident and claimed not to. Both were judged in the end by how the picture looked, and only one of them admitted it.
Where the wire is now
The TypeScript viewer ported the coil number for number. src/viewer/treeMesh.ts has WIRE_PITCH_DIAMETERS = 3, commented “a comfortable, hand-applied wrap with visible gaps”, beside the gauge range, the floor, the sampling and the 1.5-turn anchor. A unit test pins every one, and another checks that each ring of the wired test tree’s coil sits on the tapering branch surface at the right offset from the branch’s centre line.
The wire is no longer copper. In the Inked viewer it is ink-brown, {46, 30, 22}, darker than every species’ bark, which The Viewer’s First Ink covers. That is the same decision as the pitch, made again: the colour is chosen so the coil reads as a drawn line, not because wire is that colour.
The simulation knows none of this. In src/sim/training.ts a wired branch is a flag, a bend and a record of the day the wire went on: take it off before 56 days and the bend springs back to 30%. Gauge, pitch and colour exist only in the renderer.
What I take from it
The split between the simulation and the picture is the right place to put realism. The simulation is where the bonsai facts matter, because they decide what happens to the tree. The renderer’s job is to make the state legible, and it should be judged in pixels at the size the player sees, not in wire diameters. A pitch of 3 is not a worse model of wire. It is a better picture of a wired branch.
The second lesson is smaller. A real-world justification next to a number is not a check of that number. I wrote two of them in April. One was honest about being overridden. The other was simply wrong, and it sat in a comment for six and a half months because the thing it described looked right.