diff --git a/README.md b/README.md index bffa19b..6b75049 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/media/kit.png b/media/kit.png index 516a41a..48ded35 100644 Binary files a/media/kit.png and b/media/kit.png differ diff --git a/media/models.png b/media/models.png new file mode 100644 index 0000000..62e9de8 Binary files /dev/null and b/media/models.png differ diff --git a/my-registry/README.md b/my-registry/README.md index 20dfdc0..0d90c75 100644 --- a/my-registry/README.md +++ b/my-registry/README.md @@ -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 diff --git a/scripts/render.ts b/scripts/render.ts index 8d40e53..8ead120 100644 --- a/scripts/render.ts +++ b/scripts/render.ts @@ -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() for (const id of ids) { diff --git a/src/catalog.ts b/src/catalog.ts index c08b5c3..274d2d4 100644 --- a/src/catalog.ts +++ b/src/catalog.ts @@ -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