L-05 · Generated art

Material & normal maps

Painted sprites stop looking like paper cut-outs when a light passes them. A small script turns every generated bitmap with alpha into a height map (alpha distance field for the rounded silhouette + the painting's own light and dark for the relief), a normal map (Sobel of the height), ambient occlusion and a gloss mask, packed next to each other in one lossless file. The game loads them with the art and lights the sprite from any direction: here on a plain 2D canvas, in J-02 with WebGL.

albedo: AI image generator (L-00, L-02, L-06)maps: tools/assets/normalmap.py8 spritesmodule: GameDNA_NormalMapsloader: GameDNA_Assets

Lights moving through a painted night

The lantern keeper walks between the lamppost and the well; the light comes from the painted lanterns themselves (the keeper's, the lamppost's, the well's) plus a spirit wisp under the far oak, under a cold moon from the right; the herbalist watches him go from the left. Nothing that holds a lantern is mirrored: the keeper only walks to the right, leaves the lane and comes back in from the left. Every sprite is lit from where each light actually is: the side facing a lantern goes warm, the side turned away falls back to the blue moonlight. Split sprites cuts through every sprite (left half a flat card that gets the same amount of light spread evenly, what a plain 2D light map does; right half normal-mapped). Move the pointer over the scene, or use the arrow keys, to carry a light yourself.

loading…

What the script derives from one picture

Pick a sprite. The tiles are the shipped files decoded in the page: the albedo (the generated art, unchanged), the normal map (left half of the packed file), then height, ambient occlusion and gloss (right half). Below, one light circles the sprite: lit as a flat card, and lit with its maps.

How the maps are made and shipped

One file per sprite, twice as wide

normal: R = x, G = y up, B = z
R height · G occlusion · B gloss
  1. Dome: distance from each pixel to the nearest transparent one, bent into a quarter circle of radius R (auto: 0.7 × the 98th percentile distance, ridges softened), so every silhouette edge rounds over.
  2. Relief: the painting's luma minus a wide blur of it (local light and dark only, so dark cloth is not lower than a bright face), a few px deep.
  3. Normal: Sobel of the height in px. Occlusion: height below its 4 px blur. Gloss: per-sprite amount × the brighter painted areas.
  4. Saved opaque and lossless (browsers premultiply alpha on decode, which would erase channels next to alpha 0); sha256 of the map and of the albedo it came from go in assets.json, and assetcheck.py re-derives every map and compares pixels.

Eight albedo files are byte-identical copies of the L-00, L-02 and L-06 packs; one (lamppost-off, the same post with its lantern out, so a game can show an inactive lamp) is a single Codex edit of the L-00 lamppost. Regenerating means: make your own sprite with the L-00 style lock, then run the same script on it.

The pack

spritefromalbedomapR pxmap sha256