Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

11.1 KB
Raw Blame

Optional projects and exact material dependencies

A workspace provides Kiln's tools and local storage. A project adds a versioned brief, inventory, design profile, references, delivery intent and material lock for related assets. A collection stores saved asset revisions. The default collection is named project; saving there does not require or create a project record.

The dashboard's Library aggregates configured storage collections. Register another asset store explicitly with node kiln.mjs collections add <alias> <absolute-directory> (on Windows a drive or share path such as C:/Users/you/assets; a Git Bash /c/... path is refused) and restart the host; assets --all / kiln_assets action catalog list them together. Keep collection IDs in exact asset references because IDs can collide across stores. Use named project inventory links for membership, independently of where bytes live. The viewer can link, replace or remove a membership; CLI/MCP use the same expected- revision project update with the intended inventory. Removing membership never deletes an asset. One asset can belong to multiple projects; standalone remains valid.

For live iteration, optionally set KILN_WORK_ITEM to a stable lowercase identifier for one asset/candidate before starting CLI/MCP. Keep it across that item's revisions, use distinct IDs for independent candidates, and restart MCP to change it. Historical unbound operations remain ungrouped. view --observe-workspace <directory> can inspect another explicitly registered observation source without merging its project identity.

Use a project when shared art direction or an inventory helps the requested work. An individual asset, experiment or environment can stay standalone. Do not infer project membership from its presence in the same directory. Different projects can use different styles, materials and budgets.

Standalone authoring

Normal authoring needs no project setup. Omitted selection stays standalone unless the host explicitly configured KILN_PROJECT. CLI --no-project or MCP projectId: null overrides that default. Do not combine an explicit opt-out with a project revision. Materials and Live Review work in either mode.

node kiln.mjs render asset.kiln.js --no-project --out asset.glb --views review.png
node kiln.mjs view

The CLI writes the review image to disk; read it before judging appearance. The browser loads retained GLB artifacts and does not build another copy. When GPU material evidence is required, add --render gpu and check actual view fidelity.

For library materials, use CLI material create-preset --file options.json, then material get MATERIAL_ID REVISION for the code-ready portableSpec. Custom recipes use material procedural --file draft.json. These CLI paths do not need an internal dist/ import or an extra TypeScript loader. Copy the returned spec into source, compile schemaVersion 2 with compilePortableMaterialSpecV2 or schemaVersion 3 with compilePortableMaterialSpecV3, and supply the exact pins below.

For a texture without geometry, create the material directly; do not invent a mesh or project just to save PNG maps. Read shape:material-draft with Discovery. Unversioned layered drafts keep their existing V1 records. Opt-in schemaVersion:2 material drafts add explicit samplers and a procedural V3 RGBA recipe or atlas recipe per map. The material-record version and texture- recipe version describe different contracts. V3 recipes support rectangular surfaces and alpha; a mask material still needs actual opaque and transparent texels to produce a cutout.

An atlas resource source names an exact map resourceId plus its material revision pin. It does not load arbitrary URLs or paths. Save sources first, reuse returned identifiers, then create the atlas. The library resolves the transitive closure. Export a saved material with node kiln.mjs material export MATERIAL_ID REVISION --out material.json and import that complete payload with material import --file material.json; copying only the atlas PNG loses editable sources and named regions. For a destination that takes plain images, such as a terrain layer, material export MATERIAL_ID REVISION --maps DIR --size 1024 --repeat 4 writes each map as a tiling PNG, a .maps.json sidecar (slot, colour space, size, repeat, sha256) and a tiled preview; read the preview's viewFidelity before judging the material from it.

Create and revise a project when useful

Discover optional kiln_project, kiln_material and kiln_review tools from the connected host. A custom embedding may omit them. These are equivalent entry points:

node kiln.mjs project create --id my-pack --name "My pack"
node kiln.mjs project get my-pack
node kiln.mjs project update my-pack --expected RETURNED_REVISION --file patch.json
{"action":"create","draft":{"projectId":"my-pack","name":"My pack"}}

Pass that JSON to kiln_project. To update, use {action:"update", projectId:"my-pack", expectedRevision: RETURNED_REVISION, patch}. Copy the returned revision exactly. A stale revision reports a conflict: read the current configuration and reconcile changes before retrying. Every supplied top-level field replaces its previous value. Read and merge the full design object before changing one nested preference; sending only design.style also clears omitted palette, material roles and conventions to defaults. Preserve array entries the task does not remove.

Fill only the fields useful to the user's request. An example patch.json is:

