Creative Coding

A Solid Modeling IDE That Puts the Distance Field in Front of You Instead of Hiding It

Matt Keeter's Halfspace shows the SDF itself, which turns a class of invisible shading bug into something you can see — and it rasterises entirely on the GPU through fidget-wgpu.

Matt Keeter has released Halfspace, an experimental IDE for solid modeling with distance fields. It is a GUI wrapped around his Fidget geometry kernel, which handles rasterisation and meshing. Models are built from predefined primitives and hand-written scripts, then exported as images or triangle meshes. There is a browser demo, best run on a desktop with WebGPU support.

Keeter’s own talk on implicit surfaces and the research behind this line of work.

The design decision that makes it worth writing about

Most tools built on signed distance fields hide the field. You get constructive solid geometry operations — union, intersection, difference, offset — and the arithmetic underneath is an implementation detail you are not meant to look at.

Halfspace puts the distance fields in the foreground.

Keeter’s own demonstration of why is the clearest possible argument. He shows two sawtooth fields with identical signs everywhere but different values. Identical signs means identical shapes — the surface is where the sign changes, so if the signs match everywhere, the two fields describe the same solid.

They do not behave the same. One has a jump discontinuity at the vertical edge. Fidget computes normals by automatic differentiation of the field, and a discontinuity has no meaningful derivative, so the normals come out wrong — and wrong normals produce wrong shading in 3D.

That is a nasty bug. The geometry is correct. The mesh is correct. The silhouette is correct. The only symptom is that the surface is lit incorrectly, and nothing in the shape itself gives you a clue why. Debugging it by looking at the render is close to hopeless.

Seeing the field makes that kind of bug easy to spot. The discontinuity is visible as a discontinuity.

Why this generalises past solid modeling

The principle is worth separating from the specific tool, because it applies to a lot of creative-coding work.

An SDF is not a shape; it is a function that happens to encode a shape at its zero crossing. Everything else you do with an SDF — normals, ambient occlusion, soft shadows, sphere tracing step sizes, offsets, blends, thickness — reads the field’s values, not just its sign. So two fields that describe the same object can behave completely differently under every operation except the one that finds the surface.

This is the reason the SDF literature insists on exact distance functions and treats a “bound” as a lesser thing. Most people writing shaders learn this empirically: you combine two primitives with a min(), the shape looks right, and then your ray marcher gets slow or your normals go strange near the join, and nobody tells you that min() of two exact distances is not an exact distance.

A tool that shows you the field is a tool that lets you learn this by looking instead of by suffering. That is a teaching affordance as much as a debugging one.

The GPU work underneath

Halfspace drove work on fidget-wgpu. CPU rasterisation was too slow through WebAssembly, so rasterisation and post-processing now run entirely on the GPU with no round trips to the CPU.

That is the right diagnosis and the right fix. SDF rasterisation is an embarrassingly parallel problem — every pixel evaluates the same function at a different point — and it is exactly what a GPU is for. The WebAssembly detail is the interesting constraint: WASM is fast for a browser but it is still a single-threaded-ish CPU path, and evaluating a nontrivial field a million times per frame is not something you do there.

“No hits to the CPU” is the phrase to notice. Moving work to the GPU is easy; moving it there without a readback stall is the part that determines whether the thing feels interactive.

Provenance, stated plainly

Keeter has worked on it since April 2025 and notes it is not vibe-coded. It is open source under MPLv2.

That disclaimer is appearing more often — the Cinnamon GameMaker runner carried a similar line this week — and it is doing real work in both cases. Geometry kernels and automatic differentiation over implicit surfaces are domains where a plausible-looking implementation and a correct one are hard to tell apart from the outside, and where the bugs are of exactly the kind this tool exists to surface. Eighteen months of one person’s attention is the relevant credential, and saying so is faster than proving it.