From bee4ac963a452042782165228274f1ab6e69248c Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 22 Aug 2026 06:30:48 +0000 Subject: [PATCH] Give the bale back its cylinder, and its cords back their thickness Against a photograph this was the worst model in the kit: an amorphous pale lump with spikes in it, where the reference is plainly a drum of straw with three cords round it. Three numbers were doing the damage. The body is a seven-sided lathe -- too few sides to read as round on its own -- and it was then displaced by 0.045 of the height, which is 19 mm against a radius of 210 mm. A tenth of the radius is not texture, it is deformation, and it left no axis to recognise. Meanwhile the ends were pulled in by a third, turning the silhouette into a cinched sack rather than a bale with the broad flat ends the cord holds it square against. Thirteen sides, a sixth of the displacement and a third of the end fade, and the form comes back. The stray stalks are what should say "loose straw", and they can only do that against a body that holds its shape -- so they are shorter too, since at 0.30 of the height they read as spikes driven in rather than stalks working loose. The cords were worse, in the quiet way. The ring radius was written as `0.5 * cinch(x) + cord * 0.35`, which adds four millimetres to a normalised 0.5: the body is built in radius-1 space and squashed afterwards, so anything radial has to be in those units. The hoop stood 0.0044 proud before the squash and 1.85 mm after it. Three cords have been modelled, merged, exported and invisible in every render this model has ever produced. They are now expressed in the body's own units and sit in the groove they pull, which is what a tie does. 27 models, 18257 triangles, all checks pass, 0 floating cases. --- models.lock.json | 60 +++++++++++------------ my-registry/models/hay-bale/model.ts | 41 +++++++++++++--- src/models/medieval-kit/hay-bale/model.ts | 41 +++++++++++++--- 3 files changed, 98 insertions(+), 44 deletions(-) diff --git a/models.lock.json b/models.lock.json index e923c36..a13bac0 100644 --- a/models.lock.json +++ b/models.lock.json @@ -67,7 +67,7 @@ "address": "@medieval-kit/wooden-barrel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.070Z", + "installedAt": "2026-08-22T06:29:40.554Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-barrel\\model.ts", @@ -82,7 +82,7 @@ "address": "@medieval-kit/core", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.053Z", + "installedAt": "2026-08-22T06:29:40.535Z", "files": [ { "path": "src\\models\\medieval-kit\\core\\geometry.ts", @@ -129,7 +129,7 @@ "address": "@medieval-kit/wooden-crate", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.074Z", + "installedAt": "2026-08-22T06:29:40.558Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-crate\\model.ts", @@ -144,7 +144,7 @@ "address": "@medieval-kit/kit", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.080Z", + "installedAt": "2026-08-22T06:29:40.565Z", "files": [], "dependencies": [] }, @@ -152,7 +152,7 @@ "address": "@medieval-kit/iron-anvil", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.059Z", + "installedAt": "2026-08-22T06:29:40.542Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-anvil\\model.ts", @@ -167,7 +167,7 @@ "address": "@medieval-kit/wooden-bucket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.072Z", + "installedAt": "2026-08-22T06:29:40.556Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bucket\\model.ts", @@ -182,7 +182,7 @@ "address": "@medieval-kit/wooden-fence", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.075Z", + "installedAt": "2026-08-22T06:29:40.559Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-fence\\model.ts", @@ -197,7 +197,7 @@ "address": "@medieval-kit/wooden-hoe", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.076Z", + "installedAt": "2026-08-22T06:29:40.560Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-hoe\\model.ts", @@ -212,7 +212,7 @@ "address": "@medieval-kit/wooden-ladder", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.077Z", + "installedAt": "2026-08-22T06:29:40.561Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-ladder\\model.ts", @@ -227,7 +227,7 @@ "address": "@medieval-kit/wooden-pitchfork", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.078Z", + "installedAt": "2026-08-22T06:29:40.563Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-pitchfork\\model.ts", @@ -242,7 +242,7 @@ "address": "@medieval-kit/wooden-shovel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.079Z", + "installedAt": "2026-08-22T06:29:40.564Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-shovel\\model.ts", @@ -257,7 +257,7 @@ "address": "@medieval-kit/wooden-stool", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.080Z", + "installedAt": "2026-08-22T06:29:40.565Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-stool\\model.ts", @@ -272,7 +272,7 @@ "address": "@medieval-kit/cart-wheel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.056Z", + "installedAt": "2026-08-22T06:29:40.538Z", "files": [ { "path": "src\\models\\medieval-kit\\cart-wheel\\model.ts", @@ -287,7 +287,7 @@ "address": "@medieval-kit/log-pile", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.064Z", + "installedAt": "2026-08-22T06:29:40.547Z", "files": [ { "path": "src\\models\\medieval-kit\\log-pile\\model.ts", @@ -302,7 +302,7 @@ "address": "@medieval-kit/trestle-table", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.068Z", + "installedAt": "2026-08-22T06:29:40.552Z", "files": [ { "path": "src\\models\\medieval-kit\\trestle-table\\model.ts", @@ -317,7 +317,7 @@ "address": "@medieval-kit/wooden-chest", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.073Z", + "installedAt": "2026-08-22T06:29:40.557Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-chest\\model.ts", @@ -332,11 +332,11 @@ "address": "@medieval-kit/hay-bale", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.059Z", + "installedAt": "2026-08-22T06:29:40.541Z", "files": [ { "path": "src\\models\\medieval-kit\\hay-bale\\model.ts", - "sourceHash": "39bab6ad49b6f5bd2cae776b8da4c39761e0666004f831b878fa57e37c866373" + "sourceHash": "f3bd9bebb394f74cb0b7b04e24f15280c35bbd9faf6cbab476bafa222f89e88c" } ], "dependencies": [ @@ -347,7 +347,7 @@ "address": "@medieval-kit/pitch-torch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.065Z", + "installedAt": "2026-08-22T06:29:40.549Z", "files": [ { "path": "src\\models\\medieval-kit\\pitch-torch\\model.ts", @@ -362,7 +362,7 @@ "address": "@medieval-kit/wooden-bench", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.071Z", + "installedAt": "2026-08-22T06:29:40.555Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", @@ -377,7 +377,7 @@ "address": "@medieval-kit/linen-sack", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.062Z", + "installedAt": "2026-08-22T06:29:40.546Z", "files": [ { "path": "src\\models\\medieval-kit\\linen-sack\\model.ts", @@ -392,7 +392,7 @@ "address": "@medieval-kit/oak-tankard", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.064Z", + "installedAt": "2026-08-22T06:29:40.548Z", "files": [ { "path": "src\\models\\medieval-kit\\oak-tankard\\model.ts", @@ -407,7 +407,7 @@ "address": "@medieval-kit/straw-broom", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.066Z", + "installedAt": "2026-08-22T06:29:40.549Z", "files": [ { "path": "src\\models\\medieval-kit\\straw-broom\\model.ts", @@ -422,7 +422,7 @@ "address": "@medieval-kit/bronze-bell", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.054Z", + "installedAt": "2026-08-22T06:29:40.537Z", "files": [ { "path": "src\\models\\medieval-kit\\bronze-bell\\model.ts", @@ -437,7 +437,7 @@ "address": "@medieval-kit/iron-lantern", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.061Z", + "installedAt": "2026-08-22T06:29:40.543Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-lantern\\model.ts", @@ -452,7 +452,7 @@ "address": "@medieval-kit/tavern-sign", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.067Z", + "installedAt": "2026-08-22T06:29:40.551Z", "files": [ { "path": "src\\models\\medieval-kit\\tavern-sign\\model.ts", @@ -467,7 +467,7 @@ "address": "@medieval-kit/coin-pouch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.056Z", + "installedAt": "2026-08-22T06:29:40.539Z", "files": [ { "path": "src\\models\\medieval-kit\\coin-pouch\\model.ts", @@ -482,7 +482,7 @@ "address": "@medieval-kit/glass-phial", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.058Z", + "installedAt": "2026-08-22T06:29:40.540Z", "files": [ { "path": "src\\models\\medieval-kit\\glass-phial\\model.ts", @@ -497,7 +497,7 @@ "address": "@medieval-kit/leather-book", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.062Z", + "installedAt": "2026-08-22T06:29:40.544Z", "files": [ { "path": "src\\models\\medieval-kit\\leather-book\\model.ts", @@ -512,7 +512,7 @@ "address": "@medieval-kit/wicker-basket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T06:23:58.069Z", + "installedAt": "2026-08-22T06:29:40.553Z", "files": [ { "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", diff --git a/my-registry/models/hay-bale/model.ts b/my-registry/models/hay-bale/model.ts index 6f6dce4..e331c2a 100644 --- a/my-registry/models/hay-bale/model.ts +++ b/my-registry/models/hay-bale/model.ts @@ -54,7 +54,7 @@ export const hayBaleDefaults: HayBaleConfig = { length: 0.88, height: 0.42, depth: 0.46, - ropeCount: 2, + ropeCount: 3, wisps: 34, rough: 1, seed: 47, @@ -93,18 +93,30 @@ export function createModel(overrides: Partial = {}) { const x = -halfLength + config.length * t // The ends round off: the first and last hoop are clearly narrower, or // else the bundle looks like a pipe cut off at both ends. - const endFade = 1 - Math.pow(Math.abs(t - 0.5) * 2, 6) * 0.34 + // 0.12, not 0.34. A bound bale has broad, nearly flat ends -- the + // cord holds the straw square against them. Pulling them in by a third + // turned the silhouette into a cinched sack, and combined with the + // roughening below there was no cylinder left to recognise. + const endFade = 1 - Math.pow(Math.abs(t - 0.5) * 2, 6) * 0.12 return { y: x, radius: 0.5 * cinch(x) * endFade * (1 + jitter(random, 0.05)) } }) - const body = latheGeometry(levels, 7, [0, 0, 0], tint('straw', -0.06, 1.6), { + // Thirteen segments, not seven. The body carries the only strong shape + // in the model and a seven-sided prism does not read as round. + const body = latheGeometry(levels, 13, [0, 0, 0], tint('straw', -0.06, 1.6), { colourTop: tint('strawPale', 0.02, 1.6), }) // Built upright and then laid down: the lathe helper works around the Y // axis, whereas the bundle runs along X. body.rotateZ(Math.PI / 2) body.scale(1, config.height, config.depth) - roughenGeometry(body, config.height * 0.045 * config.rough, { salt: 11 }) + // The displacement was 0.045 of the height -- 19 mm against a radius of + // 210 mm, nearly a tenth. Straw is not flat, but a tenth of the radius is + // not texture, it is deformation: the bale came out as an amorphous lump + // with no axis. The stray stalks are what should carry the impression of + // loose straw, and they can only do that against a body that holds its + // shape. + roughenGeometry(body, config.height * 0.016 * config.rough, { salt: 11 }) // --- Stray stalks ---------------------------------------------------- // The loose stalks on the surface and the stem ends spraying out of the @@ -117,7 +129,9 @@ export function createModel(overrides: Partial = {}) { for (let i = 0; i < wispCount; i += 1) { const fromEnd = i % 3 === 0 - const length = config.height * (fromEnd ? 0.2 + random() * 0.24 : 0.13 + random() * 0.17) + // Shorter on the sides. At up to 0.30 of the height these read as + // spikes driven into the bale rather than as stalks working loose. + const length = config.height * (fromEnd ? 0.16 + random() * 0.2 : 0.06 + random() * 0.09) const wisp = boxGeometry( [length, thickness * (0.6 + random() * 0.9), thickness], [length * 0.3, 0, 0], // root behind the origin: buried in the body @@ -158,10 +172,23 @@ export function createModel(overrides: Partial = {}) { // than from four bars. It goes through the same squashing transform, so // it sits exactly on the bundle's cross-section. const ropePieces: BufferGeometry[] = [] - const cord = config.height * 0.03 + const cord = config.height * 0.045 for (const x of ropeXs) { // Free-standing hoop: it needs its inner face too, or it is not solid. - const ring = bandGeometry(0.5 * cinch(x) + cord * 0.35, 0, cord * 1.5, cord, 7, + // Radius and thickness in NORMALISED units, width in metres. + // + // The ring is built in the same radius-1 space as the body and squashed + // by the same transform, so anything radial has to be expressed the way + // the body is. The old line added `cord * 0.35` -- 4 mm in metres -- to + // a normalised 0.5, which left the hoop standing 0.0044 proud before + // the squash and 1.85 mm after it. The cords were modelled, merged, + // exported and invisible in every render. + // + // The cord sits in the groove it pulls: its outer face comes back out + // to just under where the bale's surface would be without the cinch, + // which is what a tie does. + const outer = 0.5 * (cinch(x) + 0.09) + const ring = bandGeometry(outer, 0, cord * 1.8, 0.5 * 0.06, 9, tint('cloth', -0.07), { inner: true }) ring.rotateZ(Math.PI / 2) ring.scale(1, config.height, config.depth) diff --git a/src/models/medieval-kit/hay-bale/model.ts b/src/models/medieval-kit/hay-bale/model.ts index 6f6dce4..e331c2a 100644 --- a/src/models/medieval-kit/hay-bale/model.ts +++ b/src/models/medieval-kit/hay-bale/model.ts @@ -54,7 +54,7 @@ export const hayBaleDefaults: HayBaleConfig = { length: 0.88, height: 0.42, depth: 0.46, - ropeCount: 2, + ropeCount: 3, wisps: 34, rough: 1, seed: 47, @@ -93,18 +93,30 @@ export function createModel(overrides: Partial = {}) { const x = -halfLength + config.length * t // The ends round off: the first and last hoop are clearly narrower, or // else the bundle looks like a pipe cut off at both ends. - const endFade = 1 - Math.pow(Math.abs(t - 0.5) * 2, 6) * 0.34 + // 0.12, not 0.34. A bound bale has broad, nearly flat ends -- the + // cord holds the straw square against them. Pulling them in by a third + // turned the silhouette into a cinched sack, and combined with the + // roughening below there was no cylinder left to recognise. + const endFade = 1 - Math.pow(Math.abs(t - 0.5) * 2, 6) * 0.12 return { y: x, radius: 0.5 * cinch(x) * endFade * (1 + jitter(random, 0.05)) } }) - const body = latheGeometry(levels, 7, [0, 0, 0], tint('straw', -0.06, 1.6), { + // Thirteen segments, not seven. The body carries the only strong shape + // in the model and a seven-sided prism does not read as round. + const body = latheGeometry(levels, 13, [0, 0, 0], tint('straw', -0.06, 1.6), { colourTop: tint('strawPale', 0.02, 1.6), }) // Built upright and then laid down: the lathe helper works around the Y // axis, whereas the bundle runs along X. body.rotateZ(Math.PI / 2) body.scale(1, config.height, config.depth) - roughenGeometry(body, config.height * 0.045 * config.rough, { salt: 11 }) + // The displacement was 0.045 of the height -- 19 mm against a radius of + // 210 mm, nearly a tenth. Straw is not flat, but a tenth of the radius is + // not texture, it is deformation: the bale came out as an amorphous lump + // with no axis. The stray stalks are what should carry the impression of + // loose straw, and they can only do that against a body that holds its + // shape. + roughenGeometry(body, config.height * 0.016 * config.rough, { salt: 11 }) // --- Stray stalks ---------------------------------------------------- // The loose stalks on the surface and the stem ends spraying out of the @@ -117,7 +129,9 @@ export function createModel(overrides: Partial = {}) { for (let i = 0; i < wispCount; i += 1) { const fromEnd = i % 3 === 0 - const length = config.height * (fromEnd ? 0.2 + random() * 0.24 : 0.13 + random() * 0.17) + // Shorter on the sides. At up to 0.30 of the height these read as + // spikes driven into the bale rather than as stalks working loose. + const length = config.height * (fromEnd ? 0.16 + random() * 0.2 : 0.06 + random() * 0.09) const wisp = boxGeometry( [length, thickness * (0.6 + random() * 0.9), thickness], [length * 0.3, 0, 0], // root behind the origin: buried in the body @@ -158,10 +172,23 @@ export function createModel(overrides: Partial = {}) { // than from four bars. It goes through the same squashing transform, so // it sits exactly on the bundle's cross-section. const ropePieces: BufferGeometry[] = [] - const cord = config.height * 0.03 + const cord = config.height * 0.045 for (const x of ropeXs) { // Free-standing hoop: it needs its inner face too, or it is not solid. - const ring = bandGeometry(0.5 * cinch(x) + cord * 0.35, 0, cord * 1.5, cord, 7, + // Radius and thickness in NORMALISED units, width in metres. + // + // The ring is built in the same radius-1 space as the body and squashed + // by the same transform, so anything radial has to be expressed the way + // the body is. The old line added `cord * 0.35` -- 4 mm in metres -- to + // a normalised 0.5, which left the hoop standing 0.0044 proud before + // the squash and 1.85 mm after it. The cords were modelled, merged, + // exported and invisible in every render. + // + // The cord sits in the groove it pulls: its outer face comes back out + // to just under where the bale's surface would be without the cinch, + // which is what a tie does. + const outer = 0.5 * (cinch(x) + 0.09) + const ring = bandGeometry(outer, 0, cord * 1.8, 0.5 * 0.06, 9, tint('cloth', -0.07), { inner: true }) ring.rotateZ(Math.PI / 2) ring.scale(1, config.height, config.depth)