Tunnel

Version 7 of 8

Shader tunnel.

GPU · GLSL · today

This version

atan and 1/r per pixel at full resolution, with anti-aliased grid lines from screen-space derivatives and a glowing core.

How this version works

At full render resolution, this fragment shader calculates angle and inverse radius directly for every pixel around a gently wandering centre. Those coordinates form a scrolling checker pattern with purple-red cells and pale yellow grid lines, without reading a texture. Analytical estimates of the grid's screen-space width soften its edges as the pattern recedes. Radial shading darkens the tunnel inward, while a separate inverse-radius colour term adds a pinkish central glow.

The trick in this version

The GPU evaluates the mapping independently per fragment, so no CPU lookup tables are needed. Grid smoothing uses explicit radius-based width estimates rather than GLSL derivative instructions or texture mipmaps.

Historical context · GPU

  1. today · Iñigo Quilez · tunnel article

    Fixing the seam

    On a GPU the atan seam breaks mipmapping derivatives; the article explains the fix, a problem nearest-neighbour DOS tunnels never had.

  2. 2017 · Wsmind / TMP · Thought Process

    A raymarched 4K tunnel

    Combined 4K winner at Very Important Party 2017: the screen-to-texture table replaced by geometry evaluated in a shader.

Platform
GPU · GLSL
Era
GPU
Rendered on
GPU
Tags
anti-aliased · per pixel
Sources
Fixing the seam (today)A raymarched 4K tunnel (2017)