The showcase is the one deliverable a still render cannot check, and until now the only way to check it was to watch it -- which is how a model half out of frame gets shipped. `__probe.framing()` projects the current model's bounding box into the frame and reports the worst corner in normalised device coordinates: 0 is comfortably inside, 1 is exactly on the edge. The whole 60 seconds can then be swept and the bad moments found by number. Swept, it found five models leaving the frame. Four of them were during the dip between beats, where the veil is 92% opaque and the point is that you cannot see the swap -- so the honest figure is two frames out of 1060, the broom and the ladder, each for a twentieth of a second. Not much. Also not nothing, when the whole point of the tour is that someone records it once and posts it. The first fix was to widen the framing margin from 1.55 to 1.62. It worked and it was the wrong fix: it took a slice of the frame off all thirty-five models to buy back two frames from one, and mean fill fell to 0.515 -- every model sitting in half a screen of empty space. The right fix is in the chase. The camera's distance follows the model's size by exponential approach at a single rate, and the two directions are not the same mistake: falling behind a model that is GROWING crops it, and falling behind one that is shrinking only leaves it small for a moment, which nobody notices. The broom was the last offender because its bundle and its handle both sweep. So the camera now retreats at 18 and closes at 7, and with that in place the margin came back in past where it started, to 1.38. Measured over the visible frames of a full 60 s run: no frame crops, the closest any model comes to the edge is 0.81, and mean fill is 0.605 against 0.515 for the wide-margin version and 0.55 for the original. Models are bigger in frame than before AND nothing is cut. Also here: the tour verified end to end -- 1201 frames, 60.05 s, 35 models, no repeats, chest to oak -- and two stale numbers in the README. It claimed ~800 checks (1,044) and did its showcase arithmetic for 27 models, which is the kind of sentence that goes quietly wrong every time a model is added, so it now says what the number does when the kit grows. One correction to my own measurements, twice over. `showcase.update` clamps its delta to 0.05 internally, which `frameStep` does not, so stepping 0.2 advances 0.05 -- my first two readings of the tour's length were wrong by 4x and 10x and disagreed with each other, which is what gave it away. And the run that reported 34 models in 57.8 s was racing a page reload, not a dropped model. |
||
|---|---|---|
| media | ||
| my-registry | ||
| scripts | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| bun.lock | ||
| index.html | ||
| LICENSE | ||
| models.json | ||
| models.lock.json | ||
| package.json | ||
| README.md | ||
| REFERENCE.md | ||
| tsconfig.json | ||
| viewer.html | ||
| vite.config.ts | ||
| vite.viewer.config.ts | ||
medieval-kit
A lowpoly medieval model library for Vibe3D, plus the viewer used to build it.
Vibe3D is a source-first model registry for Three.js: you install the TypeScript that generates a model into your own project rather than depending on an opaque package. This repository holds one such registry.
my-registry/— the@medieval-kitregistry, published to npm as@medieval-kit/registry.src/— a demo app that installs from both@medieval-kitand the first-party@scifi-kit, so the two can be inspected side by side.
Run the viewer
Requires Bun and a browser with WebGPU (the @scifi-kit model
in the demo uses TSL node materials; the medieval kit itself does not).
bun install
bun run registry:build
bun run dev
Open /viewer.html for the model inspector: registry-grouped catalogue, live
triangle counts, configuration sliders wired to configure(), a wireframe
overlay, and per-model GLB download.
Use the kit in your own project
bunx vibe3d init
bunx vibe3d add @medieval-kit/wooden-barrel
See my-registry/README.md for the model list,
configuration fields, and runtime contract.
Export to GLB
bun run export:glb # every model into glb/
bun scripts/export-glb.ts --one wooden-chest
The viewer's download button and this command share one implementation
(src/glb.ts), so they produce byte-identical files. Colour travels as
COLOR_0 vertex data and baseColorFactor stays white — the files carry no
textures at all.
Verify
bun run typecheck
bun run verify # geometry, protocol, metadata, actions
bun run verify:glb # export every model, read it back, compare
bun run render # renders/_sheet.png — actually look at the models
verify runs 1,044 browser-free checks against the installed sources: geometry
validity, winding, coplanar-face (z-fighting) detection, bounding-box limits,
stable root and anchor identity across configure(), deterministic seeding,
material ownership, idempotent disposal, action semantics, and agreement
between each model and its published metadata.
Five of those deserve a note, because each was written after a real bug:
- Winding is checked three ways, because no single measure is sufficient.
Bodies of revolution use radial alignment — every radial face on the outer
shell must point away from the axis, measured in height bands. Closed solids
use signed volume:
Σ a·(b×c)/6is positive only when the winding faces outward. And edge balance catches a single flipped face, which signed volume misses — flipping one face took the volume from 0.058 to 0.039, still positive. - Z-fighting is checked by looking for triangles that share a plane, share a normal direction, and overlap in area. Edge contact between neighbouring boards is fine and is not flagged; genuine coplanar overlap is.
- Metadata agreement verifies that every declared control key is a real
config field, that declared part names match the model's actual parts, and —
most importantly — that no mesh uses an undeclared material slot. A missing
declaration is a material the consumer cannot reach through
materials.override(). This check found real drift in four models the day it was added: asteelslot had been used but never declared. - Frame-rate independence for animated models: the same elapsed time is stepped at two different frame rates and the results must agree. A naive lerp fails this.
- Nothing floats. Every check above asks about surfaces, and none of them
can see a piece of a model hanging in the air with nothing under it — a chest
lid separated from its chest passed all of them.
scripts/support.tsvoxelises the model, finds the connected components of occupied space, and requires each one to reach the floor.scripts/audit.tsruns that across the default, both slider extremes, both ends of a sweep, every action and the midpoint of a morph, because a variation must not break what the default gets right. It began at 22 failing cases: the bell and the sign had no supporting structure at all, the lantern was in four pieces, and the ladder's rungs were sized by a formula that disagreed with where its rails actually were.
Every check was mutation-tested: sabotage the code, confirm the check fails, restore, confirm it passes. A passing test is not evidence that it works.
render closed the one gap all of the above left open. Every check was
geometric — triangle counts, winding, coplanarity, bounds. All of them caught
real bugs, and none of them could say "this shovel does not look like a shovel."
The renderer is a small software rasteriser: no browser, no GPU. The shovel was
rewritten a fourth time, the hoe a third and the hay bale a second because of
what those PNGs showed.
Showcase
The viewer can play itself. A tour orbits the whole catalogue on one continuous camera move, morphing each model's parameters as it goes, with the interface hidden so the frame is clean enough to record.
viewer.html?showcase=60 # 30, 60 and 90 are offered
60 s is the default, and the reason is arithmetic: the tour splits its running time equally between the models, so across 35 of them a 30 s run gives each 0.86 seconds — a flyby, not a demonstration — while 60 s gives 1.7 s and 90 s gives 2.6 s.
That first number moves every time a model is added, which is worth saying out loud rather than leaving as a stale sentence in a README: at 27 models, 60 s was a comfortable 2.2 s each. It is now 1.7 s, and 90 s is there for anyone who wants the older pace back.
Two things make the variation visible rather than merely present. Continuous controls travel the whole usable band every beat instead of two random draws inside it. And every beat is split in half so that the integer controls — stave count, plank count, spokes, rows, tines — can change at the midpoint, where the same dip that hides a model swap hides the rebuild. Those are the parameters a viewer actually notices, and morphing cannot interpolate them, so before the split they were pinned for the whole beat and the tour looked static.
Layout
my-registry/
models/core/ shared palette, RNG, geometry vocabulary, part slots
models/<model-id>/ one procedural model per folder
meta.ts single source for catalogue metadata
build.ts compiles models/ into dist/registry.json
drafts/ kept in the tree, kept out of the build
src/
lib/vibe3d/ Vibe3D contracts installed by `vibe3d init`
models/ installed model source (owned, editable)
viewer.ts the model inspector
glb.ts GLB export, shared by the viewer and the CLI
catalog.ts viewer catalogue, derived from meta.ts
scripts/
verify-model.ts browser-free conformance checks
verify-glb.ts export/re-import round trip
zfight.ts coplanar overlap detection
support.ts voxel connectivity — nothing may float
audit.ts runs the support check across every configuration
render.ts offline software rasteriser → PNG contact sheet
reference-shots.ts one photographic reference per model, for comparison
probe-tree.ts measures the oak against its reference photographs
catalog-table.ts regenerates the model table in the registry README
export-glb.ts batch GLB export
media/ images used by this README
models.json which registries this project resolves
models.lock.json install receipt; `vibe3d diff` compares against it
src/models/ is generated by vibe3d add but committed on purpose: it is the
demo's own source, and keeping it in the tree is what makes vibe3d diff
meaningful.
Released under the MIT License.
