Free beams: members between any two points, joints that solve themselves
0.77 GPU · 0.34 CPU ms
Still
The live demo starts when it’s in view.Click two points to add a member (nodes and a grid snap) · pick the joints and the profile · drag to turn the view · Look closer
The HaTac engine’s free beams, lifted out whole in raw WebGPU.
The HaTac engine’s free beams, lifted out whole in raw WebGPU: a member between any two points in five stock sections (I-beam, box, angle, tube, flat bar), its end hardware, bevels and texture kept true at every length because each vertex stores its metres from one end and the shader places it; four joints (bolted end plates, a rounded weld bead with ripples, a pinned clevis, a lapped fin bolted through); a node solver that groups ends within a tolerance, cuts each member back along the bisectors of its neighbours with room for its hardware, and fits a gusset plate round the seats in the plane most members share (sockets carry the rest), re-solving only the nodes an edit touches; and an instanced renderer that draws thousands of members in a few draws, closes each shaft onto its node before the joint hardware and plates fade by distance, then simplifies it to its outline and a plain box further out, so no joint ever opens and nothing pops. A small host draws it on a page with no engine; the demo builds a footbridge over a creek under sky-atmosphere’s sky, in material-bake’s worn painted steel, and takes the members you click in.
What it costs a frame
GPU
0.77 ms
CPU
0.34 ms
02468101216.7 ms
GPU
0.77 ms
CPU, median
0.34 ms
CPU, 95th pct
0.74 ms
Draw calls
0
Weight
Moderate
Measured 25 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 158, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.73–0.99, CPU 0.28–0.34 ms). What ran: Alone: five members, one of each profile (I-beam, box, angle, tube, flat bar), bolted, stretching between 1.6 and 3 m every frame, in worn painted steel baked once before the measured frames, drawn by the module’s own host (multisampled at 4×) with its plain light. Each frame re-solves nothing; it refits five members and uploads their instances. Phones: tiers are being measured next.
How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
Typical frame ?
21.16 ms
1% low ?
28 fps
Varies by ?
±3.87 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · referenceHow long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.
Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.
Frames
Median (p50) ?
21.16 ms
p95 ?
30.20 ms
p99 ?
33.18 ms
Slowest ?
39.02 ms
Mean ?
22.37 ms
Standard deviation ?
3.87 ms
1% low ?
28 fps
0.1% low ?
26 fps
Hitches ?
0 of 600
Over budget ?
11 of 600
Main thread
Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 1.0 / 1.2 ms
Input
No input during this run.
Memory
JavaScript heap ?
80.8 → 40.4 MB
Growth ?
-40.38 MB
Browser
JavaScript a frame ?
0.49 ms
All tasks a frame ?
1.03 ms
Layout / style ?
0.00 / 0.00 ms
Main thread busy ?
5%
Garbage collection
Collections ?
3 (2 minor, 1 major)
Pauses ?
12.7 ms in all, longest 3.4
What it needs
Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages
With an agent
install("free-beams")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up
What it’s for
A building game’s steelwork: girders, trusses and towers placed by their two ends, joints that cut themselves to fit
A bridge, a crane, a pylon or a roof truss put together member by member in an editor, with plates at every node
Thousands of struts in a lattice or a scaffold, in a few draws, with joint detail only where the eye is close
Members that stretch live while someone drags an end, without the bolts, bevels or texture stretching with them
A visualisation of a structure from data (nodes and members), drawn with real sections and joints
Pitfalls, in brief
The demo needs WebGPU: the beams are drawn by WGSL with instanced vertex buffers, and the demo’s sky, materials and shadow map are compute and render passes of their own.
Never scale a member with an instance matrix: a one-metre model stretched along x stretches its end plates, pins, weld, bevels and texture with it.
Share one kind between every member of the same section and joint: members of one kind batch into one draw a level (the engine’s 10,000-member two-profile lattice submits six draws near and two far).
Leave room for the hardware in the node trim.
Choose a vertical member’s frame from the horizontal parts of its direction: normalising a perfectly vertical post can round its y just under one and give a zero cross product (beamFrame does this).
9 more in brief
Size a gusset from its seats in the plane most members share.
Re-solve only what an edit touches: add and remove rebuild the connected components of the two edited ends (the engine measured 0.038 ms to add and 0.042 ms to remove a member in a 2,000-member lattice, against 16.8 ms to solve it whole).
Keep the pin, weld, plate, bevel and texture scale in metres, sized from the section (beamHardware: thickness 0.12, bolt radius 0.1, bead 0.11 of the smaller side), and cap the material’s relief by the thinnest part (the renderer passes a relief cap a tenth of it), or parallax pours over a thin flange.
Never let a joint open with distance.
The weld bead in the engine was a flat frustum lip round the end, which read as a painted outline.
The lapped end in the engine was two plates stacked off one side, with no fasteners: it read as two loose cards.
Size hardware from the section’s smaller side, but not from less than 0.4 of its larger side (BEAM_MIN_SIDE_SHARE, library): the engine sized a 100 × 16 mm flat bar’s joints from its 16 mm, giving 1.6 mm bolts and a fin hidden inside the bar.
Draw a growing or dragged member outside the solver and add it when it lands: a member added at once re-cuts its nodes and plates before it arrives.
One device, two hosts: the demo draws In use into sky-atmosphere’s host (HDR, reverse-Z, group 0 with the sky) and Alone into the module’s own host (an sRGB canvas, 4× multisampling, a plain light).
14 pitfalls in full, the hook-up guide, the module source and its tests come with the part.
Where it comes from
From HaTac. Adapted from published work, named below.
Hannes Andersson: The HaTac engine’s free beams, node solver, shape builder and decisions (built for his game and proven there); the library’s host, changes and demo.
A. M. Andrew, “Another efficient algorithm for convex hulls in two dimensions” (1979): The monotone-chain hull the solver fits each gusset plate with (solver.ts).