Skip to content

Sky Lanterns

Paper lanterns released from beyond a dark shore rise through a starry sky, their glow trembling in a still lake. Loops perfectly.

Background, V1 Effects3DSeamless loop, verified605 lines of codev1.0.0

In Space & cosmos, Toys, games & parties

Next: Glazed GalaxySurprise me

Sky Lanterns preview
Starting live preview…
00:00:00:00 / 00:00:00:01

Live, running the real source at reduced resolution.

Your current settings go with it. Combine several clips and hand them over together from your sequence.

Effect controls

Presets

70

How many lanterns are in flight at once.

1

How far the lanterns drift sideways as they rise.

1

How much each lantern sways and tilts.

1
1

The size of the moon; 0 takes it away.

1
1

How much the lake ripples and reflects.

9

The preview runs the same code your AI receives. These settings travel with the hand-off.

Info

What it is

A festival night in the manner of Yi Peng and Loi Krathong: dozens of paper lanterns, each with its bamboo ribs and the flame at its open mouth, rise one after another from behind a dark shore, sway, drift on the wind and burn out high in the sky; far ones are small and dim, near ones large and bright. Above them stars twinkle and a low moon hangs; below, a still lake holds the lanterns' reflections as trembling streaks, with the lights of a far village along the shore. Choose the mood (warm gold, festival colours, rose or silver), how many lanterns fill the sky, the wind and sway, their glow, the moon, the stars and how much the lake ripples.

Reuse it in your own idea

  • Hopeful music or lyric backdrop: Warm gold, moonlit lake.
  • Festival or wedding title: Festival colours.
  • Quiet wellbeing or memorial scene: Calm night, no wind.

Which part is reusable

src/sky-lanterns.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses the demo harness only for the demo.

Good to know

  • The lanterns are painted billboards that face the camera: they tilt and sway but do not turn to show their other sides.
  • The camera is fixed and the sky does not turn; the moon does not move.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/sky-lanterns.js
Exports
  • createSkyLanterns({ palette?, count?, wind?, sway?, glow?, moon?, stars?, water?, seed? }) => { scene, camera, plan, setSize(width, height), update(time, loopSeconds), dispose() }
  • createBloomPass(renderer, { width, height, glow?, exposure?, grain? }) => { render(scene, camera, output?), dispose() }
  • planLanterns({ count?, seed? }) => lantern[]
  • lanternAt(lantern, loopPhase, aspect?, wind?, sway?) => { x, y, hs, alive, tilt, flicker }
  • PALETTES: { warm, festival, rose, silver }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, the sky, lantern and lake shaders and the bloom targets.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: The frame is -1 … 1 in height (x scaled by the aspect ratio); the shoreline is at y = -0.34, the lake below it; lanterns rise from just under the shore to between half the sky and above the top, depending on their depth.

Lighting: Self-lit: every lantern is a glowing paper body with a flame and a halo; the bloom adds the glare; the lake reflects the sky and the lanterns; the moon casts a path on the water.

Timing: update(time, loopSeconds) sets the loop phase; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — Each lantern flies once up the sky per loop, released at a fixed share of it, so lanterns are always in flight and the one that burns out at the top is replaced by one released behind the shore; sways, flames and stars are sines of whole cycles per loop and the lake's ripples move on circles of a noise, so the last frame meets the first.
Tested
Rendered 480 frames on 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)). Same frame twice from fresh pages: identical. Loop: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.
Performance
Two full-screen passes (sky, then shore and lake), 70 instanced lantern quads and a small bloom; the lake loops over the lanterns per pixel. A few milliseconds a frame at 1080p on an integrated Intel GPU. Software WebGL (no GPU) renders in a second or two a frame.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- sky-lanterns/1.0.0 --out my-video.mp4Needs Node 18+, ffmpeg and Chrome/Chromium. Add --params my-settings.json (from Copy settings) for your own settings.
Version
1.0.0 · sha256:817883301e9c4c76…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. License details
Provenance
Adapted from the owner's threejs-sketches/light-atmosphere/paper-lantern-release and firefly-lantern (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original scene: lantern positions as one pure function of the loop's phase (continuous release, exact loop), painted-paper lanterns with ribs and flame, a starry sky with moon, a lake with ripple-broken reflections of the lanterns, and the frame/time contract.
BinMore like this

Campfire

Background3DSeamless loop12 seconds

Disco Ball

Background3DSeamless loop12 seconds

Fireworks

Background3DSeamless loop12 seconds