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
Toolpath

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 that is a set of offset contours of the pocket: the level sets of its distance field at the tool's radius and at every stepover beyond it.

So one distance field is the whole CAM job. The bright part of the clip is the pocket, and 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 you'd recognise from a real machine comes out of that. Inside corners keep a fillet of exactly the tool's radius. A slot narrower than the tool never gets entered. A stepover wider than the tool leaves ridges of stock between the passes. And a big pocket takes longer to clear than a small one.

Latch grabs the clip once and machines it, and 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 the result.

  • 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 early days. It hasn't been loaded into Resolume on macOS yet. On Windows it has: a build loads, registers and renders in Resolume Arena 7.27.1 on software rendering (no GPU), with every parameter as declared; some controls couldn't be seen moving at the check's thumbnail size, and which ones varied from run to run. An offline harness driving the real plugin checks the machining: the distance field is exact to 6 ULP on rectilinear shapes and within 0.58 px at 720p on curved ones, a square pocket's inside corners keep a fillet of 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 of the predicted width to within 0.15 px, and the tool covers exactly Feed pixels of path a second at 60 and at 30 fps. It catches eight models that are wrong on purpose and a one-character sabotage of its own shader, and all 25 swept controls change the picture. On macOS at the defaults it costs 0.16 ms a frame at 4K in Latch and 9.0 ms in Live. There's a user guide and a browser demo (a port, not the plugin), but no presets and no OpenFX port. Try it in your own rig before you trust it in a show.

Watch it running

Toolpath video thumbnail

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