# Aurora Tunnel — `aurora-tunnel@1.0.0`

Flying down a corridor of shimmering aurora curtains that stream past towards you. Loops perfectly.

A tunnel lined with aurora: ribbons of green, teal, violet and magenta light hang from the walls of a cylindrical corridor, ripple and fold as they stream past, thin bright ridges where a curtain folds edge-on, with a soft glow and stars at the far end. Choose the colours (borealis, ember, glacier or toxic), the speed of the flight, the brightness, the stars and the seed.

- Kind: background; status: published; digest sha256:2574ea86b73db655f86f344f5feb12c5e3d3f11093dc5075edfbec18305fb393
- Role: Background (WebGL shader, full frame): a hypnotic, flowing backdrop for music, tech and title content.
- Implementation: three; entry `src/aurora-tunnel.js`
- Files: https://aipixelwizard.com/registry/aurora-tunnel/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/aurora-tunnel.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/aurora-tunnel/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/aurora-tunnel/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- Dependencies (exact): `three@0.185.1` (source) — Renderer, geometry and shader materials.; `apw-runtime@1.0.0` (demo) — Demo harness.

## Exports
- `createAuroraTunnel({ palette?, speed?, brightness?, stars?, seed? }) => { scene, camera, setSize(width, height), update(time, loopSeconds), dispose() }` — The corridor as one full-screen shader; render its scene with its camera, ideally through createBloomPass.
- `createBloomPass(renderer, { width, height, glow?, exposure?, grain? }) => { render(scene, camera, output?), dispose() }` — A small bloom with filmic tone mapping.
- `PALETTES: { borealis, ember, glacier, toxic }` — Curtain colour ramps (sRGB hex).

## Parameters
- `palette` (select one of borealis | ember | glacier | toxic, default "borealis") — Colours
- `speed` (integer 1–2, default 1) — Speed: Whole periods of the pattern that stream past in one loop.
- `brightness` (number 0.5–1.6, default 1) — Brightness
- `stars` (number 0–1.5, default 1) — Stars
- `seed` (integer 1–999, default 4) — Seed

## Composition
- Inputs: Time within the loop; the palette, speed, brightness, stars and seed.
- Outputs: A full frame, drawn by one shader on a full-screen quad.
- Coordinates: The tunnel's axis points into the screen at the centre; distance down it is 0.45 / radius.
- Lighting: Self-lit: the curtains' colours add up; the bloom gives the glow.
- Timing: update(time, loopSeconds) sets the loop phase; frames render in any order.
- Works with: kinetic-title, number-reveal
- Two layers of curtains (3 and 5 round the tunnel); each is a ridge of a folded noise sampled on the circle (cos and sin of the angle at whole multiples) and a distance that scrolls by whole periods of the baked noise texture.

## Output and loop
- 1080×1080, 30 fps, 12 s, procedural
- Seamless loop: yes — The pattern scrolls a whole number of its periods per loop and is built from the angle's cosine and sine at whole multiples, so it wraps round the tunnel and returns after the loop exactly.
- Verified 2026-10-06 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)); deterministic: yes; loop check: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.

## Use it
New project: Create a WebGLRenderer, createAuroraTunnel() and createBloomPass(renderer, { width, height }); call tunnel.setSize(width, height), then each frame tunnel.update(time, loopSeconds) and bloom.render(tunnel.scene, tunnel.camera).

Existing project: Copy src/aurora-tunnel.js; render tunnel.scene with tunnel.camera into a render target (or through the bloom pass) as a backdrop.

Reuse ideas:
- Visualiser backdrop: Borealis corridor.
- Warm intro: Ember.
- Tech opener: Glacier, fast.

## Limitations
- The tunnel is a coordinate trick, not 3D geometry: there are no real curtains to fly between.
- The flight is straight and constant: no turns or banking.

## License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.

Provenance: Adapted from the owner's threejs-sketches/light-atmosphere/aurora-tunnel (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original shader: ridged noise curtains on a circle-sampled baked texture, whole-period scrolling for an exact loop and a bloom.

