TRASHCADE
Aug 28, 2026By Pixel Engineer7 min read

CRT-LAB 9000: Simulating Phosphor Decay, Trinitron Grilles, and 15.7kHz Flyback Whine in WebGL

"How to simulate real analog cathode ray tubes in WebGL: barrel distortion math, phosphor shadow masks, magnetic degaussing coils, and the physical acoustics of 15.734 kHz horizontal flyback transformers."

CRT-LAB 9000: Simulating Phosphor Decay, Trinitron Grilles, and 15.7kHz Flyback Whine in WebGL
ARCHIVE RECORD #ENGINEERING-HARDWARE-CRT-SHADERS
#WebGL2#GLSL#CRT Shader#Retro Hardware#Web Audio API#Demoscene
🎹 Associated Audio Lab
CRT-LAB 9000
Physical Hardware CRT & Analog Video Processor
LAUNCH AUDIO LAB NOW ➔

01.The Modern Flat Screen Lie

When you run an old arcade sprite or NES title on a modern 4K OLED screen, it often looks shockingly harsh. Chunky square pixels clash with razor sharp borders.

Vintage games were never designed to be viewed as raw square matrices. They were drawn for curved vacuum tubes where high-voltage electron beams illuminated red, green, and blue phosphors behind a metal aperture mask. Beam overlap, horizontal color bleeding, and natural halation acted as physical hardware antialiasing.

To recreate authentic retro warmth in CRT-LAB 9000, we had to model the physical optics, electromagnetic interference, and acoustic profile of a 1980s cathode ray tube in GLSL and Web Audio.

02.1. Barrel Distortion & Glass Curvature Math

A real CRT faceplate is a thick glass vacuum chamber under atmospheric pressure. Electron deflection creates a natural spherical bulge toward the center of the display.

In our WebGL2 fragment shader, we map normalized coordinates through a non-linear radial expansion:

glslRAW_BUFFER
vec2 curve(vec2 uv, float curveAmount) {
  uv = (uv - 0.5) * 2.0;
  uv *= 1.0 + pow(length(uv) * curveAmount * 0.5, 2.0);
  return uv * 0.5 + 0.5;
}

Any rays falling outside the [0.0, 1.0] UV boundary get discarded or mapped to dark bezel casing, giving the screen authentic curved glass borders.

03.2. Shadow Masks: Trinitron vs Slot Mask vs Dot Triad

Different CRT manufacturers used distinct physical metal masks to ensure electron guns only hit their designated color phosphors:

  • 📺 Sony Trinitron (Aperture Grille): Employs vertical continuous phosphor stripes held taut by microscopic horizontal damper wires. It delivers the sharpest vertical resolution with vivid RGB punch.
  • 💾 Commodore 1084 (Slot Mask): Uses staggered brick-like phosphor slots, creating the iconic soft horizontal glow beloved by Amiga and C64 coders.
  • 🕹️ Arcade Cabinet (Dot Triad): Arranges phosphors into triangular delta clusters with a black matrix surround, providing maximum immunity to magnetic distortion.
  • 🟢 P1 & P3 Monochromes: High-persistence 525nm green and 590nm amber phosphors with visible ghost trails on high-speed motion.

04.3. Simulating the Electromagnetic Degauss Coil

Over time, Earth's magnetic field and nearby speakers magnetize a CRT's internal shadow mask, deflecting electron beams into the wrong phosphors and causing ugly green and purple purity patches in screen corners.

Turning on a CRT (or pressing the degauss button) triggers a Positive Temperature Coefficient (PTC) thermistor that dumps an intense 850V alternating current pulse through a coil wrapped around the tube frame, rapidly shaking and demagnetizing the metal.

In CRT-LAB 9000, clicking ⚡ DEGAUSS COIL triggers both a visual magnetic shockwave and a hardware audio synthesizer:

  1. 1.
    Shader Distortion: Radial angular chromatic swirl coupled with a high-frequency decaying ripple.
  2. 2.
    Audio Synthesis: A mechanical relay solenoid click followed by an exponential 75Hz-to-35Hz decaying sub-harmonic magnetic hum.

05.4. The Acoustic Profile: 15.734 kHz Flyback Whine

If you grew up in the 80s or 90s, you could tell a TV was turned on in another room before you even saw the screen. That was the horizontal flyback transformer screaming at 15.734 kHz (the exact frequency required to draw 525 lines 29.97 times per second for NTSC).

CRT-LAB 9000 includes an optional hardware acoustics toggle generating both the ultrasonic 15.734 kHz sine whistle and a low-frequency 60Hz AC ground loop mains hum.