MATERIA

this is the page as it was on 2026-11-19 23:25 — all versions

TROY

MATERIA (Latin materia, "matter, stuff", and also the timber a thing is built from) is the one way every TROY app asks what a thing is made of. It is not an app. It is a small contract and a library behind it, written in GLSL: give it a kind of material and a point in space, in millimetres, and it says what is there — its colour, how shiny it is, whether it is metal, how much light gets through, and how far the surface stands proud. METOPE, SPOLIA, LAPIDEO's ROMA lab and POLYCHROMIA all ask it the same way, so a Carrara in one is the same Carrara in all of them.

Settled on 2026-11-10, when Auriea said "I do want all of these apps to use the same paradigm." State on 2026-11-19. The last section says what is not there yet.

Contents

  1. The question
  2. Skins
  3. The table of kinds
  4. The set
  5. How the apps carry it
  6. Where it lives
  7. Not there yet

The question

Every app asks one thing:

Mat matAt(float kind, vec3 pMm)

Skins

What lies on a surface is a second stage, a skin:

Mat skin(Mat m, vec3 pMm, Surf s, float amt)

The material underneath comes in as m, and amt, from 0 to 1, says how much of the skin is there, so a mask can drive it. Surf tells the skin about the form at that point: its normal, the direction a stroke runs (the brush, the drip), how many millimetres to the nearest edge and to the nearest crease, how shut in the spot is, and how open to what falls from above (dust, rain). So paint can follow a surface, and wear can find an arris. A skin never moves the point, and it may only add its effects of form as an edge or crease comes near: an app that cannot supply a value passes the neutral one, so nothing invents an edge or a shadow that is not there. This is how POLYCHROMIA's Skin layers work, each taking what lies below it and laying something on.

The table of kinds

One table for every app, and a number is never reused, because saved work stores it.

kinds what
0 Plain, the unassigned clay
1–7, 13–21 the stones METOPE and SPOLIA shared first (Carrara, Bardiglio, Nero, Portoro…)
8–12 hardwoods
22–48 SPOLIA's other substances: plaster, metals, earth, ceramic, glass, bone, shell, linen, velvet, blood
49–60 free
61–69 ROMA, nine stones after the churches of Rome: porfido rosso, serpentino, giallo antico, pavonazzetto, bianco, africano, breccia dorata and two alabasters
70–85 from LAPIDEO's presets: Calacatta oro, Verde Guatemala, Statuario, dendrite, ammonite, fasciated amber, and six woods (teak, Douglas fir, mahogany, wenge, zebrawood, macassar ebony)
86–88 malachite, turquoise (2026-11-10) and cast iron (2026-11-13), each asked for by Auriea
89–999 free
1000 and up local: a material made inside one app and carried by the saved piece that uses it

A local number means something only inside its own piece, and two pieces may both have a 1000. The piece stores a name, the GLSL and the version of the core it was written against. If one fails to build on a device, the app shows a plain grey stand-in and says so, and the piece and its stored source stay as they were. A local material that proves itself can be given a number below 1000 and move into the shared table.

The set

The table holds 71 entries in nine families: Roma (9), Marbles (12), Breccias (9), Hard stones (3), Stones (7), Woods (11), Metals (8: gold, gilt bronze, bronze, copper, silver, lead, iron, cast iron), Earth and fire (6) and Soft and living (6, with Plain). Each has a note from where it comes from, e.g. Giallo antico — Chemtou, Numidia · gold limestone healed in red-violet.

What "the ROMA way" means, as the nine stones set it and the rest follow:

The core also holds the tools every material is built from: integer hashes, noise, cells, crystals, veins, fracture sets, the grain of a sawn face, a dragged brush and the breccia clasts.

How the apps carry it

METOPE, SPOLIA and POLYCHROMIA are each one file that works offline, so none can load the shared material files when it runs. Each carries a generated copy, written between MATERIA: markers by its own sync script (_sync-metope.cjs, _sync-spolia.cjs, and _sync-materia.cjs in POLYCHROMIA's folder), all fed by one generator. The copy is never edited by hand. A material is changed in LAPIDEO, looked at in the ROMA lab, and then the scripts are run (each has a --check that says whether its app is up to date).

Each kind is one line in a chain of the exact form if(kind<N.5){ return mkN(p); }, so an app can switch off every kind a piece does not use, the browser's compiler drops the code, and what runs is one small program per material.

MATERIA_VERSION is 2. It goes up by one whenever the shape of the contract changes or a function that exists changes what it returns; adding a function does not count. Version 1 (2026-11-10) added the relief value and skins; version 2 (the same day) added Surf for skins and the local kinds.

Where it lives

In TROY/LAPIDEO/lapideo/: materia-core.js (the contract, the shared tools, the table of kinds), roma-stones.js (kinds 61–69), roma-substances.js (every other kind, with romaKind(kind, pMm), which answers for the whole table), roma.html (the lab) and the generator and sync scripts. The files are plain .js, never .mjs, because the server sends .mjs as text. Related: LAPIDEO-Research, the research behind the marbles and woods.

Not there yet

#ai