Log inGet started
World

Nine Bells

Branchmain
Branchesmain
Commit5e921c28b2

README.md

art.sprite

The unlit surface every 2D thing in Nine Bells is drawn with. A sprite is one quad wearing one material, and this shader does the three things the plain unlit shader does not.

Sheet framing. frames_x x frames_y cells, frame picks one, counting left to right then top to bottom from 0. A whole run cycle lives in one texture and one material, so animating is writing a number rather than swapping an asset. cell_inset walks the sampled window in from each cell's edges — asked for a grid, an image generator draws the borders it was told not to, and the inset crops that seam off instead of ringing every frame with it.

Flipping. flip_x mirrors the cell in place, so the doctor faces left without a second sheet.

Keying. The image generators do not write an alpha channel; asked for a transparent background they paint one. key_mode cuts it out here instead:

key_modeWhat it keys
0off — use the texture's own alpha
1plain RGB distance from key_color
2the grey/white transparency checkerboard a generator paints
3lean — how far a pixel leans toward key_color's own channels and away from the others

Mode 3 is the one to use against generated art on a flat backdrop. It takes the backdrop and the half-strength spill a generator paints for smoke, glass and soft edges, while a warm rim light or a bone-white mask that shares part of the hue survives. Mode 1 cannot do that: the texture is sampled in linear space while key_color is authored in display terms, which pushes half-strength background pixels far enough from the key colour to survive any tolerance that still keeps a bone-white mask. Leaning on the hue is immune to that because both terms move together. key_despill then pulls the background's hue back out of the pixels that survive, which is what removes the coloured fringe on the cut edge. Against magenta, key_tolerance 0.70 and key_despill 0.85 are the tuned values.

Unlit on purpose. The light in Ashcross is painted — lantern pools, censer glow, firelight — as additive sprites, not as scene lights, so a sprite's colour is exactly what was drawn times its tint, plus emissive.