Three.js Gothic Cathedral Interior (Procedural Architecture)

Walk a procedurally built Gothic cathedral in Three.js, with lancet arcades, clustered piers, clerestory, ribbed quadripartite vaults, stained-glass lancets, two rose windows and sunlight shafts, from merged geometry with soft shadows.

Key topics: gothic cathedral, procedural architecture, three.js interior, stained glass, ribbed vault, lancet arch

What this code does

- Lancet Arch: two circular arcs centred on the springing line, with radius r = (rise² + (span/2)²) / span so they meet at the apex.
- Walls With Openings: Shape plus hole Paths extruded with ExtrudeGeometry form the arcade, clerestory, aisle walls and west front.
- Ribbed Vaults: diagonal and transverse ribs are TubeGeometry along Bézier curves over a lofted webbing surface per bay.
- Stained Glass: canvas-painted panes and rose windows on MeshBasicMaterial (not tone-mapped) glow against the dim stone.
- Light Shafts: additive cones fake volumetric god rays from the south aisle windows.
- Performance & Controls: thousands of stone pieces merge into two draw calls with mergeGeometries; controls cover light, shafts, glass brightness and the walking tour.

Continue Learning

JavaScript Implementation

ES6+
// Gothic lancet arch: two circular arcs whose centres sit on the springing line

function lancet (span, rise, segs = 16) {
  const r = (rise * rise + (span / 2) ** 2) / span
  const half = Array.from({ length: segs + 1 }, (_, i) => {
    const a = Math.acos(1 - span / (2 * r)) * (1 - i / segs)
    return new THREE.Vector2(-span / 2 + r - r * Math.cos(a), Math.min(r * Math.sin(a), rise))
  })
  return half.concat(half.slice(0, -1).reverse().map(p => new THREE.Vector2(-p.x, p.y)))
}
const wall = new THREE.Shape(outline); wall.holes.push(new THREE.Path(lancet(3, 7)))
scene.add(new THREE.Mesh(new THREE.ExtrudeGeometry(wall, { depth: 1, bevelEnabled: false }), stone))