Ken BinghamPaintings
Wall

How this gallery was built

A walk-through 3D gallery that runs in a web browser with nothing to install. One person directed it and an AI wrote it, over three days. This page says what it is made of, how it works, and who did what.

20paintings, each framed and lit
4rooms, laid out by the code
3,600lines of code in 14 files
67messages of direction in the first three days
0frameworks, 3D model files or sound files

Walk through it

What it is made with

three.js 0.186.1The 3D drawing library, on WebGL. It is the only library the pages load, and it is served from this site, not from another company's network.
Plain JavaScriptES modules, no framework and no bundler. The pages work as written.
Canvas 2DEvery label, sign, speech bubble and the marble floor is drawn in code onto a canvas and used as a texture.
Web Audio APIAll the sound is made in the browser from filtered noise and tones. The cynic's remarks use the browser's own speech voice.
Node.jsOne build script turns a list of works into every page. No database and no content system.
Python: Pillow and OpenCVThe picture pipeline: resizing, the watermark, the signature, and the check for duplicates.
Cloudflare WorkersHosting of the built files, one small server program for the contact form, a key-value store, and outbound email.
Headless browser testsA real browser driven over the Chrome DevTools Protocol, taking measurements and screenshots after every change.

What is worth a closer look

The building designs itself

Nothing about the rooms is drawn by hand. The code takes the number of paintings and works out how many rooms are needed, where the doorways go, and which wall each painting hangs on, under rules: two to a wall, never one alone, none on a wall with a doorway. Add or remove a painting and the building changes to fit. It has been four rooms and it has been thirteen.

No models, no recordings

The visitors, the statues, the fountains, the benches and the frames are all assembled in code from simple solid shapes. The sound of the crowd is noise passed through filters tuned to the pitch of voices; a footstep is a short thud and a click. So the whole experience downloads as code and paintings, and nothing else.

An automatic tour that moves like a person

The tour plans a route through every room, through the middle of each doorway and round every bench, statue and fountain. It gathers and loses speed gradually, the camera follows the route as if on a soft spring so that corners are rounded, and it turns to face the next painting while it is still arriving. The test traces the whole tour at sixty steps a second and confirms that it stops squarely in front of every painting and never passes through a wall or an obstacle.

Pictures arrive as you walk

A painting's image is asked for only when you are near it or can see it through a doorway. The first room is ready in moments however many rooms lie beyond it.

Mirror statues drawn from their equations

Three of the statues are mathematical surfaces in polished metal: z = xy, a hyperbolic paraboloid cut square so that every edge is a straight line; z = xy², a right conoid; and half a sphere, mirrored on both faces. Each is built from its formula, stands on a labelled plinth under its own spotlight, and turns. A fourth is a mirrored pyramid with a brighter capstone and a beam of light rising from its point to the ceiling. In the last room stands a gold pharaoh's mask, striped with lapis and set with rows of turquoise, carnelian and lapis beads, assembled from about four hundred simple shapes.

The reflections are real. The room is photographed in all six directions from where each statue stands, every few seconds, and that picture is what its metal reflects. So the paintings, the lights and the visitors slide across the surfaces as they turn.

A polished floor, and shadows where they belong

The marble floor reflects the room. A mirror lies just under it and the marble is let through a little, so the lit paintings and the walls show in the floor, dimmed, as they do in polished stone. Every frame throws a soft shadow on its wall, every bench, plinth and fountain has one on the floor, and each wall darkens where it meets the floor and the ceiling. None of this is computed lighting. Each is a small effect placed by hand where the eye expects it, which is why it runs smoothly in a browser.

Visitors with joints, faces and things to do

The people in the rooms are built in code: a body turned on a lathe, arms hinged at shoulder and elbow, legs at hip and knee, eyes with an iris, a pupil and a fleck of light, and lids that blink. Each has a part to play. Children point at a painting while a mother keeps an eye on them, a professor holds his chin, a curator talks to a group, a custodian sweeps, and a cynic walks from picture to picture finding fault. They stand where they do not block a painting or the route of the tour, each has a few thoughts that float up in a bubble, and one button takes them all away.

The picture pipeline

The originals are photographs of canvases and are never altered. For the web copies, the build:

A contact form that does not publish an email address

Messages go to a small server program, which emails them on. The address is known only to the server. The build fails if an email address appears in any page. The form refuses requests from other sites, caps the number of messages a day, and quietly drops automatic form-fillers.

Small screens get a different gallery

Walking through rooms is not practical on a phone, so a phone gets the same paintings as a wall of framed, lit pictures. It is the same page: the 3D starts only where there is room for it and the browser can draw it.

Who did what

Ken Bingham conceived the gallery, directed it and made every decision in it. The paintings are his, made by hand. So are the ideas that give the site its character: rooms with doorways in place of corridors, dim rooms with lit pictures, the visitors and what they think, the cynic, the custodian, the fountains, the mirror statues and how each is cut and turned, the pyramid and its beam of light, the pharaoh's mask, the polished floor, one consistent signature, the centrepiece, and the choice of which paintings hang.

The AI (Claude, made by Anthropic, working as a coding agent) wrote the code, wrote and ran the tests, and reported what it found. It did not originate the ideas. Where it offered a judgement, such as which twenty paintings are the strongest, that was asked for, and the decision stayed with Ken Bingham.

What it took to get it right

It was not right the first time, and most of the quality came from correction.

The direction, in the director's own words

These are some of the 67 messages, and of those that followed, quoted from the record with only the spelling tidied, each with what it changed. None of them is a specification. Each is a person looking at the result and saying what is wrong with it.

All paintings must be framed and lit painting gallery style, frames appropriate for the wall texture and theme.

Every picture got a frame, a picture lamp and a pool of light. The build now chooses each frame from the painting's own colours.

Not just one continuous hallway or flat wall. Have wall exhibits where the user can go from one to another. Turn corners and more hallways. Really no more than 3 paintings per hallway.

The single long hall was replaced by a winding plan generated from the number of paintings.

Well lit but not bright. Most art galleries are optimized to bring out the paintings but the rooms themselves are often not well lit, to give a contrast to the lit up paintings on the wall.

The walls, floor and ceiling were dimmed to a fraction of their brightness and each painting was left at full brightness.

Have wall textures change when turning corners and let's have no less than 2 paintings per wall. There are long walls that only have one painting.

Two rules went into the layout code and two checks into the tests: a different wall finish in every space, and never one painting alone.

For the auto tour can it be more natural movement of camera, smooth and no jerky movements moving from one painting to the other.

The tour was rewritten: eased speed, a camera that follows its route on a spring, and a turn that begins before it arrives.

Is there any way to make the art gallery 3D part look more like an art gallery and not just hallways with art?

The largest change of the project. Corridors became rooms joined by cased doorways, with benches, ceiling track lights and room names.

Make it smart phone friendly by only showing walls and art. The traversal would be too much and not practical on small screens.

Phones get a wall of framed pictures. The 3D starts only where there is room for it.

And let's have some din and crowd noises, walking sounds, children laughing, one cynic criticizing every painting he sees.

The sound engine, and the cynic, who walks from painting to painting finding fault with each.

Can we make the patrons be more studio quality?

The visitors were rebuilt with elbows, knees, shaped bodies, eyes that blink and a shadow on the floor. The answer also said where the limit is: figures made in code are not studio characters.

Not quite right. Here is z = xy, and have it turn left to right.

Sent with a reference picture. The first version of the statue was the right equation cut the wrong way; it was redrawn to match.

What it is not

Walk through it All work Contact