Voxel Train Yard
A voxel-art model railway that runs live in your browser. The scene is an HO scale layout on a wooden table in a hobby room, seen from the eye height of someone standing at the front edge of the table. Everything on it — every rail, building, locomotive, tree, and lever — is generated from code as coloured cubes at page load. There are no downloaded models, textures, or images.
Controls
Drag any empty part of the room to look around and use the wheel to zoom. The rest of the controls sit on the physical desk along the front edge of the table, and you operate them with the mouse or by touch.
| Red lever — Main line | Drag up and down to set the speed of the passenger train and the steam freight on the outer loop. |
|---|---|
| Blue lever — Branch | Speed of the two trams on the inner loop. |
| Green lever — Yard | Speed of the shunter working back and forth in the freight yard. |
| Time of day knob | Drag left or right to move the sun. Turn off Auto clock first to hold a time. |
| Lights switch | Turns the night lighting on and off: windows, street lamps, headlights, and the lighthouse beam. |
| Auto clock switch | When on, the layout runs its own day-night cycle of about 150 seconds per day. |
| Horn button | Sounds a three-tone horn, synthesised in the browser. |
| Turntable button | Turns the engine terminal turntable through half a revolution. |
| Red stop button | Emergency stop. Press again to release and let the trains roll. |
What is on the layout
- Main line loop with a passenger train that pauses at the station and a ten-car steam freight that trails smoke from its stack.
- Freight yard of three stub tracks with buffer stops, parked wagons, and a shunter that works up and down the lead.
- Engine terminal with a rotating turntable, a three-road roundhouse, a coaling tower, a water tower, and a sand house.
- Harbor with a quay, a container ship, a working gantry crane, fishing boats, a sailing dinghy, and a lighthouse on the cliff.
- Station and town: a platform with a canopy and clock tower, shops, a church, a park with a fountain, a car park, and a row of town houses.
- Industry: a sawtooth-roofed factory with smoking chimneys, a grain elevator, a sawmill with log piles, and an oil depot.
- Farm and fairground: ploughed fields with a moving tractor, a barn, cattle, a wind turbine, plus a ferris wheel and carousel inside the branch loop.
- Road network where cars, a truck, and a bus keep their distance and wait at two level crossings whose barriers drop automatically as a train approaches.
How it is built
The page is a single HTML file that loads Three.js from a CDN and nothing else. Static scenery is merged into a handful of large buffer geometries, so the whole layout draws in roughly 130 draw calls and about 100,000 triangles — light enough to hold a steady frame rate on ordinary laptops. Tracks and roads are defined as paths built from straight segments and arcs, and trains, road vehicles, and boats are positioned by arc length along those paths, which is what keeps long trains bending correctly through curves.