Three.js Parametric Surface Gallery (Klein Bottle, Boy's Surface)

Gallery of famous parametric surfaces in Three.js (Klein bottle, Möbius strip, Boy's surface, Dini's surface, a seashell, Enneper's minimal surface and a breather), with a UV checker and a growth animation.

Key topics: three.js parametric surface, klein bottle, mobius strip, boys surface, parametricgeometry, math visualization

What this code does

- ParametricGeometry: a function (u, v) → (x, y, z) on the unit square is sampled into a triangle grid.
- Non-Orientable Surfaces: the Klein bottle, Möbius strip and Boy's surface have no consistent inside, so they render double-sided.
- Minimal & Pseudospherical: Enneper's surface has zero mean curvature, while Dini's and the breather have constant negative curvature.
- UV Checker: the checker texture shows how the parameterization stretches and shears across the surface.
- Growth: animating the u limit sweeps the surface into existence along one parameter.
- Controls: surface, u/v segments, checker or solid, wire overlay, growth, build fraction and spin.

Continue Learning

JavaScript Implementation

ES6+
import { ParametricGeometry } from 'three/examples/jsm/geometries/ParametricGeometry.js'

// Enneper's minimal surface: (u, v) ∈ [0, 1]² → polar (r, φ) → R³

function enneper (u, v, target) {
  const r = u * 1.4
  const x = r * Math.cos(v * Math.PI * 2)
  const y = r * Math.sin(v * Math.PI * 2)
  target.set(x - x ** 3 / 3 + x * y * y, x * x - y * y, -(y - y ** 3 / 3 + y * x * x))
}
const surface = new THREE.Mesh(
  new ParametricGeometry(enneper, 120, 60),
  new THREE.MeshStandardMaterial({ color: 0x8b5cf6, side: THREE.DoubleSide })
)
scene.add(surface)