Tenochtitlan — 3D diorama (1519)
A rebuild of nenioch's Tenochtitlan diorama: the Aztec capital as the Spaniards saw it in 1519 — an island city in Lake Texcoco, with the sacred precinct, the Templo Mayor, palaces, markets, chinampas (floating fields) and three causeways to the shore.
Live demos:
Everything you see is generated from code at load time: no models, no image
files. Buildings are merged geometry and instanced prefabs, textures are
painted on <canvas> elements, and the whole city is laid out by a seeded
random generator, so it looks identical on every visit.
Features
- Full day/night cycle: sun, sky shader, stars, fog, temple fires at night
- Orbit / pan / zoom camera with a clickable pivot (click any temple, house, field or stretch of water and the view turns around that spot)
- Edge-scroll, keyboard (arrows, WASD, +/-, Esc, H), pinch and hold on touch
- Hover and click labels in Dutch for every kind of building and field
- Life: pedestrians on the avenues, priests on the pyramid stairs, canoes sailing the canal grid and the open lake, herons overhead
- Chapultepec hill, the aqueduct, volcanoes on the horizon, shore villages
- Deep link:
#cam=theta,phi,dist,x,y,z[,hour]restores a viewpoint
Running it
Any static file server works:
python3 -m http.server 8080
# open http://localhost:8080/
Opening index.html directly from disk does not work: ES modules need a
server (CORS).
How it is built
| File | Role |
|---|---|
src/util.js |
math, seeded RNG, value noise, city grid constants |
src/state.js |
cross-module singletons (materials, pickables, wind) |
src/textures.js |
all canvas textures (stucco, masonry, fret, thatch, sun stone, water normals) |
src/kit.js |
Builder (merge shapes into one mesh) + Series (instanced prefabs) + materials |
src/prefabs.js |
houses, huts, temples, trees, crops, canoes, people, birds |
src/terrain.js |
renderer, sky dome, stars, clouds, lake, valley, day/night |
src/precinct.js |
sacred precinct: serpent wall, Templo Mayor, Ehecatl, ball court, tzompantli, sun stone |
src/palaces.js |
Moctezuma's palace, Axayacatl, bird house, market square, Tlatelolco |
src/districts.js |
ward grid, chinampas, causeways, bridges, aqueduct, Xoloc, shore villages |
src/agents.js |
pedestrians, priests, canoes, herons (path following) |
src/camera.js |
orbit camera with pivot selection, edge-scroll, keys |
src/main.js |
wiring, UI, info texts, render loop |
Three.js r169 is vendored in vendor/ (MIT), loaded through an import map, so
the page needs no CDN at all — Google Fonts is the only external request, and
the page degrades to system fonts without it.
Credits
- Original design, concept and Dutch copy: nenioch — this is a clean-room rebuild of that page, done by reverse-engineering its published bundle (analysis with REA) and re-implementing it as ES modules on modern three.js.
- three.js (MIT) by Ricardo Cabello and contributors.
- Layout, proportions and colours follow the original so the two pages can be compared frame for frame.
License
MIT (code). The Dutch descriptive texts are part of the original work by nenioch; this project carries them with credit.