Three.js Virtual Art Gallery (WebXR Exhibition)

Walk a virtual art gallery in Three.js or in VR, with ten seeded generative canvases (flow fields, circle packing, Truchet tiles, phyllotaxis, Voronoi and more) in frames under picture spotlights, sculptures on plinths, museum labels and a guided tour.

Key topics: virtual gallery, vr art gallery, generative art, three.js exhibition, webxr, spotlights

What this code does

- Generative Works: each canvas comes from a different 2D routine (noise flow field, recursive grid split, ring interference, fbm nebula, contour lines, circle packing, Truchet tiles, golden-angle phyllotaxis, strata, Voronoi), seeded for reproducibility.
- Hanging: framed planes on the outer walls and a central partition at eye height (1.75 m), each with a label sprite.
- Lighting: one SpotLight per work aimed through its target, soft penumbra, and a few shadow-casting lights to keep cost down.
- Sculptures: metal, transmissive glass and dark metal pieces reflect a RoomEnvironment.
- VR & Tour: the camera tour runs on desktop; in VR you walk your real play space and the tour pauses.
- Controls: guided tour, picture lights and ambient light.

Continue Learning

JavaScript Implementation

ES6+
// Gallery wall: generative canvas → texture → framed plane, lit by its own spotlight
const tex = new THREE.CanvasTexture(paintFlowField(canvas))     // any 2D generative routine
const art = new THREE.Mesh(new THREE.PlaneGeometry(1.6, 1.2), new THREE.MeshStandardMaterial({ map: tex }))
art.position.set(-6.98, 1.75, -2); art.rotation.y = Math.PI / 2
const spot = new THREE.SpotLight(0xfff1d6, 18, 7, 0.42, 0.5)
spot.position.set(-5, 4.8, -2); spot.target.position.copy(art.position)
scene.add(art, spot, spot.target)
renderer.xr.enabled = true; renderer.setAnimationLoop(render)  // walk it in VR