Skip to content

Klein Bottle

A glossy Klein bottle with no inside or outside, turning while a cutting plane sweeps through it to show how the tube threads itself. Loops perfectly.

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

In Science & maths, Light, glass & shine

Next: Seifert SurfaceSurprise me

Klein Bottle 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

1
1

How far the plane sweeps; 0 leaves the bottle whole.

1
2

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

Info

What it is

The Klein bottle: a surface with no inside and no outside, whose neck bends back and passes through its own wall to join its base. Shown in its figure-eight form as a glossy shell turning in studio light while a cutting plane sweeps through it again and again, opening the surface so you can see how the tube threads itself. Choose the finish (iridescent, chrome, glass or gold), whether a net of curves lies on the surface, the mesh fineness, how far the cut sweeps (or none), the turns per loop, the size of the ring, the backdrop colour and whether the camera sways.

Reuse it in your own idea

  • Maths explainer: Iridescent, cut.
  • Product-style: Chrome, whole.
  • Calm: Glass, two turns.

Which part is reusable

src/klein-bottle.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

  • A Klein bottle cannot exist in three dimensions without passing through itself: the figure-eight form intersects itself along a circle.
  • The glass finish is transparent without true refraction.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/klein-bottle.js
Exports
  • createKleinBottle({ finish?, lines?, detail?, cut?, turns?, waist? }) => { group, setProgress(progress), dispose() }
  • FINISHES: { iridescent, chrome, glass, gold }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, geometry and shader materials.
  • chrome-material@1.1.0 (demo) — Studio environment light, backdrop and contact shadow.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: The bottle is centred on the origin, about 5 across, hung 3.3 above the floor; the cutting plane is perpendicular to x in world space and starts clear of the bottle and sweeps in to cut away about two-thirds of it, twice per loop.

Lighting: A warm key light with a shadow map and the studio environment.

Timing: setProgress(progress) sets the turn and the plane; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — The surface turns a whole number of times per loop, the cutting plane's position is a sine of whole cycles and the camera sway is a sine of the loop, so the last frame meets the first.
Tested
Rendered 480 frames on 2026-10-05 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
A single static mesh of about 32 000 triangles with GPU clipping and a shadow map: a couple of milliseconds a frame on an integrated Intel GPU. Software WebGL renders in about two seconds a frame.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- klein-bottle/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:31a33f1c68ab941e…
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/geometry-math/klein-bottle (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: the figure-eight immersion as a static mesh with seam-averaged normals, a world-space cutting plane sweeping in a sine of the loop and an iridescent finish, on an exact loop.
BinMore like this

Piano Keys

3D object3DSeamless loop16 seconds

Soap Film

3D object3DSeamless loop12 seconds

Ferrofluid

3D object3DSeamless loop16 seconds