BATTLEBOX: Robot Combat Arena
- ..
- .metadata17 B
- README.md12.7 KB
- package.yaml458 B
- textures
README.md
metalsMaterials: Forge and Patina
28 seamless, real-scale, physically based metals for the materialLibraryKit material library, from mirror chrome to flaking rust, plus a toon set. Version 1.0.1.
New in 1.0.1:
- The examples and the package's own code reach the core as
~materialLibraryKit, so they work in a fresh world where the core was installed as a dependency under/source/deps/. 1.0.0 used@root::, which only finds the core at the top of a world. - Six metals were reworked against their reference pictures. Chipped painted metal is now covered in chips. Copper patina is streaky verdigris with no repeating blotches. Hammered copper is bright orange copper. Hand-painted iron is a dark riveted iron plate. Damascus steel's folded pattern now holds up at a distance on a wall (0.6 m repeat). Polished gold reads gold on flat faces.
Install it and the metals turn up in the library's list, picker and swatch gallery on every player's machine, with no setup code. The materialLibraryKit core (1.1.0) is a declared dependency, so it installs along with this package.
Install and use
Install the package from ZeroMind (search "metalsMaterials" or "Forge and Patina", or install the published package 5e629c69-714e-4e53-99bb-f7b64222b316). It lands at /source/metalsMaterials.package; the core comes with it as a dependency under /source/deps/. Scripts reach the core by its package name with ~, wherever it was installed (@root:: would only look at the top of your world). Then, from any script:
local Materials = require("~materialLibraryKit.Materials")
local cube = entity.spawn("cube", { components = { Model = { model = "cube" } } })
cube.localPosition = { 0, 1, 3 }
Materials.apply(cube, "brushedSteel") -- every player sees it
-- swapping the metal changes only the name
Materials.apply(cube, "copperPatina")
for _, m in Materials.list({ collection = "metals", kind = "iron" }) do
print(m.id, m.style, m.tileSize, m.textureKB)
end
To walk round every metal, drop the gallery into a scene. MetalsShowcase opens it on the metals page and hangs each metal's reference picture beside it.
This example does not work yet in a world that installed metalsMaterials fresh from ZeroMind. It stops with SwatchGallery is not a registered component type. The install brings the materialLibraryKit core only partly, without its SwatchGallery component (OrigoZero/ZeroMind#2862), so there is no gallery to add. The first example, which applies and lists metals, does work. To see the gallery today, open the "Forge and Patina: The Metals Material Collection" world, where it is already set up.
local g = entity.spawn("Gallery")
g.component.add("SwatchGallery", {})
g.component.add("MetalsShowcase", {})
The world this package comes from, "Forge and Patina: The Metals Material Collection", opens straight into that gallery, with the lighting looks (daylight, overcast, golden hour, moonlight, warm interior, studio) switchable live from the toolbar.
The metals
Every metal is tagged category = metal, with its kind, its style, tileSize (metres covered by one texture repeat), roughness and metallic ranges, textureKB (GPU texture memory, mipmaps included), animated = false, and plain search words. Filter on any of them, for example Materials.list({ collection = "metals", search = "rusted" }) or Materials.list({ style = "toon", kind = "copper" }).
| Name | Metal | Kind | Style | Tile (m) | Roughness | Metallic | Texture memory | Search words |
|---|---|---|---|---|---|---|---|---|
steelRaw | Raw mill steel | steel | realistic | 1 | 0.49–0.7 | 0–1 | 4.0 MB | raw, mill scale, hot rolled, industrial, bare |
brushedSteel | Brushed steel | steel | realistic | 0.5 | 0.3–0.41 | 1 | 1.0 MB | brushed, satin, stainless, grain, appliance |
polishedChrome | Polished chrome | steel | realistic | 0.5 | 0.06–0.08 | 1 | 341 KB | polished, mirror, chrome, shiny, plated |
galvanisedSteel | Galvanised sheet | steel | realistic | 0.5 | 0.2–0.54 | 1 | 1.0 MB | galvanised, zinc, spangle, sheet, crystalline, patterned |
corrugatedSheet | Corrugated sheet | steel | realistic | 0.762 | 0.36–0.53 | 1 | 1.3 MB | corrugated, ridged, roofing, sheet, galvanised, patterned |
diamondPlate | Diamond tread plate | steel | realistic | 0.5 | 0.66–0.75 | 1 | 5.3 MB | tread, diamond plate, checker plate, floor, industrial, patterned |
damascusSteel | Damascus steel | steel | realistic | 0.6 | 0.44–0.58 | 1 | 4.0 MB | damascus, folded, pattern welded, blade, etched, patterned |
castIron | Cast iron | iron | realistic | 0.5 | 0.74–0.85 | 1 | 1.3 MB | cast, sand cast, rough, dark, foundry |
rustedIronLight | Rusted iron (light) | iron | realistic | 1 | 0.45–0.89 | 0–1 | 5.3 MB | rusted, rust, weathered, surface rust, corroded |
rustedIronHeavy | Rusted iron (heavy) | iron | realistic | 1 | 0.55–0.93 | 0–1 | 5.3 MB | rusted, rust, weathered, heavy rust, corroded, scale |
rustedIronFlaking | Rusted iron (flaking) | iron | realistic | 1 | 0.31–0.93 | 0–1 | 5.3 MB | rusted, rust, flaking, peeling, bare metal, corroded |
rustedIronBlocky | Rusted iron (blocky shapes) | iron | realistic | 1 | 0.55–0.93 | 0–1 | 4.0 MB | rusted, rust, triplanar, blocky, no uv, world space, level blockout |
aluminiumBare | Bare aluminium | aluminium | realistic | 0.5 | 0.37–0.48 | 1 | 1.0 MB | aluminium, aluminum, bare, mill finish, light |
anodisedRed | Anodised aluminium (red) | aluminium | realistic | 0.5 | 0.39–0.44 | 1 | 683 KB | anodised, anodized, coloured, red, satin |
anodisedBlue | Anodised aluminium (blue) | aluminium | realistic | 0.5 | 0.39–0.44 | 1 | 683 KB | anodised, anodized, coloured, blue, satin |
anodisedBlack | Anodised aluminium (black) | aluminium | realistic | 0.5 | 0.39–0.44 | 1 | 683 KB | anodised, anodized, coloured, black, satin, camera body |
copperNew | New copper | copper | realistic | 0.5 | 0.14–0.2 | 1 | 341 KB | copper, new, polished, shiny, warm |
copperPatina | Copper with patina | copper | realistic | 1 | 0.38–0.88 | 0–1 | 5.3 MB | patina, verdigris, weathered, green, aged, roof |
hammeredCopper | Hammered copper | copper | realistic | 0.3 | 0.24–0.36 | 1 | 1.0 MB | hammered, dimpled, handmade, planished, copper, patterned |
brass | Brass | brass | realistic | 0.5 | 0.2–0.28 | 1 | 341 KB | brass, polished, yellow, fittings |
bronze | Bronze | bronze | realistic | 0.5 | 0.37–0.56 | 1 | 1.0 MB | bronze, cast, statue, warm, aged |
polishedGold | Polished gold | gold | realistic | 0.5 | 0.11–0.15 | 1 | 341 KB | gold, polished, shiny, precious, jewellery |
polishedSilver | Polished silver | silver | realistic | 0.5 | 0.09–0.12 | 1 | 341 KB | silver, polished, shiny, precious, cutlery |
paintedMetalChipped | Painted metal (chipped) | steel | realistic | 1 | 0.45–0.84 | 0–1 | 5.3 MB | painted, chipped, worn, edges, machinery, green |
toonSteel | Toon steel | steel | toon | 1 | 0.4 | 0 | 85 KB | toon, cartoon, cel, stylised, steel |
toonGold | Toon gold | gold | toon | 1 | 0.4 | 0 | 85 KB | toon, cartoon, cel, stylised, gold, treasure |
toonCopper | Toon copper | copper | toon | 1 | 0.4 | 0 | 85 KB | toon, cartoon, cel, stylised, copper |
handPaintedIron | Hand-painted iron | iron | stylised | 2 | 0.85 | 0 | 683 KB | hand painted, painterly, stylised, iron, rivets, fantasy |
rustedIronBlocky is the heavy rust projected triplanar in world space at 1 m, so it looks right on big blocky shapes (level blockouts, crates, walls) whatever their texture layout.
Texture memory
- Resident on the GPU, all 28 metals: 40.75 MB. The anodised colours share one set of maps, as do the three toon metals, so the total is less than the per-metal sum.
- Per-metal sum: 56.2 MB. That is the sum of the "Texture memory" column, counting shared maps once for each metal that uses them.
- Reference pictures: 9.3 MB (28 at 512 px, BC7). They are only loaded where the gallery shows them.
- Everything together: 50.1 MB, about half the 100 MB target.
- The largest metal is 5.3 MB. Every metal binds at most 5 sampled textures (the web limit is 9) and no storage buffers, and passes
Checks.budget. - Textures are UASTC and transcode to BC7 on desktop and ASTC on mobile.
How they were made
- Baked procedurally in Luau (
MetalRecipes,MetalBaker). Every map is periodic, so it tiles seamlessly by construction and is drawn at real scale: 1 unit = 1 m.- Diamond plate lugs are 26 × 7 mm and 1.2 mm high, on a 31.25 mm pitch.
- Corrugation is a 76.2 mm (3 in) pitch with 18 mm deep ridges.
- Painted-panel rivets are 16 mm domes at 50 mm pitch, on 1 m plates.
- Hand-painted iron plates are staggered rows 0.6 to 0.7 m tall on a 2 m repeat, with 16 mm rivets about every 150 mm.
- Hammer dents are about 2 cm across. Damascus layers are about 3 cm per light and dark pair.
- Physically based.
- Albedo carries no painted-in light or shadow. Cavity darkening lives in the ambient-occlusion channel.
- Bare metal is metallic 1. Rust, patina, paint, primer and mill scale are dielectric (metallic 0), so on the rusted, painted and patinated metals only the exposed metal shines.
- Roughness follows the real surface: chrome 0.06–0.08, polished gold and silver 0.09–0.15, cast iron 0.74–0.85.
- Normal maps use the green-up convention, checked with a bump-direction test.
- Kept calm at a distance. The corrugated sheet's ridge normals are baked at 50% strength so the fine ridges don't sparkle far away. Every metal passes the core's 30 m shimmer check; the flaking rust is the closest to the limit (5.75 of 6).
- Toon metals use a small cel shader shipped in the package (
toonMetal): a hard light/shadow step, a lifted shadow, a crisp highlight and a rim line, with no metalness, so they read cleanly in cartoon worlds under every lighting look.handPaintedIronis a stylised, non-metallic material with inked plate seams, flat-painted rivets and lighter worn edges. - Reference pictures. Every metal has a reference picture (
references/<id>), generated before its material and compared with it side by side in the gallery. The gallery hangs it on the metal's bay.
Checked
Every metal passes all of the core's Checks.run: the render passes, the seam check over a 4×4 tiling, the near (1 m) and far (30 m) views with the shimmer score, texture memory and the web budget. The package's test suite reruns all of them and also covers the tags, the costs, apply/swap/clear, the picker, the gallery, the reference pictures and this README. To run it:
asset.resolve("metalsMaterials", "testSuite"):run()
Multiplayer
Materials.apply goes through the core's shared materials channel, so a metal one player puts on something shows on every player's machine, and players who join later get it too. Gallery swatches are local to each machine and cost the network nothing.
Known limits
- Polished metals mirror the sky. Chrome, silver, gold, copper and brass take on the colour of whatever the scene's sky reflects, so they look bluish in daylight and dark in a scene with no sky. That is correct for mirror metals, but it can surprise.
toonSteelreads dim at night. It is dark grey-blue by design, and dim in the moonlight and warm interior looks.- The core's toolbar on phones. On a phone-width screen the core's gallery toolbar shrinks to small buttons. That is materialLibraryKit's interface; the metals and their labels stay readable.
- Guest players play alone. Visitors who open a public world's Play page without signing in get no multiplayer session, so they don't see each other or each other's metals (OrigoZero/ZeroMind#2430). Players with a multiplayer session share applied metals through the core's sync.
- The gallery example fails in a fresh install. A fresh install from ZeroMind brings the materialLibraryKit core only partly, without its
SwatchGallerycomponent, so the second example in "Install and use" stops withSwatchGallery is not a registered component type(OrigoZero/ZeroMind#2862). Applying, swapping and listing metals are not affected. - Engine issues, as listed in materialLibraryKit's README:
- No
asset.materialCollection.*namespace yet (gh#1889), so the metals are reached throughMaterials.*. - Name tags sometimes read
{PlayerName}(gh#19201). - Two-player behaviour can't be tested inside one engine (gh#18688, gh#19114).
- The engine's normal-map green convention is undocumented (gh#19414). These maps are green-up.
- No