Three faults, one of them mine and one that had been there from the start. The braces were the change this session declined and that reached the repo anyway, in 715d6af: moved outboard of the uprights, where they connect to nothing and read as broken sticks. Reverting them was not enough, because the version they replaced was also wrong -- a single diagonal tilted about Z, in the same plane as the bell, which had to be shoved in front of it and drew a line straight across the one silhouette in this model that has to read cleanly. Neither is what a bell frame does. A real frame is two A-frames, one at each end of the beam, braced fore-and-aft in their own planes, with the bell swinging in the gap. Tilting about X instead of Z puts them there and the bell is never in the way. The uprights stood at beamLength * 0.34, which at the default yoke is 0.165 against a bell radius of 0.18. With their half-width they spanned 0.147 to 0.183 and ran through the mouth of the bell. Nothing objected: the support test sees one connected mass, which is precisely what a post driven through a bell looks like. They now stand at the larger of the yoke's reach and the bell's radius plus a margin, so a short yoke cannot close the frame onto the bell -- and the beam's span is derived from that rather than from the yoke alone, because decoupling the two first left the rail too short to reach the uprights at the bottom of the slider and the two A-frames came apart into separate objects. The foot sat height * 0.16 below the mouth, leaving 24 mm between sill and lip. A bell hangs clear of its sill; at that gap it read as resting on one. Colour last. The bell was painted from the `brass` entry and rendered at hue 39 / saturation 0.56 / value 0.56, against a reference at 33 / 0.34 / 0.33. That is not a subtle disagreement and, unlike the hay bale, the measurement can be trusted here: a bale photographs desaturated because it is thousands of straws shadowing each other, while a cast bell is a smooth surface, so the number is the material rather than the texture. A separate `bronze` palette entry, derived by inverting the renderer's own gain, brings it to 30 / 0.31 / 0.43. It is a palette entry and not a slot -- the mesh still resolves through `brass` -- so the coin pouch and the book's corner fittings, where fresh yellow bronze is right, are untouched. 27 models, 18457 triangles, all checks pass, 0 floating cases, build clean. |
||
|---|---|---|
| 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 ~500 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.
Four 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.
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.
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
render.ts offline software rasteriser → PNG contact sheet
export-glb.ts batch GLB export
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.