Skip to content

feat(kit): finishing pass and wear materials, shown in a Lab world preset - #503

Merged
kitlangton merged 1 commit into
mainfrom
kit-finish
Oct 23, 2026
Merged

kitlangton merged 1 commit into
mainfrom
kit-finish

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What it does. Adds a finishing pass to the kit for code-built props: chamfered edges, baked AO, curvature and sky exposure, and six wear looks with CC0 scans, plus an albedo validator. No game uses it. BARBARA and Outbreak draw byte-identically to main. To see it, open the Lab world preset Finished props: one prop per wear look on the driveway, close up. Materials › Finish has the wear knobs and Albedo check.

How it works.

  1. Mesh.finishPart(look, build, "auto") chamfers the boxes built inside it and tags their vertices. finishTagged / finish() bake AO, curvature and sky exposure into two vertex bytes the layout already had spare (no stride change).
  2. Scene hooks get finish: true. The vertex shader decodes those bytes and wearWgsl wears the surface: edge wear, grime, damp, rain streaks, dust and rust, plus a triplanar scan.
  3. The Lab world builds a separate +finish renderer only while the props or the albedo check are on, and loads the scans lazily. Otherwise the world compiles and draws exactly as before.

Why Outbreak cost +10 ms: geometry, not the shader. Both modes compiled the same shader. A finished fragment does at most 4 texture samples and about 7 noise calls. What grew was the triangle count. A square box is 10 tris; chamfered it is 30, with the 3 cm wear band 70, and up to 114 for a long face. Ash's cabinetry went from 3.7k to 28k tris (7.6×), and the town-7 level grew 17%. Most of the new triangles are slivers of about 1 px at the game camera, which waste whole 2×2 quads under MSAA. About 8.5k came from parts that were chamfered but never tagged, a glue bug in the adoption. Details and advice for a game that opts in are in docs/realism.md.

BARBARA's 7× forest build. The bake (~0.85 s) only ran because the camp opted in. The kit API is lazy, and with the forest back on main's code the build is back to main's.

Risk. Kit, Lab world and docs only. The shared scene shader and Mesh.boxBevel changes are guarded, so with the hooks off the shader text is identical. Checked by hashing every kit scene shader variant, Physical, the forest scene and every Outbreak shader against main, plus Outbreak's level bytes for towns 7 and 3 and the Lab's default world geometry. All identical. The adoption is kept on branch kit-finish-adoption. Albedo follow-ups for each game are in its AGENTS.md (Outbreak: dining table, wallpaper, worktop edges, grout; BARBARA: window glass, string-light wire, litter). Kit's call on whether any game should use this is still pending.

Proof. One headless, muted still of the preset, taken at the first camera, which cut off the cabinet and stone plinth at the ends. The preset now packs the row tighter and sits at 8 m, so all six fit (checked by projecting every prop through the stage camera, not with a second browser run). No page errors.

finished-props

Albedo check on the same view: the lawn and the drum's worn rims read too dark.

albedo-check
  • bun test packages/kit/lab/world packages/kit/gpu/finish packages/kit/gpu/materials packages/kit/gpu/mesh packages/kit/architecture-map (HiveMind): 41 pass
  • bun run --cwd packages/kit typecheck, bun run check:scripts: clean
  • bun run verify:remote: all targets ok
  • bun scripts/lab/prove-finished-props.ts (HiveMind browser, headless, muted): two stills, no page errors

@kitlangton
kitlangton merged commit 29d7b27 into main Oct 23, 2026
14 of 15 checks passed
@kitlangton
kitlangton deleted the kit-finish branch October 23, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant