SyntheticCatalog: the single definition of every material in syntheticsMaterials.
`C.build()` writes materials/<id>.material/mat.yaml for each material and the
collection's collection.yaml (tags; roughness measured from the baked masks;
textureKB measured from the textures each material binds). Re-runnable: it
overwrites the same files every time. Tool code (it writes files): call it from
a tool, a test or an execute call, never from a component. After fabricsMaterials'
FabricCatalog (Warp and Weft, MIT), itself after masonryMaterials' MasonryCatalog.
Real sizes (1 unit = 1 m). A textured material repeats once per UV unit (the
materialLibraryKit convention) and `tileSize` says how many metres that is. Each
repeat holds a whole number of its features, so it tiles exactly:
carbon twill 2/2 twill, 2.0 mm 3K tows, 16 x 16 tows -> 32 mm
forged carbon chopped chips 8 to 30 mm long -> 150 mm
flake paint aluminium flakes 0.2 to 0.5 mm (pearl: the same, halved) -> 50 mm / 25 mm
studded rubber 26 mm studs on a 50 mm square grid, 4 x 4 -> 200 mm
diner vinyl two 120 mm channels with stitched seams -> 240 mm
open-cell foam cells 0.6 to 1.2 mm -> 60 mm
A material with no texture is the same everywhere; its tileSize is 1.
flat(what: string, across: string) → string
| arg | type | description |
|---|
| what | string | |
| across | string | |
sample(what: string) → string
| arg | type | description |
|---|
| what | string | |
toon(what: string) → string
| arg | type | description |
|---|
| what | string | |
stylised(what: string) → string
| arg | type | description |
|---|
| what | string | |
get(id: string) → Entry
The definition of one material, or nil.
| arg | type | description |
|---|
| id | string | |
ids( ) → void
Every material id, in catalog order.
texRef(name: string) → string
| arg | type | description |
|---|
| name | string | |
hasTexture(name: string) → boolean
| arg | type | description |
|---|
| name | string | |
texName(s: Entry, slot: string) → string
The texture name a material uses for a slot ("albedo", "normal" or "mask"): its own <id>_<slot>, or the shared one its entry names.
| arg | type | description |
|---|
| s | Entry | |
| slot | string | |
galleryLayout(list: { any }, minSize: number) → void
The gallery page size and page that show every material of this collection, and nothing else, on one ring of materialLibraryKit's "all" view, for `list` = Materials.list(). Mirrors the core Gallery's pagination. After fabricsMaterials' FabricCatalog.galleryLayout (MIT).
| arg | type | description |
|---|
| list | { any } | |
| minSize | number | |
pageAt(size: number) → number
| arg | type | description |
|---|
| size | number | |
materialDoc(s: Entry) → void
The mat.yaml document for one material. Solid objects: back faces culled. A textured material repeats once per UV unit (`tileSize` metres).
flowLists(text: string) → string
Collapse YAML block lists of plain numbers into flow lists (`[a, b, c, d]`). The engine's material loader reads a colour property only in flow form: a block list is dropped silently and the shader default (white) drawn, while plain numbers read either way.
| arg | type | description |
|---|
| text | string | |
writeMaterial(s: Entry) → void
Write materials/<id>.material/mat.yaml for one material (creating the asset the first time).
round(x: number, d: number) → number
| arg | type | description |
|---|
| x | number | |
| d | number | |
costWord(kb: number) → string
The texture-cost tag: textures-none (0 KB), textures-tiny (under 128 KB), textures-light (under 1.5 MB), textures-medium (under 2.5 MB) or textures-heavy.
| arg | type | description |
|---|
| kb | number | |
finishWord(median: number, coatRough: number?) → string
The finish tag from the median roughness, with the clear coat taking precedence: glossy (under 0.25, or any coat under 0.15), satin (under 0.6) or rough.
| arg | type | description |
|---|
| median | number | |
| coatRough | number? | |
metalWord(m: { number }) → string
The metal tag from a metallic range: non-metallic, metallic or part-metallic.
| arg | type | description |
|---|
| m | { number } | |
measureRoughness(s: Entry) → void
The roughness range (2nd and 98th percentile of the mask's G channel) and median of a material's baked mask, or nil when it has none.
at(p: number) → number
| arg | type | description |
|---|
| p | number | |
tileWord(s: Entry) → string
The `tile-<metres>m` tag for a tile size (three decimals at most); "tile-uniform" for an untextured material.
lobeWords(s: Entry) → void
The lobes and layers a material's shader turns on, as tags.
mipBytes(size: number) → number
GPU bytes of one square block-compressed texture (1 byte per pixel, BC7 / ASTC 4x4) with its full mip chain.
| arg | type | description |
|---|
| size | number | |
roughnessRange(s: Entry) → void
The roughness range of a material: measured from its mask, else its constant roughness.
metalRange(s: Entry) → void
The metallic range of a material.
textureNames( ) → void
Every texture name this package's materials bind, each once.
currentName(id: string) → string
The current name for a material id: itself, or the material an earlier name now is.
| arg | type | description |
|---|
| id | string | |
writeAliases( ) → number
Write materials/<old>.material for every earlier name in C.ALIASES: the same mat.yaml as the material it was renamed to.
writeBoards( ) → number
Write boards/<id>.material for every material: its reference picture on the engine's unlit shader, which the showcase hangs beside the material. Returns the count.