Stoatworks Labs

Toolpath

CNC pocketing from a distance field, for Resolume

Betav0.1.0Plugin & ModuleC++ / GLSL
Toolpath — CNC pocketing from a distance field, for Resolume
No screenshot — this one is configuration inside another application.

What it does

An FFGL effect for Resolume Arena and Avenue. A CNC router clears a pocket with a round tool. The tool's centre can only go where the whole disc fits, and what it removes is everywhere the disc has been. The path that does it is a set of offset contours of the pocket, the level sets of its distance field at the tool's radius and every stepover beyond it.

So one distance field is the whole CAM job. The bright part of the clip is the pocket; its field comes from jump flooding on the GPU, on a lattice of two pixels a texel; the offset levels are traced into ordered paths; and a tool runs along them at Feed, stamping its disc into a cut buffer that persists. The cut buffer is the part.

Everything recognisable falls out of that. Inside corners keep a fillet of exactly the tool's radius. A slot narrower than the tool is never entered. A stepover wider than the tool leaves ridges of stock between the passes. A big pocket takes longer to clear than a small one.

Latch grabs the clip once and machines it; Live follows the clip and re-cuts every frame. Reveal, Engrave, Paths (the CAM preview) and Field (a glow, bevel or outline at a distance, from the same field) are four ways of showing it.

  • A jump-flooded distance field, checked against an exact Euclidean distance transform
  • Offset pocketing passes, Outside In or Inside Out, with a round tool at a feed rate
  • Fillets, uncut narrow slots and scallops fall out of the geometry
  • Latch (machine one grab) or Live (re-cut every frame)
  • Reveal, Engrave, Paths and Field render modes
  • Detect On Luma, Alpha, Chroma or Luma or Alpha, with Threshold, Invert and Smooth
  • Universal macOS bundle and a Windows x64 DLL

Where it stands

v0.1.0, and honestly early. The machining is measured, not asserted, by an offline harness that drives the real plugin class headlessly at two rasters: the distance field is exact to 6 ULP on rectilinear shapes and within 0.58 px at 720p on curved ones, against a bound of √2 texels; a square pocket's inside corners keep a fillet of radius 36.002 px for a 36 px tool; a slot 2 px narrower than the tool is never entered and one 5 px wider is cut end to end; a stepover past the tool's diameter leaves ridges s − 2r wide to within 0.15 px; and the tool covers exactly Feed pixels of path a second at 60 and at 30 fps. Eight negative controls and a one-character mutation of the shipped shader are caught. All 25 swept controls change the picture. Render cost on macOS at the defaults is 0.16 ms/frame at 4K in Latch and 9.0 ms in Live. It has not yet been loaded into Resolume on macOS. On Windows it has: a build of this source loads, registers and renders in Resolume Arena 7.27.1 on software rendering (win-lab, no GPU), with every parameter as declared; some controls could not be shown moving at the gate's thumbnail size, and which ones varied from run to run. There is a user guide and a browser demo, which is a port rather than the plugin; no presets and no OpenFX port. Check it in your own rig before trusting it in a show.

Watch it running

Toolpath video thumbnail

Nothing loads from YouTube until you press play.Watch it there instead