Temporal display shaders: E-Ink, Playdate crank and Game Boy LCD

I wanted to know if a WebGL 2 ping-pong feedback shader could give live interactive HTML the temporal behaviour of hardware screens that stateless CSS filters can't express. Scroll, type, tick the boxes or press the buttons inside the screen below, then switch between E-Ink Carta partial-refresh ghosting with a full black flash, a 1-bit Playdate LCD driven by a draggable rotary crank, and a 4-shade olive Game Boy DMG-01 LCD with slow pixel persistence.

Chapter 1 of 3 · Hardware field notes

Electrophoretic ink and partial refresh

Typed notes appear here so you can watch old letters linger on the panel.
Live DOM counter
Tap Counter or Next chapter to layer ghosting over previous digits.
00
0% to 100% luminance ramp (4x4 Bayer check)
E-Ink quantises to 16 warm greys; Playdate thresholds to 1-bit dots; DMG-01 maps to 4 olive steps.

Why partial refresh leaves ghosts

E-Ink Pearl and Carta panels hold black and white pigment capsules suspended in microcapsules. A fast partial refresh pulses only the pixels that changed, so you can turn a page or type without a full-screen blink. Some dark pigment stays near the top of the capsule, leaving a faint outline of the old headline until a full black-to-white waveform resets the layer.

Stateful pixels from live HTML

A stateless CSS filter only sees the current frame. Here the browser paints this scrolling article into a WebGL 2 texture with texElementSubImage2D(), and a ping-pong framebuffer mixes it with the display state left behind by earlier frames.

Select text or scroll further

Every button, checkbox, search field and paragraph inside this panel is interactive HTML. Try highlighting a sentence, typing in the field above, or switching to Playdate mode and turning the rotary crank on the right bezel to scroll down to the end of this note.

Bottom of the field note

Once you reach the bottom, scroll back up quickly in E-Ink mode to inspect the ghosted horizontal rules, or switch to Game Boy DMG mode to watch the dark borders trail behind as olive smears.

Starting display shader...
Show the code ping-pong WebGL 2 feedback, Bayer dithering, rotary crank and hit sync
  1. The drawable canvas and live scrollable reader. One <canvas content="drawable" layoutsubtree> wraps #rd-screen, with an accessible crank pad overlaid on the right bezel in Playdate mode.
  2. The ping-pong feedback fragment shader. Keeps E-Ink pigment ghosting across partial updates, runs the 220 ms black-to-white clearing waveform, and simulates slow passive-matrix LCD decay for Game Boy DMG.
  3. The display and hardware bezel shader. Applies 4x4 ordered Bayer dithering, Playdate 1-bit Sharp Memory LCD grid, Game Boy 4-shade olive dot matrix, and SDF rendering for the bezel and Playdate rotary crank.
  4. Two RGBA8 framebuffers on one ElementGL context. Uploads the element once via gl.texElementSubImage2D(), runs the feedback pass off screen, and draws the full shell on screen.
  5. Syncing hit boxes after drawing. Updates updateElementGeometry() and toggles dataset.hitTick so taps, typing and text selection hit the rendered screen rectangle.
  6. Playdate rotary crank input. Tracks circular pointer drags with setPointerCapture(), wheel ticks and keyboard arrows to drive #rd-screen.scrollTop.

How it works

This experiment builds on /canvas-skin/ (styling live controls through shaders) and /time-scrubber/ (keeping temporal history across frames), and draws directly from three hardware screens: E-Ink Pearl and Carta partial-refresh panels, Panic's Playdate handheld (1-bit Sharp Memory LCD with a physical rotary crank), and Nintendo's Game Boy DMG-01 4-shade passive-matrix LCD.

CSS filters and SVG filter chains are stateless: they transform the current frame's pixels and forget every frame before it. To model real E-Ink ghosting or passive-matrix LCD trails, the renderer has to remember what was on screen on the previous update. I used one WebGL 2 context created with new ElementGL(canvas, ...) from /lib/element-gl.js and allocated two small RGBA8 ping-pong framebuffers on stage.gl.

Each time #rd-screen paints, scrolls or changes, ElementGL.upload() copies its picture into a WebGL texture via gl.texElementSubImage2D(). Pass 1 runs the feedback shader into the back framebuffer, reading both the live texture and the previous state texture. In E-Ink mode it deposits lingering dark ghosting in the green channel whenever a dark pixel clears to white, holds that ghost while the panel is idle, and wipes it to zero during the 220 ms black-to-white full refresh waveform. In Game Boy DMG mode it blends the live luminance toward the previous state with an asymmetric decay factor over a short settling loop, then stops requesting animation frames once the trail settles.

Pass 2 draws the entire handheld shell and screen in one quad using ElementGL.quad(): 4x4 ordered Bayer dithering, a 16-level warm paper ramp for E-Ink, razor-sharp 1-bit monochrome (#c7c3b8 and #2c2b28) with a pixel grid and SDF rotary crank for Playdate, and the 4-shade olive palette (#9bbc0f, #8bac0f, #306230, #0f380f) with subpixel gaps and cast pixel shadow for Game Boy DMG-01. After sizing or switching modes, the page calls canvas.updateElementGeometry(screen, { canvasTransform }) and increments screen.dataset.hitTick so clicks, focus, typing and scrolling land inside the rendered screen box.

If WebGL 2 isn't available, the page falls back to a 2D canvas drawing #rd-screen with 5-argument drawElementImage() and copying into a plain non-drawable willReadFrequently: true scratch canvas for ordered Bayer dithering on each paint. If the HTML-in-canvas API isn't enabled or the WebGL context is lost, #rd-screen moves out of the canvas so the reader stays usable as plain HTML until the context returns.

Live checks

These checks build their own small fixtures on the test stage and retire every canvas afterwards. Tap the button below to run them in this browser.

Findings