A village well: a drystone kerb, a timber frame over it, a windlass with its collars and crank, and a rope and bucket that lower down the shaft. `setDepth` and `setWinding` drive the bucket; its part origin is the roller's axis, so winding is a translation and costs nothing per frame. The kit had no masonry at all, which for a medieval catalogue is a hole rather than an omission -- a well, a trough, a millstone, a boundary wall and a hearth are all stone before they are anything else. `stone` is the twelfth slot. Its colour sits close to weathered oak on purpose: what separates the two at a glance is not hue but that stone scatters light completely flat, and roughness is not something vertex colour can carry, which is exactly the argument the slot table makes for keeping iron and steel apart. Four faults on the way in, and three of them are ones this session has seen before in other models. The blocks were written footprint-first as [wall, arc]. `rotateY` carries a footprint's +Z out along the radius and its +X round the circumference, so every block sat across the ring rather than along it -- each one sticking a block's length out of a wall a block's width thick. The kerb came out as rubble thrown at a circle. The rope started at the roller's axis, which put its whole surface inside the barrel's hollow interior touching nothing. Then it started in the eye of the wound coil, which is also a hole. It has to begin within the coil's material, between 1.0 and 1.34 of the roller radius, so that it crosses the coil's outer face on the way down. The actions set `anchor.position.y = 0`, which destroys what `origin` had just done and dropped the whole rope and bucket by the height of the roller. Everything the actions touch is now an offset from where the origin put the anchor. And the masonry was over the triangle budget at 2 784, almost 1 900 of which were chamfers on forty-four blocks -- edges the roughen pass softens anyway, and stone is the one material here where a sharp arris is not wrong. Plain tapered boxes bring the model to 1 376. Two things about the wall itself, both from looking at it. Varying each block by a tenth in arc and thickness put every stone at its own radius and its own width; a dry wall is irregular the way a hand-cut stone is irregular, which is a few percent. And blocks cut to exactly their share of the arc cannot close: a flat face on a curve leaves a wedge of daylight at every joint, so they are cut long and bite into each other -- safe here because each is rotated to its own angle and no two adjoining faces are parallel. 29 models, 22 043 triangles, all checks pass, 0 floating cases, GLB round-trip clean, Conformant, build clean. |
||
|---|---|---|
| .. | ||
| drafts | ||
| models | ||
| build.ts | ||
| LICENSE | ||
| meta.ts | ||
| package.json | ||
| README.md | ||
Medieval Kit
A lowpoly medieval model library for Vibe3D and Three.js. Install a prop and you own its source: readable TypeScript in your own tree, not an opaque package boundary.
bunx vibe3d add @medieval-kit/wooden-barrel
bunx vibe3d add @medieval-kit
Configure models.json first so the namespace resolves:
{
"registries": {
"@medieval-kit": {
"source": "npm:@medieval-kit/registry",
"version": "latest"
}
}
}
Models
29 models and one shared lib. Addresses are @medieval-kit/<id>. This table is
generated from the models themselves with bun scripts/catalog-table.ts — a
hand-written list goes stale on the first model you add, and this one already
did once.
| Model | Category | Triangles | Parts | Size (m) | Material slots | Animated |
|---|---|---|---|---|---|---|
wooden-chest |
Furniture | 552 | 4 | 0.86×0.51×0.48 | oak, iron | ✔ |
wooden-barrel |
Props | 1690 | 3 | 0.83×1.05×0.83 | oak, iron | |
wooden-crate |
Props | 1320 | 3 | 0.69×0.52×0.55 | oak, iron | |
wooden-bucket |
Props | 439 | 4 | 0.31×0.46×0.30 | oak, iron | |
trestle-table |
Furniture | 660 | 3 | 1.91×0.74×0.78 | oak | |
wooden-bench |
Furniture | 216 | 3 | 1.62×0.45×0.30 | oak | |
wooden-stool |
Furniture | 180 | 2 | 0.38×0.43×0.36 | oak | |
pitch-torch |
Lighting | 239 | 3 | 0.13×0.70×0.13 | oak, char, ember | ✔ |
iron-lantern |
Lighting | 480 | 4 | 0.15×0.30×0.17 | iron, glass, char, ember | ✔ |
iron-anvil |
Smithy | 256 | 6 | 0.54×0.75×0.41 | iron, steel, oak | |
cart-wheel |
Structure | 1136 | 4 | 1.04×1.06×0.19 | oak, iron | |
log-pile |
Props | 924 | 2 | 0.99×0.58×0.70 | oak | |
hay-bale |
Props | 910 | 3 | 1.04×0.42×0.43 | straw, cloth | |
linen-sack |
Props | 342 | 3 | 0.34×0.53×0.33 | cloth | |
oak-tankard |
Props | 390 | 4 | 0.11×0.16×0.14 | oak, iron | |
straw-broom |
Tools | 1048 | 3 | 0.30×1.22×0.30 | oak, straw, cloth | |
bronze-bell |
Props | 1048 | 4 | 0.51×0.68×0.36 | brass, iron, oak | ✔ |
tavern-sign |
Props | 876 | 3 | 0.38×2.29×0.93 | oak, iron | ✔ |
wicker-basket |
Props | 2326 | 3 | 0.34×0.16×0.35 | oak, produce | |
leather-book |
Props | 440 | 3 | 0.20×0.08×0.27 | leather, cloth, brass | |
glass-phial |
Props | 339 | 3 | 0.06×0.14×0.06 | glass, ember, oak, char | |
coin-pouch |
Props | 602 | 3 | 0.18×0.11×0.16 | leather, cloth, brass | |
wooden-ladder |
Structure | 440 | 2 | 0.49×2.20×0.06 | oak | |
wooden-fence |
Structure | 860 | 2 | 5.18×1.31×0.31 | oak | |
wooden-hoe |
Tools | 394 | 3 | 0.23×1.23×0.33 | oak, iron, steel | |
wooden-shovel |
Tools | 496 | 3 | 0.27×1.20×0.08 | oak, iron | |
wooden-pitchfork |
Tools | 392 | 3 | 0.27×1.58×0.15 | oak, iron | |
stone-well |
Structure | 1376 | 4 | 1.88×2.00×1.28 | stone, oak, iron, cloth | |
post-mill |
Structure | 1672 | 4 | 6.60×7.23×6.98 | oak, iron |
22 043 triangles in total. The whole kit in one scene costs less than a single mid-complexity character model.
Every model depends on @medieval-kit/core, a shared support item holding the
palette, deterministic randomness, and the geometry vocabulary. Pulling a single
prop brings it along, so an individually installed crate still looks like it
came from the same catalogue as the barrel beside it.
Plain WebGL
This kit does not require WebGPU. It declares capabilities: [] and builds
on MeshStandardMaterial and MeshBasicMaterial, so it renders on
WebGLRenderer as well as WebGPURenderer.
Configuration
Models are procedural, not baked. Every prop exposes typed fields:
import { createModel } from '@/models/medieval-kit/wooden-barrel/model.ts'
const barrel = createModel({ staveCount: 17, taper: 0.22, seed: 42 })
scene.add(barrel.root)
barrel.configure({ hoopCount: 6 }) // rebuilds geometry inside a stable root
barrel.dispose()
seed is a real field, not a debug knob. Variation is deterministic: the same
seed always produces the same prop, so previews, tests, and art direction stay
reproducible. Change the seed to get a different barrel from the same model.
Runtime anatomy
Each model follows the Vibe3D protocol:
rootkeeps its object identity for the model's whole lifetime.partsexpose stable semantic anchors. Attach your own lights, labels, or gameplay objects topart.anchor— they surviveconfigure(), because onlypart.contentis rebuilt.materialsresolve per slot and can be overridden. Materials you supply are borrowed: the model never disposes them.actionsandupdate(delta)carry interactive state. Five models use both —wooden-chest,pitch-torch,iron-lantern,bronze-bellandtavern-sign:
const chest = createModel()
chest.actions.setOpen(true)
chest.update(deltaSeconds) // the lid eases open, frame-rate independent
const torch = createModel()
torch.actions.setLit(false)
torch.update(deltaSeconds) // flame flicker and light modulation
A model that never receives update() simply stands still; nothing animates
behind your back. Reach for configure() when a user changes a setting; it
rebuilds topology and is not cheap. Anything that changes per frame belongs in
update().
Material slots
Twelve slots, and each one exists because a single material could not carry the difference.
| Slot | What it covers | Why it is separate |
|---|---|---|
oak |
timber | — |
iron |
forged iron, oxidised and matte | separate from steel: the difference is not in colour but in ROUGHNESS, and vertex colour cannot carry roughness |
steel |
steel polished by use | the anvil face, the shovel blade, the pitchfork tines |
brass |
bronze and copper | the bell, the coins |
straw |
straw, wicker, broom bristle | a bale declaring itself "oak" would be a lie told to the consumer |
cloth |
linen, sackcloth, rope | — |
leather |
worked leather | — |
glass |
blown glass | transparent, depthWrite OFF, DoubleSide |
produce |
fruit and vegetable skin | given straw's roughness, an apple would look like dry grass |
ember |
flame | MeshBasicMaterial — it does not receive light, it emits |
char |
charcoal and pitch | — |
stone |
dressed and rubble masonry | its colour is close to weathered oak; what separates them at a glance is that stone scatters light completely flat, and roughness is not something vertex colour can carry |
ember also acts as a rule in two places: bodies in that slot are skipped
entirely while ambient occlusion and mottle are baked. The reason is simple —
in an unlit material the vertex colour is the final colour, so darkening it
puts the flame out. The rule is attached to the slot itself rather than to a
per-model flag, so it cannot be forgotten.
Colour variation lives in the geometry, not in the materials: each of the barrel's 17 staves carries its own tone as vertex colours, and all of them share one material and therefore one draw call.
Building from source
bun build.ts # emit dist/registry.json
bunx vibe3d registry validate dist/registry.json
The build walks models/. A folder containing model.ts becomes a
vibe3d:model; any other folder becomes a vibe3d:lib. Registry dependencies
are derived from the source — an import from ../core/ makes
@medieval-kit/core a dependency automatically, so there is no hand-maintained
list to go stale.
drafts/ is deliberately outside that walk: the code is kept in the tree but
never reaches the published package. See drafts/README.md.
Released under the MIT License.