{
  "brief": "A coherent set of workshop props for a browser game",
  "design": {
    "style": "Readable stylized shapes with restrained surface detail",
    "scale": "Metres; +Y up; objects rest at Y=0",
    "palette": [{"role":"paint","color":"#526D75"}]
  },
  "inventory": [
    {"id":"workbench","name":"Workbench","kind":"asset","brief":"A usable work surface"}
  ]
}

Project creation and dashboard selection do not activate a project for future authoring. Select it on each operation:

node kiln.mjs render asset.kiln.js --project my-pack --project-revision RETURNED_REVISION --out asset.glb

MCP authoring uses projectId and optional projectRevision. Omit only the revision when the intended configuration is the project's current revision. A project is editable design guidance, not trusted requirements or release authorization.

Use library materials with or without a project

Inspect kiln_material with action: "presets", "list" or "get". CLI equivalents are material presets, material list, and material get ID REVISION. Creation and import preserve creator, license, recipe/seed and source provenance. Copy the returned portableSpec into source and select its matching V2 or V3 compiler; the host provides the selected immutable map bytes before evaluating source.

A pin uses the returned material ID as resourceId; both hashes equal its returned immutable revision. pins.json is an array:

[
  {"resourceId":"RETURNED_MATERIAL_ID","revisionId":"RETURNED_SHA256_REVISION","sha256":"RETURNED_SHA256_REVISION"}
]

For standalone work, pass this array as MCP materialDependencies, or use node kiln.mjs render asset.kiln.js --no-project --materials pins.json --out asset.glb. Use the same pins on later edit, inspect, animation and save calls that evaluate the source. The source reference alone does not restore dependency context.

For a project, put the pins in its materialDependencies through a revision-aware update. A project-bound invocation (projectId, plus projectRevision for an exact configuration) implies that revision's pins, so the call need not repeat them. Call-level pins add resources, and a call-level pin for a resource the project already pins replaces the project's for that call. Update the lock deliberately when changing shared art direction. A missing resource or mismatched hash must be resolved before building; neither source URLs nor material names authorize an implicit download.

Keep project defaults to a deliberate shared authoring palette, not every material used anywhere in a growing inventory. An evaluation currently resolves at most 16 resources, including transitive dependencies; call-level pins replace matching defaults but do not remove unrelated defaults. If that merged context exceeds the budget, use an explicit standalone operation with the asset's complete small pin set, then link the exact saved revision to the project. Refine the project defaults through a deliberate revision update. Saved asset closures retain their own exact materials independently of those authoring defaults.

Material records carry physical repeat scale, but the author controls mesh UV scale. Review seams, repeats, roughness and normal strength on representative geometry with actual GPU views. A project palette is guidance, not automatic recoloring. Keep explicit nearest sampling for a requested pixel texture local to that material. Smooth or physically based materials may need linear filtering and mipmaps; neither a project nor an atlas implies one sampling policy.

Retain and deliver the work

kiln_review can list/get observed operations, pin them against ordinary eviction, and save an exact reviewed operation using its expectedRevision. Pinning does not pause the agent; feedback still belongs in the agent's conversation. Saved collection revisions are durable; observation history is bounded and disposable.

Preserve the returned collection, asset and revision IDs. When an asset belongs to an inventory entry, bind that exact saved revision with a project update. A later asset revision does not silently update the project inventory.

When modules are composed, such as room pieces saved separately and assembled at one origin, state each item's placement: optional translation (metres), rotation (Euler XYZ degrees) and scale, with {} meaning the shared origin. Only items that state one are composed; a missing placement means not composed, never identity, so leave it off unrelated props. Then project check ID reports parts of different modules that share volume or where a cloth reaches inside a neighbour, and each save of a placed asset under its project returns the same report. A draft is not measured until it is saved. See kiln-qa-asset/references/integration-checks.md.

Deliver a standalone asset directly through its collection exports. When delivering a pack, project export ID --revision REVISION --profile editable|runtime --out FILE packages the linked saved inventory. Editable delivery needs source, build settings and complete normalized material resources; runtime delivery needs the GLB and its metadata. Project packages exclude referenced concept-image and original acquisition archive bytes. Verify the actual exported files and rebuild resource-dependent editable deliveries in an independent workspace. Do not create a dummy project for delivery.

After import, node kiln.mjs asset ASSET_ID ASSET_REVISION --rebuild --out rebuilt.glb uses the saved dependency revisions and exporter settings. It reports artifact hash equality; historical assets without complete settings need an explicit new build. Building or saving does not establish visual, game-runtime or release acceptance.