Log inGet started
Package

surfaces.module

Newest version

README.md

surfaces

Every surface the wreck wears, made from numbers. Nothing here is a file: four tiling textures are generated pixel by pixel at build time from a deterministic wrapping-lattice noise, uploaded with renderer.texture.create, and bound into runtime pbr_layered materials. The content is the code, so a rebuild always produces the same surfaces and there is no binary to keep in step with it.

local S = require("deadlight.wreck.surfaces")
local mats = S.build()      -- memoised; safe from every awake
mats.hull, mats.deck, mats.crusted, mats.rusticle, mats.steel,
mats.silt, mats.porcelain, mats.brass, mats.leather, mats.voidBlack
S.invalidate()              -- drop the memo and re-derive on the next build

The plate texture is a 3 x 3 BLOCK of plates, not one. One plate per texture tiled onto plating repeats every two metres and the eye catches it instantly; nine plates, each carrying its own corrosion and its own rust, repeat every six and read as a hull. Meshes author UVs in plate units and scale them by S.UV (= 1 / S.CELLS) to match.

Authored for raking light at close range. The film has no sun below 200 m: the submersible's three lamps are the only light in the world, they are 6-20 m away, and red dies first in the water. So roughness and normal detail carry the read and base colour barely does — the plate's height field is a seam groove around each plate with a double row of rivets inside it, pitted by a century of corrosion, and that is what a lamp crossing the side actually finds.

Rust is the surface, not a weathering pass over it. mats.hull's base layer is oxide over the whole plate and its top layer is the calcareous crust that grows on top where the current lets it settle; bare steel survives only on a broken edge, which wears mats.steel. mats.voidBlack is unlit black — what is behind an open porthole, a hawse pipe or a wheelhouse window, because a lamp six metres away must not find a wall there.