RasterCore
Ready to execute

Hardware Heritage

The infinite tunnel is a masterclass in polar transformation. By mapping Cartesian coordinates (X, Y) to polar coordinates (Angle, Distance), programmers created the sensation of traveling through an endless tube. In the 90s, this required massive pre-calculated Look-Up Tables (LUTs) to avoid expensive trigonometric functions in the main loop.

PC VGA Heritage

Tunnels were the backbone of 90s PC VGA intros. The 386/486 CPU was just fast enough to perform 64,000 LUT lookups per frame to texture-map the tube in real-time.

Amiga Bottleneck

Early Amigas struggled with tunnels because they lacked a linear framebuffer. Arbitrary texturing required bitplane blits, making PC-style mapping very rare until the AGA chipset.

Modern Polar Math

The fragment shader computes distance (1/R) and angle (atan) for every fragment, allowing for infinite, pixel-perfect texture wrapping without the memory overhead of large LUTs.

The Tunnel

The sensation of infinite depth through polar transformation.

Legacy Pascal (LUT)

// Precalc Distance/Angle tables
for y := 0 to 199 do
  for x := 0 to 319 do begin
    distTable[x,y] := 32 * 256 / sqrt(sqr(x-160)+sqr(y-100));
    angleTable[x,y] := 128 * atan2(y-100, x-160) / PI;
  end;

// Main Loop
for i := 0 to 63999 do begin
  u := angleTable[i] + shiftX;
  v := distTable[i] + shiftY;
  Mem[VideoSeg:i] := Texture[u and 255, v and 255];
end;

Modern GLSL

void main() {
  vec2 p = (2.0*gl_FragCoord.xy-res.xy)/res.y;
  float r = length(p);
  float a = atan(p.y, p.x);

  // Perspective UVs
  vec2 uv = vec2(a/3.14159, 1.0/r);

  // Animate and Sample
  vec3 col = texture(tex, uv + time).rgb;
  gl_FragColor = vec4(col * r, 1.0);
}