Hi all,
Sharing a project I’ve been building: a first-person walkthrough of Beijing’s Forbidden City, generated entirely with Three.js r162.
Live: 故宫 3D 虚拟游览 | Forbidden City 3D Tour Repo: GitHub - watsonbkeel/forbidden-city-3d: Procedurally generated first-person 3D tour of Beijing’s Forbidden City (故宫) with Three.js r162 — walk the central axis, six eastern & western palaces, Ningshou quarter and Imperial Garden. 41 enterable halls, 6 detailed interiors, 108 characters, 332 buildings. No external 3D models. · GitHub (MIT)
What it is
-
332 buildings / gates / walls across 7 zones: the central axis (Meridian Gate → Hall of Supreme Harmony → Imperial Garden → Gate of Divine Prowess), the six eastern and western palaces, the Ningshou quarter, and the outer east/west routes.
-
41 halls are enterable — you can actually walk inside them.
-
6 halls have detailed interiors (throne, caisson ceiling, screens) as GLB generated by Blender scripts, loaded when you get within 15 m and unloaded at 40 m.
-
108 placed characters and 24 authored tour routes.
-
Ramparts on the Meridian Gate and Gate of Divine Prowess are climbable via switchback ramps.
The part that might interest this community
Nothing is a downloaded model. Every building — platform, columns, dougong brackets, roofs, railings, sky — is generated from code. Textures are a handful of bitmaps plus procedural canvas drawing. Total payload is ~13 MB.
Scale is metric and 1:1 to the real layout (+Z north, −X east, origin at the Hall of Supreme Harmony).
Performance
-
BatchedMeshfor same-material merging: DrawCall −66.5%, triangles −57.1% -
SSAO (normals rebuilt from depth), Bloom, FXAA
-
Shadow camera follows the player, radius ≤ 120 m
-
Mobile: auto-degraded shadow resolution and pixel ratio
-
Payload: textures 10 MB, JS 0.96 MB (0.28 MB gzip), interiors 1 MB
Collision & walkable surfaces
-
Box3 colliders registered only within body height (~0–3 m)
-
Two walkable surface types:
box(platforms) andramp(stairs). Ground height = highest surface under your feet + step-up -
Movement advances in sub-steps with per-step ground recomputation. If you end up inside a terrace volume you get lifted back to the top — this was the fix for fall-through at sprint speed / high framerate
-
Rampart ramp colliders are sliced at 0.5 m and only climbable from the lower entrance
Automated gates
A headless suite: zone schema lint, anchor comparison against survey data (113 anchors), smoke test, and a stepwalk test that drives the real controller frame-by-frame through fixed routes to catch falling off terraces or missing waypoints.
Honest limits
This is a study/teaching reconstruction, not a survey-accurate model. Dimensions come from a mix of 2005 section drawings and photo proportions, so precision varies per building. Two geometry defects are currently open (Wuying Gate clearance, Wuying Hall entrance). Full list: docs/LIMITATIONS.md.
Happy to answer questions about the procedural generation or the collision approach.



