Risograph spot-ink press
I wanted to see if one live HTML flyer could be separated on the GPU into 2 or 3 subtractive Risograph ink drums, printed onto textured cream paper with stochastic grain and soy-ink overprinting, and shaken out of register on a spring whenever you type or click.
Type into the headline field, toggle the Spot 1 to 3 buttons, drag the Run count slider or press +1 Impression to knock the ink drums briefly out of register. Drag across the paper sheet or adjust Drum A and Drum B to dial manual misregistration, and toggle the Drum 1 to 3 checkboxes to inspect single stencil masters.
Show the code spot-ink separation shader, ElementGL upload, damped drum spring and geometry sync
- One live
drawablezine flyer inside the canvas. The text input, spot-density buttons, range slider and stamp button sit inside one<canvas content="drawable" layoutsubtree>. - Subtractive spot-ink separation and Beer-Lambert overprinting. Splits the uploaded texture into grey component plus chromatic excess, converts each drum into ~240 LPI stochastic grain, adds margin crop marks and multiplies soy-ink transmittances over cream Munken paper.
- Damped spring misregistration on input and clicks. Every keystroke, slider move or stamp click kicks the drum offsets by 4 to 8 px and settles back to the dial target, stopping the animation loop at rest and skipping bounce when
prefers-reduced-motion: reduceis on. - Single
ElementGLcontext, hit sync and fallbacks. Uploads the flyer viatexElementSubImage2D(), aligns controls withupdateElementGeometry()scaled bygeometryUnit(), and falls back to 5-argument 2DdrawElementImage()or plain HTML on context loss.
How it works
A Risograph press burns one master stencil per spot ink and feeds each sheet past rotating drums on uncoated paper.
Here one ElementGL context from /lib/element-gl.js uploads #poster-card via gl.texElementSubImage2D() on every paint event, and a single WebGL 2 fragment pass simulates two or three drum passes over a cream cotton stock (#f5f0e1).
To separate live HTML into spot plates without pre-authored masks, the shader unpremultiplies the DOM colour, takes cmy = 1.0 - rgb, pulls out the neutral grey component k = min(cmy.r, min(cmy.g, cmy.b)) and leaves chromatic excess chr = cmy - k.
Because at least one component of chr is zero, pure magenta, cyan and yellow DOM blocks land cleanly on separate ink drums, while overlapping mix-blend-mode: multiply shapes and dark text print across multiple drums and split into separate colour ghosts when a drum shifts.
Each drum transforms canvas coordinates by its own pixel offset and slight plate angle, thresholds midtones against a rotated ~240 LPI stochastic stipple screen, draws margin registration crosshairs and optional feed-roller tracks, and darkens the paper with pow(inkColor, inkAmount) so Fluorescent Pink and Medium Blue overprint into dark plum.
Whenever you type in the headline or press +1 Impression, a damped harmonic spring kicks the drum offsets by 4 to 8 px and relaxes back to the target dials before stopping its requestAnimationFrame loop.
canvas.updateElementGeometry() receives the card's resting rectangle scaled by geometryUnit() from /lib/surface.js (and follows a single isolated drum's offset when only one drum checkbox is checked), followed by toggling posterCard.dataset.hitTick so Chromium clears its hit-test cache.
If texElementSubImage2D() isn't available, a 2D canvas fallback draws offset translucent passes with five-argument drawElementImage(); without HTML-in-canvas or on a lost WebGL context, the flyer moves out into #plain-host as plain HTML.
Live checks
These checks wait for a tap so the press opens with one GPU context. Each check runs on its own isolated fixture on the test stage and retires its canvas when done.
Findings
- Measured in headless Chrome Canary 160 (
160.0.8187.0, ANGLE SwiftShader,412×780at device scale 2.625) on 2026-11-27: all 4 live checks pass withgl.getError() === 0, backing store stays at994×1229px (1.22 MP, 9.77 MB), and zero lost contexts or unasked readbacks occur. Real GPU rendering and Chrome 159 on Android are not verified yet. - Extracting neutral grey
k = min(cmy)before mappingcmy - konto spot drums lets one live HTML card feed both 3-ink CMY-like palettes (Fluorescent Pink, Medium Blue, Sunflower Yellow) and 2-ink classic runs (Scarlet Red, Federal Blue) without separate DOM passes per ink. - Multiplying soy-ink transmittances with
pow(inkColor, absorb)darkens overlapping Fluorescent Pink (luminance 116.0) and Medium Blue (luminance 99.6) to deep indigo-plum (luminance 36.5), measured on the live check fixture. - Keeping
updateElementGeometry()anchored to the trim centre while multiple drums are active keeps typing and rapid stamping reliable mid-bounce, whereas tracking the active plate's offset when only one drum is isolated keeps controls aligned to that lone plate (verified by real pointer clicks in Chrome Canary 160).