MATERIA
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. Since 2026-11-20 it has a second shared part beside the materials: how stone is cut into pieces and laid (see Laying).
Settled on 2026-11-10, when Auriea said "I do want all of these apps to use the same paradigm." State on 2026-11-20. The last section says what is not there yet.
Contents
The question
Every app asks one thing:
Mat matAt(float kind, vec3 pMm)
- The material is a field in the solid, in millimetres. There are no UVs, so there are no seams. Carve it, bake it, cut a tessera from it, and the figure is in the body of the stone.
- A material is a recipe, not a setting. No seeds and no sliders. "Another block" is another place: the app moves the point.
- One evaluation answers everything. The answer has five values: the albedo (linear colour), the roughness, the metal (0 or 1: gold, bronze and leaf are 1, stone is 0), the trans (how much light passes through, from 0 to 1: clear glass is 1, alabaster .45, shell .3, stone 0) and the relief in millimetres (+ stands proud, − lies lower; hundredths of a millimetre on a polished stone, the trace polishing leaves between hard and soft minerals; wear and paint change it, and a baker turns it into the normal map).
- The app says how finely to look. It sets the millimetres per sample (a pixel on screen, a texel in a bake) before it asks, and nothing in a material reads the screen. Fine tooth fades out as the sample gets coarser instead of shimmering.
- The same stone on every GPU. Hashes are integer hashes (a
sin()hash drifts between devices), and the code needs WebGL 2.
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–91 | laterite, Khmer sandstone and limestone (2026-11-20), made after Auriea's Megascans scans of temple and Roman walls |
| 92 | grey granite (2026-11-20), after her scan of a Roman wall at Mérida |
| 93–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 75 entries in nine families: Roma (9), Marbles (12), Breccias (9), Hard stones (3), Stones (11), 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:
- Crystals are crystals: rotated boxes cut by the face, so porphyry shows laths, rhombs and hexagons, not round dots.
- Breccias have a size hierarchy. Big clasts come first and smaller ones fill only what is left, so no two fragments overlap and the crush fills the gaps. Every clast carries its own figure and a rim.
- Veins are fracture sets that come and go along their length, not worms. Beds are of unequal width with one hard edge and one soft.
- A field a few hundred millimetres across decides which block this is, so two tesserae cut far apart are two different stones.
- Everything gives relief: a travertine's holes are holes, a weave has crowns, hammered metal has facets.
- Wood, shell and linen need a direction and a solid has none to be told, so wood grows along x in logs about 640 mm across, and linen is woven layers lying in the solid's xy plane.
The four newest stones were made from scans rather than from the books: the colours measured from a scan's colour map and the scale of the pores and grain taken from its size, then judged by eye in the ROMA lab and on a wall beside the scan. Laterite is the Khmer building stone of Koh Ker and Angkor: a dark umber body under a rust-red crust, worn to tan-buff in small broken patches, and honeycombed with clustered pores and short worm-like tubes, 2 to 15 mm across, that are real holes in the relief. Khmer sandstone is the carving stone of the same temples: dark chocolate with a grey-purple cast, very fine, with faint bedding, iron-stained patches and blots of pale lichen. Limestone is a plain fine buff stone of Roman walls, which Travertine (holes and beds) is not: warm cream with a few small pores and the odd fragment of shell. Grey granite is the building granite of Roman Mérida, weathered and never polished: a grey-brown ground of small grains with pink-buff feldspar crystals standing in it, 4 to 11 mm long and cracked across, and ragged specks of black mica. One block is grey and the next washed a warm pinkish brown where the iron has come out, with grey-brown grime lying over it. It is the grey-buff granite beside the rose granite of Syene.
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.
Laying
The second thing every TROY app can share is how a surface is cut into pieces, each piece cut from its own block of stone. It began with Auriea's wish, in POLYCHROMIA's talk about stone on 2026-11-20, for "an ancient stone tomb wall, an aged travertine pavement, or even the cosmatesque church floor", and her yes to "Cosmati first". It lives in its own file, materia-lay.js, and changes no material.
Lay layCosmati(vec2 x, int pat)
x is a point on the floor in millimetres and pat is the way of laying: Rota, Quincunx, Band of discs, Squares, Triangles or Hexagons. It answers with four things: how many millimetres the point is from the piece's own edge (negative inside the piece, positive in the joint, which is the mortar; the edge is cut by hand and chipped by time, so it wavers a little), the piece's own random numbers (the same all over it: which block it was cut from and how it was turned), which of six places the piece belongs to (the discs and the purple points, the green points, the gold pieces, the veined white, the white of the large pieces, and the rare piece), and a point, c, that is the same everywhere inside one piece: the cell's centre, the hexagon's, the rota's, the panel's. It need not be the true middle of the piece; what matters is that it stays fixed to it. The layout does not choose the stone. The app fills each place with one, or with a ready set (Roma, Black and white, Rosso and verde, Gems, Woods, Metals, Earth and fire).
Each piece is then cut from a block of its own, at its own angle, by asking the material for a point that is turned and moved for that piece, so no two pieces match and the veins do not run on from one piece into the next. A piece set flush has no exposed edge, so a skin laid on it sees a crease at the joint and no arris.
Walls in courses of squared blocks, for a tomb wall, sit beside the floors in the same file:
Lay layCourses(vec2 x, float H, float uneven)
H is the height of a course in millimetres and uneven runs from 0 (every course alike and every block the same length) to 1 (courses from about .6 to 1.4 H and blocks from about 1.3 to 2.6 times their course, every joint staggered). The answer has the same form as a floor's: the distance from the block's edge, with zero on the joint line, the block's own numbers, which of six places it is filled from, weighted 70, 15, 8, 4, 2 and 1 percent so that most blocks are one stone and the rare one is rare, and the block's centre. Ten ready sets of stones for a wall come with it: travertine, laterite, Khmer sandstone, limestone, tuff and peperino, marble, sandstone, granite, grey granite and basalt. A wall block is cut in its natural bed, so a travertine's beds run level, as a mason lays them.
Repeat
A floor can be made to repeat, so that its texture tiles: POLYCHROMIA's Tile piece needs maps whose edges join, in Unreal and anywhere else they are laid side by side. The app asks for it by setting one global before it asks for a floor:
layRep = vec4(1., W, H, 0.)
where W and H are the width and height of the tile in millimetres. Left at 0, the default, every pattern draws exactly as before (checked on forty thousand points of each: the same piece, kind and numbers, the distance within a few hundred-thousandths of a millimetre). Switched on, the floor repeats with period W by H: the pieces' random numbers are taken from cell numbers wrapped to the tile, so a piece that runs across the join is the same piece on both sides, and the hand-cut wobble is value noise whose lattice fits the tile in whole cells. Checked in the same way, the answer at a point and at the point one tile away match to a thousandth of a millimetre, and drawn two tiles by two, no pattern shows a seam.
A piece that the tile's edge cuts has one more thing to get right: its stone. If the app turns and moves the point by where x is, the two halves of the piece get two unrelated bits of stone. The point c is what prevents that: with repeat on, x − c is the same on both sides of the edge, so the app takes the stone at the turned point x − c instead of at x and the piece is cut from one block. (Checked: x − c one tile away matches to four ten-thousandths of a millimetre, and c is the same at neighbouring points of one piece, for every pattern. In POLYCHROMIA's Tile, moving the layer half a tile and baking again at 2K gives the same relief everywhere and the same colour but for a few hundred scattered texels of four million.)
A tile must be a whole number of the pattern's own period, which MATERIA_LAY_PERIOD lists for each pattern as the width, the height, and the fewest periods to a side:
| pattern | period (mm) | notes |
|---|---|---|
| Rota | 62.226 by 62.226, at least 6 | one great rota to a tile, in a field of squares |
| Quincunx | 904 by 904 | two panels each way, so the panels' checkerboard closes |
| Squares | 62.226 by 62.226 | |
| Triangles | 64 by 110.851 | an oblong tile |
| Hexagons | 66 by 114.315 | an oblong tile |
| Band of discs | does not repeat |
Courses do not take part: the caller wraps a wall itself. POLYCHROMIA's Blocks layer is the first to use laying, as a skin whose places each take any stone, with its Wear (polished to worn), Joints, Size and Mortar; the ROMA lab's Floor view draws the same floors.
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). POLYCHROMIA's script also fills the laying (MATERIA:LAY, the code, and MATERIA:LAYSET, the names, sizes, places, sets and periods); SPOLIA and METOPE do not use it.
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.
- LAPIDEO holds the definition files and the ROMA lab (
roma.html), the one place that shows the whole table by itself: every kind on a Slab, a Solid block, a Floor, a Sheet of its whole family, or Before · after; Polished, Worn or Painted; a width in millimetres, relief as a grey map, another block, and save as a PNG. It reads the table, so a new kind turns up in it without anyone editing it. It runs from LAPIDEO's folder and is not on the website. - SPOLIA is on the whole table, under the kind numbers it already stored (live 2026-11-11).
- METOPE is on it too (live 2026-11-11), and asks for a material's colour and roughness only for now.
- POLYCHROMIA uses all five values, and draws every material in its Library as a 120 mm ball made by that kind's own code, at true size (first version 2026-11-11, live 2026-11-12). Its Library is the everyday place to see materials together with the skins and layers that go on them.
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. Laying, added later, is a new file, and new kinds are new table entries; neither changed the number.
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), materia-lay.js (laying), 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
- METOPE does not yet use a material's metal, light-through or relief.
- Local materials (1000 and up) are written into the contract, but no app makes or carries one yet (checked 2026-11-19).
- A new kind reaches each app's code at once, but not each app's lists. SPOLIA's material pickers and METOPE's list of block materials do not yet show cast iron, laterite, Khmer sandstone, limestone or grey granite (kinds 88 to 92), and SPOLIA's highest pickable kind is still 87. POLYCHROMIA lists every kind by itself.
- Laying: the ROMA lab still carries its own copy of the floors and has not moved onto
materia-lay.js, and so does not repeat. Band of discs does not repeat, and slabs for pavements are to come. The repeat andchave not yet been checked in Unreal. - The ROMA lab is local only: it is not on the website, so the materials can be looked at in one place only on the Mac that has LAPIDEO's folder.