Skip to content

Hourglass

A glass-and-brass hourglass: the sand runs, the glass flips, the sand runs again. Loops perfectly.

3D object, V2 Objects3DSeamless loop, verified332 lines of codev1.0.0

In Machines & clockwork, Light, glass & shine, Craft & heritage

Next: Rolling-Ball SculptureSurprise me

Hourglass 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

0.2

The share of the loop that the glass spends turning, 0.1 to 0.35.

3

Changes the grain of the sand.

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

Info

What it is

A classic sand glass floating in a dark studio: a glass double-bulb between two turned metal plates on three slender posts. A thin stream of sand runs through the neck, the upper pile sinking into a funnel while the lower one builds a cone at the angle of repose; when it has all run through the glass turns over, the sand slumping from the cone into a funnel on its new top, and it runs again. Choose the sand (any colour), the metal of the frame (brass, copper, chrome or black), a tint in the glass, and how much of the loop is spent turning the glass over.

Reuse it in your own idea

  • Deadline: Golden sand, brass frame, with a bold 'Time is running out' over the top.
  • Timer sting: White sand in chrome, a 10-second loop, then your logo.
  • Documentary: Slate sand in copper, slow, behind a voice-over about time.

Which part is reusable

src/hourglass.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses chrome-material only for the demo.

Good to know

  • The sand is a smooth volume with a grain texture, not simulated grains: the stream is a thin steady column.
  • The glass turns about its centre in mid-air; it never rests on a surface.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/hourglass.js
Exports
  • createHourglass({ sand?, finish?, tint?, origin?, seed? }) => { group, half, uniforms, update(time, loopSeconds, { flip? }), dispose() }
  • FINISHES: { brass, copper, chrome, black }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, physical glass and metal, and the sand's ray-marching shader.
  • chrome-material@1.1.0 (demo) — Studio environment light, backdrop, floor and contact shadow.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: 1 unit = 10 cm. The glass is 2.6 tall inside two plates, 3.0 overall, and 1.1 across at its widest.

Lighting: Physical glass and metal: needs scene.environment. The sand is lit in its own shader by a key light (set uniforms.uKey to the real light's direction) and a sky fill.

Timing: update(time, loopSeconds) is a pure function of time; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — The sand runs, then the glass turns over by exactly half a turn. The glass, plates, posts and sand are all symmetric under that half turn (the grain is defined in each bulb's own frame), 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
One ray-marched pass over the glass's silhouette (up to 110 steps) and one transmissive glass shell. Smooth at 1080p on laptop GPUs. Software WebGL (no GPU) renders slowly. Transmission renders the opaque scene a second time.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- hourglass/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:06c46e25249807ef…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. Third-party: three.js 0.185.1 (MIT). License details
Provenance
Adapted from the owner's threejs-sketches/objects-scenes/hourglass-sand (and webgpu-hourglass-flow) (MIT), rebuilt for AI Pixel Wizard in October 2026: a ray-marched sand volume with a cone and a funnel at the angle of repose, a stream, a modelled glass and turned frame that are symmetric under a half turn so the flip loops exactly, and the frame/time contract.
BinMore like this

Music Box

3D object3DSeamless loop12 seconds

Astrolabe

3D object3DSeamless loop16 seconds