Procedural field contract · CPU + TSL + optional TypeGPU

The field you draw is the field you can touch.

Let CPU collision, buoyancy, forces, and hit tests query procedural fields that Three.js materializes on the GPU—then measure the remaining float drift instead of asserting equality.

  • MIT
  • zero-dependency core
  • cross-runtime CI
  • public preview
Live 3D terrain instrument / dunesField sampling…

Drag or use arrow keys to move the probe.

Drift contrast shows the absolute f64 ↔ f32 difference. Color is normalized to this sampled map and square-root stretched so tiny differences are visible; the readout remains the actual difference in field units.

CPU / f64
—
Assay / f32
—
Absolute drift
—

The split-world problem

GPU 3D displacement is invisible to CPU gameplay.

CPU physics, AI, servers, and hit tests cannot sample the vertex shader shaping a 3D world. Copying procedural math into JavaScript and shader code creates two authorities that can drift.

Matter Field makes the pure function authoritative and treats each native adapter backend as a materialization of it. The optional TypeGPU lane is a separately assayed port.

Field contract

Write the field, not its copies.

terrain.jsone field
export function terrain(A, x, z) {
  const n = fbm(A, x, z, 0.0016, 2);
  return A.mul(
    A.sub(n, A.f(0.5)),
    A.f(24)
  );
}
F64
numberAdapter

CPU oracle

Collision, AI, Workers, and Node servers evaluate the authoritative ECMAScript f64 tree.

TSL
makeTslAdapter

Native GPU graph

The zero-dependency core accepts the caller’s three/tsl namespace and preserves one adapter-authored tree.

∂
dualAdapter

Analytic gradients

Dual numbers derive normals and tangents from the exact same expression tree.

TGPU
matter-field/typegpu

TypeGPU materialization

An optional, separately authored WebGPU port is precompiled for TypeGPU and @typegpu/three, then checked against the canonical fields.

Measured, not asserted

Current hardware receipts

Absolute error in field units decides pass/fail. ULP counts remain diagnostic because they explode near zero crossings.

Recorded parity results by graphics hardware and browser backend
HardwareBackendMax observed absMax ULPu32 hashStatus

The honest contract

Three contract levels, no stronger.

  1. Tier 1

    CPU ↔ CPU

    tested bit-exact

    One committed golden agrees in browser, Worker, and supported Node CI.

  2. Tier 2

    Integer hash

    observed bit-exact

    Eleven raw u32 vectors agree in the current hardware receipts.

  3. Tier 3

    Float tree

    measured per field

    Restricted f32 operations tested against a declared absolute field-unit budget on each receipt.

Open measurement

Bring a GPU.
Add a receipt.

The parity claim gets stronger through public measurement, not louder marketing. Run the assay, inspect the JSON, and contribute a missing vendor cell.

Run on this hardware