Narlblog Nothing here, promised

Transient-Gated Emissivity: Making Pixels Scream

May 20, 2026 · 2 min read
audio engineaudio analysis

Transient-Gated Emissivity: Making Pixels Scream

Moving geometry to the beat is only half the battle. To make a visualizer feel genuinely aggressive (especially for genres like Breakcore or Techno), we have to manipulate the fragment shader's lighting model using audio transients.

The Standard Lighting Model

In a raymarcher, surface color CoutC_{out} is usually a combination of base albedo CbaseC_{base}, Lambertian diffuse LL, and a Fresnel rim-light FF to highlight edges.

F=(1max(0,n^v^))pF = (1 - \max(0, \hat{n} \cdot \hat{v}))^p Cout=CbaseL+CglowFC_{out} = C_{base} \cdot L + C_{glow} \cdot F

The problem: If you just scale CglowC_{glow} by a smoothed audio envelope, the whole shape just gets brighter and darker. It lacks violence.

The Solution: The Overdrive Multiplier

We take a high-frequency transient metric—like Complex Spectral Difference (CSD), which measures phase-deviation in the audio signal to detect sharp, atonal hits—and use it as an overdrive multiplier squared or cubed.

Let τ\tau be our sharp audio transient (normalized 010 \to 1).

Cout=(CbaseL)+CglowF(1+λτk)C_{out} = (C_{base} \cdot L) + C_{glow} \cdot F \cdot (1 + \lambda \cdot \tau^k)

By raising the transient to a power (k=2k = 2 or 33), we create a mathematical noise gate.

  • When τ=0.2\tau = 0.2 (quiet hi-hats), τ3=0.008\tau^3 = 0.008 (essentially invisible).
  • When τ=0.9\tau = 0.9 (massive snare), τ3=0.729\tau^3 = 0.729.

The Fresnel term explodes in brightness only on the absolute hardest hits, and decays instantly. Because it is multiplied against FF, the flash only occurs on the grazing edges of the geometry, creating a sharp, localized electrical spark rather than washing out the entire screen.