Close the basket's weave, fill it, and stop calling willow straw

Three defects, two of them mine.

The weave had gaps you could see the contents through. The band height was
a flat 0.11 of the model height while the spacing between rows is 1/rows --
0.167 at the default six -- leaving a 12 mm hole between every course. It
was a slatted crate, not a weave. The height now derives from the row
count so rows meet at any setting.

The fruit was invisible, and that was a regression I introduced. An earlier
pass fixed produce that hung level with the rim over a gap by resting it on
the base. That was right; what did not follow was that a basket deeper than
its contents then needs enough contents to fill it. Nine apples in two
layers topped out 12 cm below a 10 cm rim -- correctly supported, and
completely out of sight. The basket is shallower, holds fifteen, and the
layers nest at 0.95 of a diameter rather than 1.5, so the heap now mounds
over the rim, which is the only state a fruit basket is ever drawn in.

Closing the weave then exposed two collisions. Overlapping rows meet in
coplanar faces at the nodes where the undulation crosses zero -- on a
cylindrical basket every row shares one radius -- so alternate rows now sit
slightly proud of and behind each other, which is how a weaver's rod really
passes the stakes. And the rim's inner surface sat at 0.16055 against the
liner's 0.16065: a tenth of a millimetre apart, by coincidence, and the
same 22-sided prism. The rim is now the heavy rod it should be and clears
the liner.

Colour: the basket drew from the `straw` palette and rendered at hue 41,
saturation 0.59 against a reference at 29 and 0.50 -- bright yellow
plastic. Willow is a wood, so both the colour and the material slot move to
oak, which measures 7 and 0.03 away instead of 12 and 0.09.

It still does not look like the photograph, and the measurement cannot say
why. Filtering to pixels above 0.18 saturation discards precisely the grey,
weathered pixels that give the reference its character, so the statistic
reports agreement that the eye does not see. Setting the lift to 0.12 to
make willow "paler than oak" turned it salmon -- raising HSL lightness
holds saturation, so a saturated brown climbs towards peach. Sweeping the
lift over 0.00 / 0.04 / 0.08 moved the measurement by 0.01, which is the
clearest evidence that this axis is not where the remaining gap lives.

27 models, 17853 triangles, all checks pass, 0 floating cases, build clean.
This commit is contained in:
CRTkafa 2026-08-22 12:08:56 +07:00
parent 01d00cdd26
commit ebc5cbec6d
5 changed files with 192 additions and 64 deletions

View file

