Plasma Tunnel Background

group .........
3D and WebGL scenes

── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────

A full-bleed WebGL2 background that ports a compact GLSL raymarch into a copy-ready React component. A single oversized triangle drives ninety-nine accumulation steps through a sine-folded tunnel, with resolution, time, speed, intensity, and pixel-ratio controls exposed as uniforms. Pure WebGL2, no dependencies.

── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────

  • * One triangle feeds the whole field

    The canvas draws a single oversized triangle and lets the fragment shader decide every pixel. That keeps the component useful as a background because no mesh, texture, or scene graph has to be kept in sync with the page.

  • * The tunnel advances by accumulated distance

    Each frame runs ninety-nine ray steps. The inner five-fold sine warp perturbs the sample point, then the distance estimate advances z, so the brighter plasma forms from repeated near misses instead of a flat noise layer.

  • * Resolution is a uniform, not a CSS guess

    A ResizeObserver writes the real drawing-buffer size into u_resolution. The shader sees device pixels, while the React component still fills any CSS-sized container.

  • * Pixel ratio is capped for background use

    The default pixelRatio is 1.5 because ninety-nine fragment iterations are expensive at full retina size. Consumers can raise it for hero stills or lower it behind dense content.