Lay the whole-kit scene out square, and let it be the picture

The image both READMEs open with was a contact sheet whose FIRST cell — top
left, the one everybody's eye lands on — was the `kit` entry: all thirty-five
models arranged in one scene, squeezed into a 300 px cell, an illegible smear.
It is not a model and it does not belong in a grid of models. Rendered on its
own it is by far the better picture anyway, so it is now the picture, and the
contact sheet is a second image beneath it.

Rendering it on its own is also what showed the arrangement had quietly gone
wrong. The row width was a fixed 5.6 m, which was right for a kit of tankards
and barrels and became wrong the moment anything bigger than a row went in: the
oak is 8.6 m across and the mill 6.6, so each took a row to itself while the
small props packed four and five deep. The kit had stretched into a long thin
diagonal, and since a camera fits a bounding SPHERE, the sphere around a
diagonal line is enormous next to the things inside it — the kit occupied about
a quarter of its own picture and the rest was empty floor.

So the row width is measured from the models now rather than fixed: the square
root of the total footprint, which packs rows about as deep as they are wide
whatever the kit happens to contain, floored at the widest single model since
no row can be narrower than the thing standing in it. Swept for the factor:
1.15 gave 15.1 x 21.7 m, 1.45 gave 19.2 x 13.3 — the square is between them,
and 1.24 lands at 16.4 x 14.8, aspect 1.11, filling the framed disc better than
any of them.

It reads as a village yard now: mill and oak at the back, forge and cart in the
middle, the small props at the front. Which is what the entry is FOR — every
model on one ground plane at one scale is the only place a difference in scale
or tone has nowhere to hide.
This commit is contained in:
CRTkafa 2026-08-26 18:50:26 +00:00
parent 4caac736f6
commit 81873ede0d
6 changed files with 42 additions and 5 deletions

View file

@ -12,12 +12,18 @@ on an opaque package. This repository holds one such registry.
- **`src/`** — a demo app that installs from both `@medieval-kit` and the
first-party `@scifi-kit`, so the two can be inspected side by side.
![The whole kit](media/kit.png)
![The whole kit in one scene](media/kit.png)
35 models and one shared library, **31,404 triangles** for the whole kit — less
than a single medium-detail character. Every one is procedural source you own
and edit, not an asset you load.
That picture is a real scene, not a montage: the viewer's `kit` entry builds
every model at once on a common ground plane, which is where inconsistencies in
scale and tone have nowhere left to hide. Individually:
![Every model](media/models.png)
## Run the viewer
Requires [Bun](https://bun.sh). The viewer runs on WebGPU where the browser has
@ -176,7 +182,9 @@ scripts/
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
media/
kit.png the whole catalogue as one scene
models.png the contact sheet, one cell per model
models.json which registries this project resolves
models.lock.json install receipt; `vibe3d diff` compares against it
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Before After
Before After

BIN
media/models.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

View file

@ -4,7 +4,9 @@ A lowpoly medieval model library for [Vibe3D](https://github.com/vibe-stack/vibe
and Three.js. Install a prop and you own its source: readable TypeScript in your
own tree, not an opaque package boundary.
![The whole kit](https://raw.githubusercontent.com/CRTkafa/medieval-kit/main/media/kit.png)
![The whole kit in one scene](https://raw.githubusercontent.com/CRTkafa/medieval-kit/main/media/kit.png)
![Every model](https://raw.githubusercontent.com/CRTkafa/medieval-kit/main/media/models.png)
```sh
bunx vibe3d add @medieval-kit/wooden-barrel

View file

@ -445,7 +445,11 @@ if (sweep) {
}
const ids = one ? [one]
: only ?? Object.keys(CATALOG).filter((id) => id !== 'pressure-gauge')
// `kit` is the whole catalogue arranged in one scene, not a model. Squeezed
// into a cell of the contact sheet it is an illegible smear, and it was the
// FIRST cell — the top left of the image this README opens with. It gets
// rendered on its own instead: `bun scripts/render.ts --one kit`.
: only ?? Object.keys(CATALOG).filter((id) => id !== 'pressure-gauge' && id !== 'kit')
const frames = new Map<string, Frame>()
for (const id of ids) {

View file

@ -371,7 +371,30 @@ function kitEntry(): Entry {
placed.sort((a, b) => b.size.y - a.size.y)
const gap = 0.42
const rowWidth = 5.6
/**
* The row width is MEASURED from the models, not fixed at 5.6 m.
*
* 5.6 was right for a kit of tankards and barrels and became wrong the
* moment anything bigger than a row went in: the oak is 8.6 m across and
* the mill 6.6, so each of them took a row to itself while the small
* props packed four and five deep, and the arrangement stretched into a
* long thin diagonal. A camera fits a bounding sphere, and the sphere
* around a diagonal line is enormous next to the things in it -- the kit
* ended up occupying about a quarter of its own picture with the rest
* empty floor.
*
* Packing to roughly a SQUARE plan is what fixes that, and the width
* that does it is the square root of the total footprint: rows then come
* out about as deep as they are wide whatever is in the kit. The 1.24
* covers the waste at the end of each row, and the floor is the widest
* single model, since no row can be narrower than the thing standing
* in it.
*/
const footprint = placed.reduce(
(sum, item) => sum + (item.size.x + gap) * (item.size.z + gap), 0,
)
const widest = placed.reduce((most, item) => Math.max(most, item.size.x), 0)
const rowWidth = Math.max(widest, Math.sqrt(footprint) * 1.24)
let cursorX = 0
let cursorZ = 0
let rowDepth = 0