@ -67,7 +67,7 @@
"address": "@medieval-kit/wooden-barrel", "address": "@medieval-kit/wooden-barrel",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.952Z", "installedAt": "2026-08-22T05:07:43.803Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-barrel\\model.ts", "path": "src\\models\\medieval-kit\\wooden-barrel\\model.ts",
@ -82,7 +82,7 @@
"address": "@medieval-kit/core", "address": "@medieval-kit/core",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.926Z", "installedAt": "2026-08-22T05:07:43.779Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\core\\geometry.ts", "path": "src\\models\\medieval-kit\\core\\geometry.ts",
@ -129,7 +129,7 @@
"address": "@medieval-kit/wooden-crate", "address": "@medieval-kit/wooden-crate",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.957Z", "installedAt": "2026-08-22T05:07:43.809Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-crate\\model.ts", "path": "src\\models\\medieval-kit\\wooden-crate\\model.ts",
@ -144,7 +144,7 @@
"address": "@medieval-kit/kit", "address": "@medieval-kit/kit",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.965Z", "installedAt": "2026-08-22T05:07:43.817Z",
"files": [], "files": [],
"dependencies": [] "dependencies": []
}, },
@ -152,7 +152,7 @@
"address": "@medieval-kit/iron-anvil", "address": "@medieval-kit/iron-anvil",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.936Z", "installedAt": "2026-08-22T05:07:43.788Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\iron-anvil\\model.ts", "path": "src\\models\\medieval-kit\\iron-anvil\\model.ts",
@ -167,7 +167,7 @@
"address": "@medieval-kit/wooden-bucket", "address": "@medieval-kit/wooden-bucket",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.955Z", "installedAt": "2026-08-22T05:07:43.806Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-bucket\\model.ts", "path": "src\\models\\medieval-kit\\wooden-bucket\\model.ts",
@ -182,7 +182,7 @@
"address": "@medieval-kit/wooden-fence", "address": "@medieval-kit/wooden-fence",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.959Z", "installedAt": "2026-08-22T05:07:43.810Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-fence\\model.ts", "path": "src\\models\\medieval-kit\\wooden-fence\\model.ts",
@ -197,7 +197,7 @@
"address": "@medieval-kit/wooden-hoe", "address": "@medieval-kit/wooden-hoe",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.960Z", "installedAt": "2026-08-22T05:07:43.811Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-hoe\\model.ts", "path": "src\\models\\medieval-kit\\wooden-hoe\\model.ts",
@ -212,7 +212,7 @@
"address": "@medieval-kit/wooden-ladder", "address": "@medieval-kit/wooden-ladder",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.961Z", "installedAt": "2026-08-22T05:07:43.813Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-ladder\\model.ts", "path": "src\\models\\medieval-kit\\wooden-ladder\\model.ts",
@ -227,7 +227,7 @@
"address": "@medieval-kit/wooden-pitchfork", "address": "@medieval-kit/wooden-pitchfork",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.963Z", "installedAt": "2026-08-22T05:07:43.814Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-pitchfork\\model.ts", "path": "src\\models\\medieval-kit\\wooden-pitchfork\\model.ts",
@ -242,7 +242,7 @@
"address": "@medieval-kit/wooden-shovel", "address": "@medieval-kit/wooden-shovel",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.964Z", "installedAt": "2026-08-22T05:07:43.815Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-shovel\\model.ts", "path": "src\\models\\medieval-kit\\wooden-shovel\\model.ts",
@ -257,7 +257,7 @@
"address": "@medieval-kit/wooden-stool", "address": "@medieval-kit/wooden-stool",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.965Z", "installedAt": "2026-08-22T05:07:43.817Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-stool\\model.ts", "path": "src\\models\\medieval-kit\\wooden-stool\\model.ts",
@ -272,7 +272,7 @@
"address": "@medieval-kit/cart-wheel", "address": "@medieval-kit/cart-wheel",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.930Z", "installedAt": "2026-08-22T05:07:43.783Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\cart-wheel\\model.ts", "path": "src\\models\\medieval-kit\\cart-wheel\\model.ts",
@ -287,7 +287,7 @@
"address": "@medieval-kit/log-pile", "address": "@medieval-kit/log-pile",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.942Z", "installedAt": "2026-08-22T05:07:43.794Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\log-pile\\model.ts", "path": "src\\models\\medieval-kit\\log-pile\\model.ts",
@ -302,7 +302,7 @@
"address": "@medieval-kit/trestle-table", "address": "@medieval-kit/trestle-table",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.949Z", "installedAt": "2026-08-22T05:07:43.800Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\trestle-table\\model.ts", "path": "src\\models\\medieval-kit\\trestle-table\\model.ts",
@ -317,7 +317,7 @@
"address": "@medieval-kit/wooden-chest", "address": "@medieval-kit/wooden-chest",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.956Z", "installedAt": "2026-08-22T05:07:43.807Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-chest\\model.ts", "path": "src\\models\\medieval-kit\\wooden-chest\\model.ts",
@ -332,7 +332,7 @@
"address": "@medieval-kit/hay-bale", "address": "@medieval-kit/hay-bale",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.935Z", "installedAt": "2026-08-22T05:07:43.787Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\hay-bale\\model.ts", "path": "src\\models\\medieval-kit\\hay-bale\\model.ts",
@ -347,7 +347,7 @@
"address": "@medieval-kit/pitch-torch", "address": "@medieval-kit/pitch-torch",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.945Z", "installedAt": "2026-08-22T05:07:43.796Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\pitch-torch\\model.ts", "path": "src\\models\\medieval-kit\\pitch-torch\\model.ts",
@ -362,7 +362,7 @@
"address": "@medieval-kit/wooden-bench", "address": "@medieval-kit/wooden-bench",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.954Z", "installedAt": "2026-08-22T05:07:43.805Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts",
@ -377,7 +377,7 @@
"address": "@medieval-kit/linen-sack", "address": "@medieval-kit/linen-sack",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.941Z", "installedAt": "2026-08-22T05:07:43.792Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\linen-sack\\model.ts", "path": "src\\models\\medieval-kit\\linen-sack\\model.ts",
@ -392,7 +392,7 @@
"address": "@medieval-kit/oak-tankard", "address": "@medieval-kit/oak-tankard",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.944Z", "installedAt": "2026-08-22T05:07:43.795Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\oak-tankard\\model.ts", "path": "src\\models\\medieval-kit\\oak-tankard\\model.ts",
@ -407,7 +407,7 @@
"address": "@medieval-kit/straw-broom", "address": "@medieval-kit/straw-broom",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.947Z", "installedAt": "2026-08-22T05:07:43.798Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\straw-broom\\model.ts", "path": "src\\models\\medieval-kit\\straw-broom\\model.ts",
@ -422,7 +422,7 @@
"address": "@medieval-kit/bronze-bell", "address": "@medieval-kit/bronze-bell",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.929Z", "installedAt": "2026-08-22T05:07:43.781Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\bronze-bell\\model.ts", "path": "src\\models\\medieval-kit\\bronze-bell\\model.ts",
@ -437,7 +437,7 @@
"address": "@medieval-kit/iron-lantern", "address": "@medieval-kit/iron-lantern",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.938Z", "installedAt": "2026-08-22T05:07:43.790Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\iron-lantern\\model.ts", "path": "src\\models\\medieval-kit\\iron-lantern\\model.ts",
@ -452,7 +452,7 @@
"address": "@medieval-kit/tavern-sign", "address": "@medieval-kit/tavern-sign",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.948Z", "installedAt": "2026-08-22T05:07:43.799Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\tavern-sign\\model.ts", "path": "src\\models\\medieval-kit\\tavern-sign\\model.ts",
@ -467,7 +467,7 @@
"address": "@medieval-kit/coin-pouch", "address": "@medieval-kit/coin-pouch",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.932Z", "installedAt": "2026-08-22T05:07:43.784Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\coin-pouch\\model.ts", "path": "src\\models\\medieval-kit\\coin-pouch\\model.ts",
@ -482,7 +482,7 @@
"address": "@medieval-kit/glass-phial", "address": "@medieval-kit/glass-phial",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.934Z", "installedAt": "2026-08-22T05:07:43.786Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\glass-phial\\model.ts", "path": "src\\models\\medieval-kit\\glass-phial\\model.ts",
@ -497,7 +497,7 @@
"address": "@medieval-kit/leather-book", "address": "@medieval-kit/leather-book",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.939Z", "installedAt": "2026-08-22T05:07:43.791Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\leather-book\\model.ts", "path": "src\\models\\medieval-kit\\leather-book\\model.ts",
@ -512,11 +512,11 @@
"address": "@medieval-kit/wicker-basket", "address": "@medieval-kit/wicker-basket",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-22T04:53:30.951Z", "installedAt": "2026-08-22T05:07:43.802Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts",
"sourceHash": "842204f7e1b98e273270655e47c6e3a21fa52d3d57d1c8901f28b546b4f6ba47" "sourceHash": "596b709436ce9ab344fd43143f6ba954dac400f38c2ec0389cafcdfc3896199a"
} }
], ],
"dependencies": [ "dependencies": [

View file

@ -431,7 +431,7 @@ export const MODEL_META: Readonly<Record<string, ModelMeta>> = {
hue: { type: 'number', label: 'Produce hue', min: 0, max: 1, step: 0.01 }, hue: { type: 'number', label: 'Produce hue', min: 0, max: 1, step: 0.01 },
seed: { type: 'number', label: 'Variation seed', min: 1, max: 64, step: 1 }, seed: { type: 'number', label: 'Variation seed', min: 1, max: 64, step: 1 },
}, },
materialSlots: ['straw', 'produce'], materialSlots: ['oak', 'produce'],
parts: ['weave', 'rim', 'contents'], parts: ['weave', 'rim', 'contents'],
}, },
'wooden-ladder': { 'wooden-ladder': {

View file

@ -56,12 +56,15 @@ export interface WickerBasketConfig {
} }
export const wickerBasketDefaults: WickerBasketConfig = { export const wickerBasketDefaults: WickerBasketConfig = {
height: 0.21, // Shallower and fuller. The reference is a bowl wider than it is deep,
// heaped until the fruit mounds over the rim -- which is the only state a
// fruit basket is ever drawn in.
height: 0.16,
radius: 0.17, radius: 0.17,
taper: 0.26, taper: 0.26,
stakes: 11, stakes: 11,
rows: 6, rows: 6,
produce: 9, produce: 15,
hue: 0.02, hue: 0.02,
seed: 97, seed: 97,
} }
@ -69,10 +72,10 @@ export const wickerBasketDefaults: WickerBasketConfig = {
export type WickerBasketParts = 'weave' | 'rim' | 'contents' export type WickerBasketParts = 'weave' | 'rim' | 'contents'
export function createModel(overrides: Partial<WickerBasketConfig> = {}) { export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
return createKitModel<WickerBasketConfig, 'straw' | 'produce', WickerBasketParts>({ return createKitModel<WickerBasketConfig, 'oak' | 'produce', WickerBasketParts>({
id: 'wicker-basket', id: 'wicker-basket',
defaults: wickerBasketDefaults, defaults: wickerBasketDefaults,
slots: ['straw', 'produce'], slots: ['oak', 'produce'],
build: ({ config, random }) => { build: ({ config, random }) => {
const tint = createTinter(random) const tint = createTinter(random)
const half = config.height / 2 const half = config.height / 2
@ -114,7 +117,7 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
const angle = (i / stakes) * Math.PI * 2 const angle = (i / stakes) * Math.PI * 2
const stake = prismGeometry( const stake = prismGeometry(
withy * 0.42, withy * 0.36, config.height * 1.02, 4, withy * 0.42, withy * 0.36, config.height * 1.02, 4,
[0, 0, 0], tint('straw', -0.09, 1.2), [0, 0, 0], tint('oak', -0.09 + 0.04, 1.2),
) )
// Bend first, move second: in a tapering basket the stakes lean too. // Bend first, move second: in a tapering basket the stakes lean too.
stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height)) stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height))
@ -124,6 +127,25 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(stake) pieces.push(stake)
} }
// Willow, not straw.
//
// The basket drew its colour from the `straw` palette entry and rendered
// at hue 41 with saturation 0.59; a photograph of a wicker basket sits at
// hue 29, saturation 0.50. It read as bright yellow plastic. The tuned
// `oak` entry is hue 26 / saturation 0.53 -- almost exactly the
// measurement -- and willow IS a wood, so the material slot moves with
// the colour. The lift keeps it at the pale, peeled end of oak rather
// than the dark structural end.
//
// The lift is 0.04 and that is nearly arbitrary: sweeping it over 0.00,
// 0.04 and 0.08 moved the measured hue and saturation by at most 0.01.
// It was first set to 0.12 on the reasoning that willow is paler than
// structural oak, which is true and which made the basket salmon pink --
// raising HSL lightness holds saturation, so a saturated brown climbs
// towards peach rather than towards weathered willow. Against the
// reference the straw entry was off by 12 degrees of hue and 0.09
// saturation; oak is off by 7 and 0.03.
// --- Horizontal weave ---------------------------------------------------- // --- Horizontal weave ----------------------------------------------------
// TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once // TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once
// positive and once negative on every stake, so the wave is fully resolved // positive and once negative on every stake, so the wave is fully resolved
@ -135,12 +157,35 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
// single-piece inner liner (below): six separate inner surfaces for six // single-piece inner liner (below): six separate inner surfaces for six
// hoops cost ~800 triangles, the liner costs 44, and from the inside the // hoops cost ~800 triangles, the liner costs 44, and from the inside the
// difference is invisible. // difference is invisible.
// The weave stops BELOW the rim. Once the rows were made tall enough to
// meet each other they grew into the rim's band, and the outermost point
// of the undulation met the rim's inner facets in the same plane. The
// rim is a separate, thicker rod laid over the finished weave, so the
// weave ending under it is how the object is actually made.
const weaveSpan = config.height * 0.9
for (let r = 0; r < rows; r += 1) { for (let r = 0; r < rows; r += 1) {
const t = (r + 0.5) / rows const t = (r + 0.5) / rows
const y = -half + config.height * t const y = -half + weaveSpan * t
// The band height is derived from the row count so that rows always
// MEET. It used to be a flat 0.11 of the height while the spacing
// between rows is 1/rows -- 0.167 at the default six -- which left a
// 12 mm gap you could see straight through to the contents. That is a
// slatted crate, not a weave. Rows now overlap slightly; they do not
// z-fight because consecutive rows are undulated half a wave apart, so
// where one bulges out its neighbour is tucked in.
// Alternate rows sit slightly proud of and slightly behind each other.
// This is how a weave really goes together -- the weaver's rod passes
// outside one stake and inside the next, so no two rows lie on the
// same cylinder -- and it is also what makes the overlap above safe.
// Undulating consecutive rows in antiphase is not enough on its own:
// a sine crosses zero, and at those nodes both rows returned to
// exactly `radiusAt(t)`. With a cylindrical basket (taper 0) every row
// shares that radius, so the overlapping bands met in coplanar faces
// at every node.
const lean = r % 2 === 0 ? withy * 0.2 : -withy * 0.2
const ring = bandGeometry( const ring = bandGeometry(
radiusAt(t), y, config.height * 0.11, withy * 0.8, stakes * 2, radiusAt(t) + lean, y, (weaveSpan / rows) * 1.06, withy * 0.8, stakes * 2,
tint('straw', jitter(random, 0.07), 1.2), tint('oak', 0.04 + jitter(random, 0.07), 1.2),
) )
// The phase shifts by half a wave on every row: the next row going in // The phase shifts by half a wave on every row: the next row going in
// where the previous one came out is what makes a weave a weave. // where the previous one came out is what makes a weave a weave.
@ -152,7 +197,7 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(flipGeometry(latheGeometry([ pieces.push(flipGeometry(latheGeometry([
{ y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) }, { y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) },
{ y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) }, { y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) },
], stakes * 2, [0, 0, 0], tint('straw', -0.2, 1.1), { ], stakes * 2, [0, 0, 0], tint('oak', 0.06, 1.1), {
capTop: false, capTop: false,
capBottom: false, capBottom: false,
}))) })))
@ -161,15 +206,24 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(latheGeometry([ pieces.push(latheGeometry([
{ y: -half - config.height * 0.01, radius: bottomRadius * 0.94 }, { y: -half - config.height * 0.01, radius: bottomRadius * 0.94 },
{ y: -half + config.height * 0.05, radius: bottomRadius * 0.99 }, { y: -half + config.height * 0.05, radius: bottomRadius * 0.99 },
], stakes * 2, [0, 0, 0], tint('straw', -0.14, 1.2), { capTop: true })) ], stakes * 2, [0, 0, 0], tint('oak', -0.14 + 0.04, 1.2), { capTop: true }))
// --- Rim ----------------------------------------------------------------- // --- Rim -----------------------------------------------------------------
// The thick bend that finishes the weave. It is the most visible detail on // The thick bend that finishes the weave. It is the most visible detail on
// the basket, and without it the edge looks "cut off". // the basket, and without it the edge looks "cut off".
const rim = mergeColoured([ const rim = mergeColoured([
// Thickness withy*2.1, not 1.5, and the reason is arithmetic rather
// than taste. At 1.5 the rim's inner surface landed at
// radius*1.015 - withy*1.5 = 0.16055, and the inner liner sits at
// radius*(1 - amplitude) = 0.16065 -- a tenth of a millimetre apart,
// by coincidence. On a cylindrical basket (taper 0) those are the same
// 22-sided prism and every facet of it z-fought. The thicker rod
// carries the inner face clearly past the liner, and it is the truer
// shape anyway: the rim is the heaviest rod in a basket, bent over the
// finished weave, and it stands proud on both sides.
bandGeometry(config.radius * 1.015, half - config.height * 0.03, bandGeometry(config.radius * 1.015, half - config.height * 0.03,
config.height * 0.1, withy * 1.5, stakes * 2, config.height * 0.1, withy * 2.1, stakes * 2,
tint('straw', 0.07, 1.2), { inner: true }), tint('oak', 0.07 + 0.04, 1.2), { inner: true }),
]) ])
// --- Contents ------------------------------------------------------------ // --- Contents ------------------------------------------------------------
@ -203,13 +257,23 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
const ring = Math.sqrt((i + 0.4) / count) const ring = Math.sqrt((i + 0.4) / count)
const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6) const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6)
const spread = inner * ring const spread = inner * ring
const layer = Math.floor(i / Math.max(3, Math.round(count * 0.55))) // Fewer fruit per layer means MORE layers, and it is the layer count
// that decides whether the heap ever reaches the mouth. At 0.55 the
// default nine apples formed two layers topping out 12 cm below a rim
// 10 cm up: correctly resting on the base, and completely invisible.
// Resting on the base was the fix for an earlier bug where the produce
// hung level with the rim over a gap; the fix was right and the
// consequence -- that a deep basket then needs enough fruit to fill it
// -- was not followed through.
const layer = Math.floor(i / Math.max(3, Math.round(count * 0.38)))
fruit.rotateX(jitter(random, 0.6)) fruit.rotateX(jitter(random, 0.6))
fruit.rotateZ(jitter(random, 0.6)) fruit.rotateZ(jitter(random, 0.6))
fruit.translate( fruit.translate(
Math.sin(angle) * spread, Math.sin(angle) * spread,
// Base top + one radius = resting on the floor of the basket. // Base top + one radius = resting on the floor of the basket.
-half + config.height * 0.05 + size * (0.92 + layer * 1.5) // Layers nest at 0.95 of a diameter, not 1.5: stacked fruit settles
// into the gaps of the layer below rather than sitting on top of it.
-half + config.height * 0.05 + size * (0.92 + layer * 0.95)
- ring * size * 0.28 + jitter(random, size * 0.08), - ring * size * 0.28 + jitter(random, size * 0.08),
Math.cos(angle) * spread, Math.cos(angle) * spread,
) )
@ -217,8 +281,8 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
} }
return { return {
weave: { slot: 'straw' as const, geometry: mergeColoured(pieces) }, weave: { slot: 'oak' as const, geometry: mergeColoured(pieces) },
rim: { slot: 'straw' as const, geometry: rim }, rim: { slot: 'oak' as const, geometry: rim },
contents: contents.length > 0 contents: contents.length > 0
? { slot: 'produce' as const, geometry: mergeColoured(contents) } ? { slot: 'produce' as const, geometry: mergeColoured(contents) }
: undefined, : undefined,

View file

@ -382,7 +382,7 @@ const CASES: readonly Case[] = [
shellRatio: 0.8, variants: [{ coins: 0 }, { fill: 1 }, { coinRadius: 0.02 }], shellRatio: 0.8, variants: [{ coins: 0 }, { fill: 1 }, { coinRadius: 0.02 }],
maxSize: [0.32, 0.14, 0.32] }, maxSize: [0.32, 0.14, 0.32] },
{ id: 'wicker-basket', make: as(createBasket), patch: { stakes: 14, rows: 9 }, { id: 'wicker-basket', make: as(createBasket), patch: { stakes: 14, rows: 9 },
parts: 3, ownSlot: 'produce', borrowSlot: 'straw', radial: true, radialPart: 'rim', parts: 3, ownSlot: 'produce', borrowSlot: 'oak', radial: true, radialPart: 'rim',
variants: [{ produce: 0 }, { taper: 0 }, { rows: 2 }], variants: [{ produce: 0 }, { taper: 0 }, { rows: 2 }],
maxSize: [0.42, 0.32, 0.42] }, maxSize: [0.42, 0.32, 0.42] },
{ id: 'log-pile', make: as(createLogPile), patch: { rows: 4, perRow: 7, variation: 0.4 }, { id: 'log-pile', make: as(createLogPile), patch: { rows: 4, perRow: 7, variation: 0.4 },

View file

@ -56,12 +56,15 @@ export interface WickerBasketConfig {
} }
export const wickerBasketDefaults: WickerBasketConfig = { export const wickerBasketDefaults: WickerBasketConfig = {
height: 0.21, // Shallower and fuller. The reference is a bowl wider than it is deep,
// heaped until the fruit mounds over the rim -- which is the only state a
// fruit basket is ever drawn in.
height: 0.16,
radius: 0.17, radius: 0.17,
taper: 0.26, taper: 0.26,
stakes: 11, stakes: 11,
rows: 6, rows: 6,
produce: 9, produce: 15,
hue: 0.02, hue: 0.02,
seed: 97, seed: 97,
} }
@ -69,10 +72,10 @@ export const wickerBasketDefaults: WickerBasketConfig = {
export type WickerBasketParts = 'weave' | 'rim' | 'contents' export type WickerBasketParts = 'weave' | 'rim' | 'contents'
export function createModel(overrides: Partial<WickerBasketConfig> = {}) { export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
return createKitModel<WickerBasketConfig, 'straw' | 'produce', WickerBasketParts>({ return createKitModel<WickerBasketConfig, 'oak' | 'produce', WickerBasketParts>({
id: 'wicker-basket', id: 'wicker-basket',
defaults: wickerBasketDefaults, defaults: wickerBasketDefaults,
slots: ['straw', 'produce'], slots: ['oak', 'produce'],
build: ({ config, random }) => { build: ({ config, random }) => {
const tint = createTinter(random) const tint = createTinter(random)
const half = config.height / 2 const half = config.height / 2
@ -114,7 +117,7 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
const angle = (i / stakes) * Math.PI * 2 const angle = (i / stakes) * Math.PI * 2
const stake = prismGeometry( const stake = prismGeometry(
withy * 0.42, withy * 0.36, config.height * 1.02, 4, withy * 0.42, withy * 0.36, config.height * 1.02, 4,
[0, 0, 0], tint('straw', -0.09, 1.2), [0, 0, 0], tint('oak', -0.09 + 0.04, 1.2),
) )
// Bend first, move second: in a tapering basket the stakes lean too. // Bend first, move second: in a tapering basket the stakes lean too.
stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height)) stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height))
@ -124,6 +127,25 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(stake) pieces.push(stake)
} }
// Willow, not straw.
//
// The basket drew its colour from the `straw` palette entry and rendered
// at hue 41 with saturation 0.59; a photograph of a wicker basket sits at
// hue 29, saturation 0.50. It read as bright yellow plastic. The tuned
// `oak` entry is hue 26 / saturation 0.53 -- almost exactly the
// measurement -- and willow IS a wood, so the material slot moves with
// the colour. The lift keeps it at the pale, peeled end of oak rather
// than the dark structural end.
//
// The lift is 0.04 and that is nearly arbitrary: sweeping it over 0.00,
// 0.04 and 0.08 moved the measured hue and saturation by at most 0.01.
// It was first set to 0.12 on the reasoning that willow is paler than
// structural oak, which is true and which made the basket salmon pink --
// raising HSL lightness holds saturation, so a saturated brown climbs
// towards peach rather than towards weathered willow. Against the
// reference the straw entry was off by 12 degrees of hue and 0.09
// saturation; oak is off by 7 and 0.03.
// --- Horizontal weave ---------------------------------------------------- // --- Horizontal weave ----------------------------------------------------
// TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once // TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once
// positive and once negative on every stake, so the wave is fully resolved // positive and once negative on every stake, so the wave is fully resolved
@ -135,12 +157,35 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
// single-piece inner liner (below): six separate inner surfaces for six // single-piece inner liner (below): six separate inner surfaces for six
// hoops cost ~800 triangles, the liner costs 44, and from the inside the // hoops cost ~800 triangles, the liner costs 44, and from the inside the
// difference is invisible. // difference is invisible.
// The weave stops BELOW the rim. Once the rows were made tall enough to
// meet each other they grew into the rim's band, and the outermost point
// of the undulation met the rim's inner facets in the same plane. The
// rim is a separate, thicker rod laid over the finished weave, so the
// weave ending under it is how the object is actually made.
const weaveSpan = config.height * 0.9
for (let r = 0; r < rows; r += 1) { for (let r = 0; r < rows; r += 1) {
const t = (r + 0.5) / rows const t = (r + 0.5) / rows
const y = -half + config.height * t const y = -half + weaveSpan * t
// The band height is derived from the row count so that rows always
// MEET. It used to be a flat 0.11 of the height while the spacing
// between rows is 1/rows -- 0.167 at the default six -- which left a
// 12 mm gap you could see straight through to the contents. That is a
// slatted crate, not a weave. Rows now overlap slightly; they do not
// z-fight because consecutive rows are undulated half a wave apart, so
// where one bulges out its neighbour is tucked in.
// Alternate rows sit slightly proud of and slightly behind each other.
// This is how a weave really goes together -- the weaver's rod passes
// outside one stake and inside the next, so no two rows lie on the
// same cylinder -- and it is also what makes the overlap above safe.
// Undulating consecutive rows in antiphase is not enough on its own:
// a sine crosses zero, and at those nodes both rows returned to
// exactly `radiusAt(t)`. With a cylindrical basket (taper 0) every row
// shares that radius, so the overlapping bands met in coplanar faces
// at every node.
const lean = r % 2 === 0 ? withy * 0.2 : -withy * 0.2
const ring = bandGeometry( const ring = bandGeometry(
radiusAt(t), y, config.height * 0.11, withy * 0.8, stakes * 2, radiusAt(t) + lean, y, (weaveSpan / rows) * 1.06, withy * 0.8, stakes * 2,
tint('straw', jitter(random, 0.07), 1.2), tint('oak', 0.04 + jitter(random, 0.07), 1.2),
) )
// The phase shifts by half a wave on every row: the next row going in // The phase shifts by half a wave on every row: the next row going in
// where the previous one came out is what makes a weave a weave. // where the previous one came out is what makes a weave a weave.
@ -152,7 +197,7 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(flipGeometry(latheGeometry([ pieces.push(flipGeometry(latheGeometry([
{ y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) }, { y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) },
{ y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) }, { y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) },
], stakes * 2, [0, 0, 0], tint('straw', -0.2, 1.1), { ], stakes * 2, [0, 0, 0], tint('oak', 0.06, 1.1), {
capTop: false, capTop: false,
capBottom: false, capBottom: false,
}))) })))
@ -161,15 +206,24 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
pieces.push(latheGeometry([ pieces.push(latheGeometry([
{ y: -half - config.height * 0.01, radius: bottomRadius * 0.94 }, { y: -half - config.height * 0.01, radius: bottomRadius * 0.94 },
{ y: -half + config.height * 0.05, radius: bottomRadius * 0.99 }, { y: -half + config.height * 0.05, radius: bottomRadius * 0.99 },
], stakes * 2, [0, 0, 0], tint('straw', -0.14, 1.2), { capTop: true })) ], stakes * 2, [0, 0, 0], tint('oak', -0.14 + 0.04, 1.2), { capTop: true }))
// --- Rim ----------------------------------------------------------------- // --- Rim -----------------------------------------------------------------
// The thick bend that finishes the weave. It is the most visible detail on // The thick bend that finishes the weave. It is the most visible detail on
// the basket, and without it the edge looks "cut off". // the basket, and without it the edge looks "cut off".
const rim = mergeColoured([ const rim = mergeColoured([
// Thickness withy*2.1, not 1.5, and the reason is arithmetic rather
// than taste. At 1.5 the rim's inner surface landed at
// radius*1.015 - withy*1.5 = 0.16055, and the inner liner sits at
// radius*(1 - amplitude) = 0.16065 -- a tenth of a millimetre apart,
// by coincidence. On a cylindrical basket (taper 0) those are the same
// 22-sided prism and every facet of it z-fought. The thicker rod
// carries the inner face clearly past the liner, and it is the truer
// shape anyway: the rim is the heaviest rod in a basket, bent over the
// finished weave, and it stands proud on both sides.
bandGeometry(config.radius * 1.015, half - config.height * 0.03, bandGeometry(config.radius * 1.015, half - config.height * 0.03,
config.height * 0.1, withy * 1.5, stakes * 2, config.height * 0.1, withy * 2.1, stakes * 2,
tint('straw', 0.07, 1.2), { inner: true }), tint('oak', 0.07 + 0.04, 1.2), { inner: true }),
]) ])
// --- Contents ------------------------------------------------------------ // --- Contents ------------------------------------------------------------
@ -203,13 +257,23 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
const ring = Math.sqrt((i + 0.4) / count) const ring = Math.sqrt((i + 0.4) / count)
const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6) const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6)
const spread = inner * ring const spread = inner * ring
const layer = Math.floor(i / Math.max(3, Math.round(count * 0.55))) // Fewer fruit per layer means MORE layers, and it is the layer count
// that decides whether the heap ever reaches the mouth. At 0.55 the
// default nine apples formed two layers topping out 12 cm below a rim
// 10 cm up: correctly resting on the base, and completely invisible.
// Resting on the base was the fix for an earlier bug where the produce
// hung level with the rim over a gap; the fix was right and the
// consequence -- that a deep basket then needs enough fruit to fill it
// -- was not followed through.
const layer = Math.floor(i / Math.max(3, Math.round(count * 0.38)))
fruit.rotateX(jitter(random, 0.6)) fruit.rotateX(jitter(random, 0.6))
fruit.rotateZ(jitter(random, 0.6)) fruit.rotateZ(jitter(random, 0.6))
fruit.translate( fruit.translate(
Math.sin(angle) * spread, Math.sin(angle) * spread,
// Base top + one radius = resting on the floor of the basket. // Base top + one radius = resting on the floor of the basket.
-half + config.height * 0.05 + size * (0.92 + layer * 1.5) // Layers nest at 0.95 of a diameter, not 1.5: stacked fruit settles
// into the gaps of the layer below rather than sitting on top of it.
-half + config.height * 0.05 + size * (0.92 + layer * 0.95)
- ring * size * 0.28 + jitter(random, size * 0.08), - ring * size * 0.28 + jitter(random, size * 0.08),
Math.cos(angle) * spread, Math.cos(angle) * spread,
) )
@ -217,8 +281,8 @@ export function createModel(overrides: Partial<WickerBasketConfig> = {}) {
} }
return { return {
weave: { slot: 'straw' as const, geometry: mergeColoured(pieces) }, weave: { slot: 'oak' as const, geometry: mergeColoured(pieces) },
rim: { slot: 'straw' as const, geometry: rim }, rim: { slot: 'oak' as const, geometry: rim },
contents: contents.length > 0 contents: contents.length > 0
? { slot: 'produce' as const, geometry: mergeColoured(contents) } ? { slot: 'produce' as const, geometry: mergeColoured(contents) }
: undefined, : undefined,