Metaballs

Interactive implicit blobs: field samples at known points, and a golden render of a fixture set of balls.

This is an interactive visual spec on Spekkr, published by nova. It is listed with the other specs. Paste the line to an agent that can open a web address, and the agent fetches the files and builds from them.

Spec
nova/metaballs
Version
0.2.2
Published by
nova
Updated
15 Nov 2026

Build this spec

Build the spec at https://spekkr.com/nova/metaballs/start.md.

Paste this to your AI agent. It opens the address, fetches the spec's files, records your choices and builds from them. Nothing to install, no account.

Published by nova.

What does the result look like?

Metaballs: heroMetaballs: loop

What can I customize?

Falloff How a ball contributes to the field.

Your choices go into the line you copy. Anything else is yours to edit, but it leaves the tested path.

What do I get?

  • spec.md Requirements and acceptance checks.

    Metaballs

    What this builds

    A playground of metaballs: implicit surfaces from a sum of radial fields, shaded in real time. The person can drag balls, change the threshold, and switch the falloff. Tests sample the field at known points and compare a render of a fixture set to a golden. The look is original.

    Read spekkr.inputs.json first. title is in a corner. threshold is the iso-value. field is the falloff. normals and grid change the picture.

    Out of scope

    • A general SDF modeller (that is a later, different spec).
    • Network or a gallery in the checks.
    • A physically based material library in this version.

    Requirements

    Each requirement has an id. Checks name the id they cover.

    R1. The field
    • For inverse-square, a ball of radius r at the origin contributes (r*r) / (x*x+y*y+z*z + 1e-8) at a point, and the field is the sum.
    • For gaussian, the contribution is exp(-|x|² / (2 r²)).
    • Samples in fixtures/metaball-samples.json match within 1e-5, at threshold unused (these are raw field values).

    Accept when: every listed sample matches for both falloffs.

    R2. The surface and a fixture set
    • The surface is the iso-value threshold. A ray or a mesh extract may be used, but a field sample just inside and just outside a documented point on the surface must be above and below the threshold.
    • fixtures/metaball-set.json is a set of five balls. Its render, at threshold 1.0, inverse-square, lit, matches the fixture-set golden.
    • Two balls of radius 1, centres 1.2 apart, merge at threshold 1.0; centres 3.0 apart do not. The inside/outside samples in the file confirm this.

    Accept when: the inside/outside samples pass, and the fixture-set render matches the golden.

    R3. Frames and files
    • Goldens: two balls apart, two balls merged, the five-ball fixture, and a flat-colour (normals off) view of the fixture.
    • One command runs the samples, the merge checks, and writes the frames. No network.

    Accept when: the command passes for both falloffs (each has a sibling golden for the fixture, or a documented skip of the image check if only samples are required for gaussian).

    R4. Inputs
    • The build reads spekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices.
    • A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key.

    Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check.

    Verification

    Field samples at known points match a file within 1e-5 for both falloffs. A fixture set of balls renders to a golden. A documented merge and a documented apart case are confirmed by inside/outside samples. No network.

    Definition of done

    • Every acceptance check above runs from one command, and all pass at the person's inputs.
    • A README says how to drag a ball, how to change the falloff, and how to run the checks.
    # Metaballs
    
    ## What this builds
    
    A playground of metaballs: implicit surfaces from a sum of radial fields,
    shaded in real time. The person can drag balls, change the threshold, and
    switch the falloff. Tests sample the field at known points and compare a
    render of a fixture set to a golden. The look is original.
    
    Read `spekkr.inputs.json` first. `title` is in a corner. `threshold` is
    the iso-value. `field` is the falloff. `normals` and `grid` change the
    picture.
    
    ## Out of scope
    
    - A general SDF modeller (that is a later, different spec).
    - Network or a gallery in the checks.
    - A physically based material library in this version.
    
    ## Requirements
    
    Each requirement has an id. Checks name the id they cover.
    
    ### R1. The field
    
    - For `inverse-square`, a ball of radius r at the origin contributes `
      (r*r) / (x*x+y*y+z*z + 1e-8) ` at a point, and the field is the sum.
    - For `gaussian`, the contribution is `exp(-|x|² / (2 r²))`.
    - Samples in `fixtures/metaball-samples.json` match within 1e-5, at
      threshold unused (these are raw field values).
    
    Accept when: every listed sample matches for both falloffs.
    
    ### R2. The surface and a fixture set
    
    - The surface is the iso-value `threshold`. A ray or a mesh extract may be
      used, but a field sample just inside and just outside a documented point
      on the surface must be above and below the threshold.
    - `fixtures/metaball-set.json` is a set of five balls. Its render, at
      threshold 1.0, inverse-square, lit, matches the `fixture-set` golden.
    - Two balls of radius 1, centres 1.2 apart, merge at threshold 1.0;
      centres 3.0 apart do not. The inside/outside samples in the file confirm
      this.
    
    Accept when: the inside/outside samples pass, and the fixture-set render
    matches the golden.
    
    ### R3. Frames and files
    
    - Goldens: two balls apart, two balls merged, the five-ball fixture, and a
      flat-colour (normals off) view of the fixture.
    - One command runs the samples, the merge checks, and writes the frames.
      No network.
    
    Accept when: the command passes for both falloffs (each has a sibling
    golden for the fixture, or a documented skip of the image check if only
    samples are required for gaussian).
    
    ### R4. Inputs
    
    - The build reads `spekkr.inputs.json`. Settings label the UI, options
      turn features on or off, and a swap must be one of its choices.
    - A value outside a stated range, or a swap that is not one of its
      choices, is refused before the app starts its checks, with a message
      that names the key.
    
    Accept when: the default inputs render, an illegal swap is refused by
    name, and changing a visible setting (for example the title) shows up in a
    later check.
    
    ## Verification
    
    Field samples at known points match a file within 1e-5 for both falloffs.
    A fixture set of balls renders to a golden. A documented merge and a
    documented apart case are confirmed by inside/outside samples. No network.
    
    ## Definition of done
    
    - Every acceptance check above runs from one command, and all pass at the
      person's inputs.
    - A README says how to drag a ball, how to change the falloff, and how to
      run the checks.
    

    Open spec.md as plain text

  • design.md Falloff formulas, field samples, and the fixture ball set.

    Design

    This file fixes the parts that are easy to get wrong. The language and tools are up to you, as long as the numbers here hold.

    Samples

    Points and expected field values are the file. Include: a point at a ball's centre, a point at distance r, a point far away, and a mid-point between the merge and the apart cases.

    Screenshot tolerance

    8 levels, 98% of pixels, 1600 by 1000, camera in fixtures/metaball-camera.json.

    Inputs

    KeyLabelDefaultNotes
    titleTitleA few soft bodiesShown in a corner.
    thresholdThreshold1.0The iso-value of the surface, from 0.4 to 2.0.
    normalsLit surfaceonIf off, a flat colour is used.
    gridShow the field gridoffA faint grid, useful in tests.
    fieldFalloffinverse-squareHow a ball contributes to the field.

    Acceptance at the defaults

    The numbers, names and fixture paths already in this file are the authority. Where a later table or a shipped fixture file disagrees with prose, the table or the fixture wins.

    FixtureRole
    fixtures/metaball-camera.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    fixtures/metaball-samples.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    fixtures/metaball-set.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    spekkr.inputs.jsonA shipped fixture. The build may move it, but then design.md must name the new path.

    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement names another size. Tolerance, unless a tighter figure is given above: 8 levels, 98% of pixels, with motion, cursors and clocks frozen as this file says. A build's goldens are of that build; they do not have to match a shipped reference preview pixel-for-pixel if the tool or the type is different, but they do have to match this file's layout, counts and copy.

    Screenshots

    These pictures are headless-Chrome captures of the working reference in reference/preview.html, at the default inputs. They are not drawings of a product that has not been built. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel.

    FileWhat it shows
    shots/field.pngA golden render of the fixture soft bodies at threshold 1.0.

    How to verify

    1. Run the checks at the default inputs, without a network.
    2. Walk through the scripted playthroughs, fixture lookups or goldens named in the requirements; each must match this file.
    3. Repeat once at the person's inputs when they differ from the defaults.
    4. Field samples at known points match a file within 1e-5 for both falloffs. A fixture set of balls renders to a golden. A documented merge and a documented apart case are confirmed by inside/outside samples. No network.
    # Design
    
    This file fixes the parts that are easy to get wrong. The language and
    tools are up to you, as long as the numbers here hold.
    
    ## Samples
    
    Points and expected field values are the file. Include: a point at a
    ball's centre, a point at distance r, a point far away, and a mid-point
    between the merge and the apart cases.
    
    ## Screenshot tolerance
    
    8 levels, 98% of pixels, 1600 by 1000, camera in
    `fixtures/metaball-camera.json`.
    
    ## Inputs
    
    | Key | Label | Default | Notes |
    | --- | --- | --- | --- |
    | `title` | Title | A few soft bodies | Shown in a corner. |
    | `threshold` | Threshold | 1.0 | The iso-value of the surface, from 0.4 to 2.0. |
    | `normals` | Lit surface | on | If off, a flat colour is used. |
    | `grid` | Show the field grid | off | A faint grid, useful in tests. |
    | `field` | Falloff | inverse-square | How a ball contributes to the field. |
    
    ## Acceptance at the defaults
    
    The numbers, names and fixture paths already in this file are the
    authority. Where a later table or a shipped fixture file disagrees with
    prose, the table or the fixture wins.
    
    | Fixture | Role |
    | --- | --- |
    | `fixtures/metaball-camera.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `fixtures/metaball-samples.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `fixtures/metaball-set.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `spekkr.inputs.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    
    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement
    names another size. Tolerance, unless a tighter figure is given above: 8
    levels, 98% of pixels, with motion, cursors and clocks frozen as this file
    says. A build's goldens are of that build; they do not have to match a
    shipped reference preview pixel-for-pixel if the tool or the type is
    different, but they do have to match this file's layout, counts and copy.
    
    ## Screenshots
    
    These pictures are headless-Chrome captures of the working reference in
    `reference/preview.html`, at the default inputs. They are not drawings of a
    product that has not been built. The first picture is the one Spekkr shows on
    the spec's card. A build may ship its own goldens; those goldens are of that
    build and do not have to match these frames pixel-for-pixel.
    
    | File | What it shows |
    | --- | --- |
    | `shots/field.png` | A golden render of the fixture soft bodies at threshold 1.0. |
    
    
    ## How to verify
    
    1. Run the checks at the default inputs, without a network.
    
    2. Walk through the scripted playthroughs, fixture lookups or goldens
    named in the requirements; each must match this file.
    
    3. Repeat once at the person's inputs when they differ from the defaults.
    
    4. Field samples at known points match a file within 1e-5 for both
    falloffs. A fixture set of balls renders to a golden. A documented merge
    and a documented apart case are confirmed by inside/outside samples. No
    network.
    

    Open design.md as plain text

  • tasks.md Build tasks in order, each with a check.

    Tasks

    Work in order. Finish a task's check before starting the next.

    1. Set up. Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read spekkr.inputs.json first. Check: a blank or heading page loads, and an empty test run passes.
    2. The field (R1). Build what R1. The field asks for, to the numbers in design.md. In particular: For inverse-square, a ball of radius r at the origin contributes (r*r) / (x*x+y*y+z*z + 1e-8) at a point, and the field is the sum. Check: the R1. The field acceptance checks pass.
    3. The surface and a fixture set (R2). Build what R2. The surface and a fixture set asks for, to the numbers in design.md. In particular: The surface is the iso-value threshold. A ray or a mesh extract may be used, but a field sample just inside and just outside a documented point on the surface must be above and below the threshold. Check: the R2. The surface and a fixture set acceptance checks pass.
    4. Frames and files (R3). Build what R3. Frames and files asks for, to the numbers in design.md. In particular: Goldens: two balls apart, two balls merged, the five-ball fixture, and a flat-colour (normals off) view of the fixture. Check: the R3. Frames and files acceptance checks pass.
    5. Inputs (R4). Build what R4. Inputs asks for, to the numbers in design.md. In particular: The build reads spekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices. Check: the R4. Inputs acceptance checks pass.
    6. Goldens. Capture the frames named in design.md at the defaults, with motion frozen where the file says so. Compare them within the stated tolerance. Check: the frames match, and a pixel-level check fails if a documented element is removed on purpose.
    7. Finish. Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in spec.md is true.
    # Tasks
    
    Work in order. Finish a task's check before starting the next.
    
    1. **Set up.** Set up a web app (or the stack you have chosen) and a test
    runner that can open a page, click, and compare screenshots. Read
    `spekkr.inputs.json` first.
       Check: a blank or heading page loads, and an empty test run passes.
    
    2. **The field (R1).** Build what `R1. The field` asks for, to the numbers
    in `design.md`. In particular: For `inverse-square`, a ball of radius r at
    the origin contributes ` (r*r) / (x*x+y*y+z*z + 1e-8) ` at a point, and
    the field is the sum.
       Check: the `R1. The field` acceptance checks pass.
    
    3. **The surface and a fixture set (R2).** Build what `R2. The surface and
    a fixture set` asks for, to the numbers in `design.md`. In particular: The
    surface is the iso-value `threshold`. A ray or a mesh extract may be used,
    but a field sample just inside and just outside a documented point on the
    surface must be above and below the threshold.
       Check: the `R2. The surface and a fixture set` acceptance checks pass.
    
    4. **Frames and files (R3).** Build what `R3. Frames and files` asks for,
    to the numbers in `design.md`. In particular: Goldens: two balls apart,
    two balls merged, the five-ball fixture, and a flat-colour (normals off)
    view of the fixture.
       Check: the `R3. Frames and files` acceptance checks pass.
    
    5. **Inputs (R4).** Build what `R4. Inputs` asks for, to the numbers in
    `design.md`. In particular: The build reads `spekkr.inputs.json`. Settings
    label the UI, options turn features on or off, and a swap must be one of
    its choices.
       Check: the `R4. Inputs` acceptance checks pass.
    
    6. **Goldens.** Capture the frames named in `design.md` at the defaults,
    with motion frozen where the file says so. Compare them within the stated
    tolerance.
       Check: the frames match, and a pixel-level check fails if a documented
    element is removed on purpose.
    
    7. **Finish.** Write a README that says how to install what is needed, how
    to change the inputs, and how to run the checks. Run the one command from
    a clean folder.
       Check: every item under Definition of done in `spec.md` is true.
    

    Open tasks.md as plain text

  • reference/preview.html A working reference preview of the default view, used to make the listing pictures. A build does not have to start from this file.
  • reference/fonts/fonts.css Webfont faces for the reference preview.
  • reference/fonts/Geist.ttf Geist variable typeface for the reference preview.
  • reference/fonts/Fraunces.ttf Fraunces variable typeface for the reference preview.
  • reference/fonts/Fraunces-Italic.ttf Fraunces italic variable typeface for the reference preview.

Is it for me?

Platforms
web
Tools
TypeScript, WebGL

What does it need?

Agent permissions
shell
Commands it runs
install a test runner install a tool that compares screenshots

What changed?

  • 0.2.215 Nov 2026Names what it builds.
  • 0.2.114 Nov 2026Add animated loop to the listing shots.
  • 0.2.014 Nov 2026Polished reference preview and new listing shots, including a short loop.
  • 0.1.014 Nov 2026First version.

For agents: start.md says how to build this spec, spec.json holds everything on this page, and bundle.tar.gz holds its files.