Repository navigation
feat(kit): finishing pass and wear materials, shown in a Lab world preset - #503
Merged
Merged
Conversation
…reset (no game adopts it)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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).finish: true. The vertex shader decodes those bytes andwearWgslwears the surface: edge wear, grime, damp, rain streaks, dust and rust, plus a triplanar scan.+finishrenderer 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.boxBevelchanges 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 branchkit-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.
Albedo check on the same view: the lawn and the drum's worn rims read too dark.
bun test packages/kit/lab/world packages/kit/gpu/finish packages/kit/gpu/materials packages/kit/gpu/mesh packages/kit/architecture-map(HiveMind): 41 passbun run --cwd packages/kit typecheck,bun run check:scripts: cleanbun run verify:remote: all targets okbun scripts/lab/prove-finished-props.ts(HiveMind browser, headless, muted): two stills, no page errors