Prompt specification
Build or customize the Three.js 3D scene "Boat waiting below a Paris canal footbridge" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Boat waiting below a Paris canal footbridge
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/boat-waiting-below-a-paris-canal-footbridge-x2850
Scene Description Prompt:
I'd like to see this as a voxel Three.js scene: Boat waiting below a Paris canal footbridge. Create a compact Canal Saint-Martin vignette with small boat, footbridge, and quay pedestrians. Keep navigation and walking routes separate and source the local structural details. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (boat-waiting-below-a-paris-canal-footbridge-x2850):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#d8e3df">
<title>Canal Saint-Martin — Voxel Vignette</title>
<style>
:root {
--ink: #183337;
--muted: #567074;
--paper: rgba(250, 248, 239, 0.94);
--line: rgba(24, 51, 55, 0.15);
--cyan: #16b9cf;
--amber: #ed9d2f;
--shadow: 0 12px 38px rgba(32, 55, 58, 0.18);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #cbdcdd;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button, summary { font: inherit; }
#app,
#app canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
#app canvas {
cursor: grab;
touch-action: none;
outline: none;
}
#app canvas:active { cursor: grabbing; }
.hud {
position: fixed;
inset: 0;
pointer-events: none;
}
.panel {
pointer-events: auto;
background: var(--paper);
border: 1px solid rgba(255, 255, 255, 0.72);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.title-card {
position: absolute;
top: 20px;
left: 20px;
width: min(390px, calc(100vw - 40px));
padding: 17px 19px 16px;
border-radius: 17px;
}
.eyebrow {
margin: 0 0 5px;
color: #557278;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.17em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(25px, 3vw, 35px);
font-weight: 500;
letter-spacing: -0.035em;
line-height: 1.03;
}
.subtitle {
margin: 9px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.route-panel {
position: absolute;
left: 20px;
bottom: 20px;
width: min(390px, calc(100vw - 40px));
padding: 13px;
border-radius: 17px;
}
.route-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 2px 10px;
color: #64787c;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.route-buttons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.route-button,
.icon-button {
appearance: none;
border: 1px solid var(--line);
border-radius: 11px;
color: var(--ink);
background: rgba(255, 255, 255, 0.56);
cursor: pointer;
transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}
.route-button:hover,
.icon-button:hover {
transform: translateY(-1px);
border-color: rgba(24, 51, 55, 0.3);
}
.route-button:focus-visible,
.icon-button:focus-visible,
summary:focus-visible {
outline: 3px solid rgba(22, 185, 207, 0.28);
outline-offset: 2px;
}
.route-button {
min-height: 54px;
padding: 9px 10px;
text-align: left;
}
.route-button strong {
display: flex;
align-items: center;
gap: 7px;
font-size: 12px;
}
.route-button small {
display: block;
margin-top: 4px;
color: #6b8084;
font-size: 10px;
line-height: 1.3;
}
.route-button.active {
background: #fff;
border-color: rgba(24, 51, 55, 0.25);
box-shadow: 0 4px 13px rgba(35, 57, 59, 0.08);
}
.swatch {
width: 10px;
height: 10px;
flex: 0 0 auto;
border-radius: 3px;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.swatch.boat { background: var(--cyan); }
.swatch.walk { background: var(--amber); }
.route-copy {
min-height: 38px;
margin: 10px 3px 3px;
color: #607579;
font-size: 11px;
line-height: 1.45;
}
.panel-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-top: 9px;
padding-top: 10px;
border-top: 1px solid var(--line);
}
.icon-button {
padding: 7px 10px;
font-size: 10px;
font-weight: 750;
}
.key-hint {
color: #708388;
font-size: 9px;
line-height: 1.35;
text-align: right;
}
.sources {
position: absolute;
top: 20px;
right: 20px;
width: min(330px, calc(100vw - 40px));
border-radius: 15px;
overflow: hidden;
}
.sources summary {
padding: 12px 15px;
cursor: pointer;
list-style: none;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary::after {
content: "+";
float: right;
color: #688084;
font-size: 17px;
line-height: 11px;
}
.sources[open] summary::after { content: "−"; }
.source-body {
padding: 0 15px 14px;
border-top: 1px solid var(--line);
color: #5c7377;
font-size: 10px;
line-height: 1.55;
}
.source-body p { margin: 10px 0; }
.source-body ul {
margin: 8px 0;
padding-left: 17px;
}
.source-body a {
color: #207d89;
text-decoration-color: rgba(32, 125, 137, 0.35);
text-underline-offset: 2px;
}
.source-body code {
font-size: 9px;
color: #36565b;
word-break: break-word;
}
.scene-label {
position: absolute;
left: 50%;
bottom: 22px;
transform: translateX(-50%);
padding: 9px 13px;
border: 1px solid rgba(255, 255, 255, 0.68);
border-radius: 999px;
background: rgba(250, 248, 239, 0.8);
color: #5e7478;
font-size: 10px;
letter-spacing: 0.05em;
white-space: nowrap;
backdrop-filter: blur(10px);
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #d5e2df;
color: #34545a;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }
@media (max-width: 720px) {
.title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 13px 15px;
}
.title-card .subtitle { display: none; }
.sources {
top: 92px;
right: 12px;
width: 210px;
}
.route-panel {
left: 12px;
bottom: 12px;
width: calc(100vw - 24px);
}
.route-copy { display: none; }
.route-button { min-height: 46px; }
.scene-label { display: none; }
}
</style>
</head>
<body>
<div id="app"></div>
<div class="hud">
<section class="panel title-card">
<p class="eyebrow">Paris · 10e / 19e arrondissement</p>
<h1>Waiting below<br>the footbridge</h1>
<p class="subtitle">
A compact voxel study of Canal Saint-Martin: masonry quays, brick warehouses,
plane trees, painted ironwork and a small working boat.
</p>
</section>
<section class="panel route-panel" aria-label="Route controls">
<div class="route-heading">
<span>Separate route layers</span>
<span id="active-label">01 / Boat</span>
</div>
<div class="route-buttons">
<button class="route-button active" id="boat-mode" aria-pressed="true">
<strong><span class="swatch boat"></span> Boat navigation</strong>
<small>Canal centerline · water level</small>
</button>
<button class="route-button" id="walk-mode" aria-pressed="false">
<strong><span class="swatch walk"></span> Quay walking</strong>
<small>Quays + bridge · pedestrian level</small>
</button>
</div>
<p class="route-copy" id="route-copy">
The cyan route follows the navigable center of the canal and passes directly
beneath the footbridge. It is never mixed with the pedestrian route.
</p>
<div class="panel-footer">
<button class="icon-button" id="overview">Overview · 0</button>
<div class="key-hint">Drag to orbit · Shift-drag to pan<br>Wheel to zoom · 1 boat · 2 walk</div>
</div>
</section>
<details class="panel sources">
<summary>Local details & sources</summary>
<div class="source-body">
<p>
This is a procedural, interpretive vignette rather than a surveyed reconstruction.
Its architectural vocabulary is based on the canal’s brick warehouse frontages,
pale stone embankments, plane-tree quays, utilitarian barges and iron pedestrian bridges.
</p>
<ul>
<li>
<a href="https://www.paristjetaime.com/eng/canal-saint-martin"
target="_blank" rel="noopener">Paris tourist office — Canal Saint-Martin</a>
</li>
<li>
<a href="https://commons.wikimedia.org/wiki/Category:Canal_Saint-Martin_(Paris)"
target="_blank" rel="noopener">Wikimedia Commons — Canal Saint-Martin, Paris</a>
</li>
<li>
<a href="https://www.openstreetmap.org/#map=17/48.8708/2.3653"
target="_blank" rel="noopener">OpenStreetMap — canal area</a>
</li>
</ul>
<p>
No imagery or map geometry is imported; the scene is built from Three.js boxes.
OpenStreetMap contributors are licensed under ODbL. Reference links are provided
for local visual research.
</p>
<p>
Engine:
<code>three.module.js 0.160.0</code>, loaded only from cdnjs.
</p>
</div>
</details>
<div class="scene-label" id="scene-label">Drag to orbit the vignette</div>
</div>
<div id="loading">Building the canal…</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const app = document.getElementById("app");
const loading = document.getElementById("loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xcbdcdd);
scene.fog = new THREE.Fog(0xcbdcdd, 43, 92);
const camera = new THREE.PerspectiveCamera(
39,
innerWidth / innerHeight,
0.1,
160
);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
app.appendChild(renderer.domElement);
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const material = (color, roughness = 0.88, metalness = 0, extra = {}) =>
new THREE.MeshStandardMaterial({ color, roughness, metalness, ...extra });
const mats = {
ground: material(0xb8c5bb),
stone: material(0xcfc4ae),
stoneLight: material(0xe0d6c1),
stoneDark: material(0xa99e8a),
stoneWarm: material(0xb8aa91),
coping: material(0xd9d0bc),
brick: material(0x9d5545),
brickLight: material(0xae634f),
brickDark: material(0x774438),
roof: material(0x4e5350, 0.72, 0.08),
iron: material(0x315c59, 0.72, 0.18),
ironDark: material(0x263c3c, 0.64, 0.24),
ironLight: material(0x577a73, 0.68, 0.16),
wood: material(0x92704b),
woodDark: material(0x5d4934),
glass: material(0x284d5a, 0.24, 0.2),
water: material(0x347f87, 0.25, 0.08, {
transparent: true,
opacity: 0.88,
metalness: 0.05
}),
ripple: new THREE.MeshBasicMaterial({
color: 0xb5e5df,
transparent: true,
opacity: 0.32
}),
trunk: material(0x70543d),
leaf: material(0x547a45),
leafLight: material(0x6c8c4e),
leafDark: material(0x3f633e),
lamp: material(0xffe1a1, 0.5, 0, {
emissive: 0xd89b37,
emissiveIntensity: 0.38
}),
red: material(0xc9513f),
cream: material(0xe9dfc6),
boatGreen: material(0x315b4b, 0.68, 0.12),
boatTrim: material(0xd7bd75, 0.7, 0.1),
black: material(0x202b2d),
skin: material(0xd6a17b),
skinDark: material(0x9b654c),
shirtBlue: material(0x416f88),
shirtRust: material(0xa85b45),
shirtCream: material(0xd4c7a7),
trousers: material(0x35494d),
hair: material(0x44352d),
bag: material(0x866845)
};
let seed = 1843;
function rand() {
seed = (seed * 1664525 + 1013904223) >>> 0;
return seed / 4294967296;
}
function box(parent, sx, sy, sz, x, y, z, mat, shadow = true) {
const mesh = new THREE.Mesh(cubeGeometry, mat);
mesh.scale.set(sx, sy, sz);
mesh.position.set(x, y, z);
mesh.castShadow = shadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Custom orbit/pan/zoom controls; no examples or addons are used.
const cameraState = {
theta: 0.72,
phi: 1.02,
radius: 45,
target: new THREE.Vector3(0, 1.45, 0)
};
let cameraTween = null;
function applyCamera() {
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x + cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z + cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
}
function flyTo({ theta, phi, radius, target }) {
cameraTween = {
start: performance.now(),
duration: 850,
from: {
theta: cameraState.theta,
phi: cameraState.phi,
radius: cameraState.radius,
target: cameraState.target.clone()
},
to: {
theta,
phi,
radius,
target: new THREE.Vector3(...target)
}
};
}
const views = {
overview: { theta: 0.72, phi: 1.02, radius: 45, target: [0, 1.45, 0] },
boat: { theta: 0.78, phi: 1.10, radius: 20, target: [0, 1.05, 0] },
walk: { theta: 0.50, phi: 1.08, radius: 23, target: [0, 2.35, 0] }
};
const canvas = renderer.domElement;
let drag = null;
canvas.addEventListener("pointerdown", (event) => {
canvas.setPointerCapture(event.pointerId);
drag = {
id: event.pointerId,
x: event.clientX,
y: event.clientY,
pan: event.button === 2 || event.shiftKey
};
cameraTween = null;
});
canvas.addEventListener("pointermove", (event) => {
if (!drag || drag.id !== event.pointerId) return;
const dx = event.clientX - drag.x;
const dy = event.clientY - drag.y;
drag.x = event.clientX;
drag.y = event.clientY;
if (drag.pan) {
const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
const right = new THREE.Vector3().crossVectors(forward, camera.up).normalize();
const up = new THREE.Vector3().crossVectors(right, forward).normalize();
const scale = cameraState.radius * 0.0015;
cameraState.target.addScaledVector(right, -dx * scale);
cameraState.target.addScaledVector(up, dy * scale);
} else {
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(cameraState.phi - dy * 0.005, 0.34, 1.43);
}
});
function endDrag(event) {
if (drag && event.pointerId === drag.id) drag = null;
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("wheel", event => {
event.preventDefault();
cameraTween = null;
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
11,
70
);
}, { passive: false });
canvas.addEventListener("dblclick", () => flyTo(views.overview));
addEventListener("keydown", event => {
if (event.key === "1") selectMode("boat");
if (event.key === "2") selectMode("walk");
if (event.key === "0") flyTo(views.overview);
if (event.key === "ArrowLeft") cameraState.theta += 0.08;
if (event.key === "ArrowRight") cameraState.theta -= 0.08;
if (event.key === "ArrowUp") cameraState.phi = Math.max(0.34, cameraState.phi - 0.06);
if (event.key === "ArrowDown") cameraState.phi = Math.min(1.43, cameraState.phi + 0.06);
});
// Lighting.
scene.add(new THREE.HemisphereLight(0xeaf8f7, 0x746b59, 2.15));
const sun = new THREE.DirectionalLight(0xffe7bd, 3.0);
sun.position.set(-13, 26, 17);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -34;
sun.shadow.camera.right = 34;
sun.shadow.camera.top = 28;
sun.shadow.camera.bottom = -28;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 75;
sun.shadow.bias = -0.0004;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x8bc7d0, 0.55);
fill.position.set(15, 9, -18);
scene.add(fill);
// Ground and the long canal cut.
box(scene, 110, 0.3, 90, 0, -0.5, 0, mats.ground, false);
box(scene, 53, 0.32, 8.8, 0, -0.12, 0, mats.water, false);
// Pale masonry embankments and quay decks.
box(scene, 53, 1.2, 8.1, 0, 0.6, 8.55, mats.stone);
box(scene, 53, 1.2, 8.1, 0, 0.6, -8.55, mats.stone);
box(scene, 53, 0.12, 8.1, 0, 1.23, 8.55, mats.stoneLight);
box(scene, 53, 0.12, 8.1, 0, 1.23, -8.55, mats.stoneLight);
// Individual retaining-wall blocks evoke the local stone quay.
const wallMaterials = [mats.stone, mats.stoneLight, mats.stoneWarm, mats.stoneDark];
for (const side of [-1, 1]) {
for (let x = -25; x < 26; x += 2) {
const a = wallMaterials[Math.floor(rand() * wallMaterials.length)];
const b = wallMaterials[Math.floor(rand() * wallMaterials.length)];
box(scene, 1.88, 0.48, 0.3, x, 0.34, side * 4.47, a);
box(scene, 1.88, 0.46, 0.3, x + 0.98, 0.8, side * 4.47, b);
}
box(scene, 53, 0.16, 0.55, 0, 1.28, side * 4.5, mats.coping);
}
// Instanced voxel paving.
const paverMaterial = material(0xffffff, 0.97);
const paverRows = 6;
const paverColumns = 43;
const paverCount = paverRows * paverColumns * 2;
const pavers = new THREE.InstancedMesh(cubeGeometry, paverMaterial, paverCount);
pavers.receiveShadow = true;
const dummy = new THREE.Object3D();
const paverColors = [0xc9c0ae, 0xb7ae9d, 0xd7cebb, 0xc1b7a4, 0xaea998];
let paverIndex = 0;
for (const side of [-1, 1]) {
for (let row = 0; row < paverRows; row++) {
for (let col = 0; col < paverColumns; col++) {
const x = -23.5 + col * 1.1 + (row % 2) * 0.18;
const z = side * (5.45 + row * 1.03);
dummy.position.set(x, 1.315, z);
dummy.rotation.set(0, (rand() - 0.5) * 0.03, 0);
dummy.scale.set(1.02, 0.065, 0.94);
dummy.updateMatrix();
pavers.setMatrixAt(paverIndex, dummy.matrix);
pavers.setColorAt(
paverIndex,
new THREE.Color(paverColors[Math.floor(rand() * paverColors.length)])
);
paverIndex++;
}
}
}
pavers.instanceMatrix.needsUpdate = true;
if (pavers.instanceColor) pavers.instanceColor.needsUpdate = true;
scene.add(pavers);
// Water highlights remain box-shaped to preserve the voxel language.
const rippleCount = 95;
const ripples = new THREE.InstancedMesh(cubeGeometry, mats.ripple, rippleCount);
for (let i = 0; i < rippleCount; i++) {
const x = -25 + rand() * 50;
const z = -3.9 + rand() * 7.8;
const length = 0.3 + rand() * 1.15;
dummy.position.set(x, 0.075, z);
dummy.rotation.set(0, rand() > 0.5 ? 0 : Math.PI / 2, 0);
dummy.scale.set(length, 0.018, 0.055);
dummy.updateMatrix();
ripples.setMatrixAt(i, dummy.matrix);
}
ripples.instanceMatrix.needsUpdate = true;
scene.add(ripples);
// Canal-side bollards and mooring blocks.
for (const side of [-1, 1]) {
for (let x = -23; x <= 23; x += 5.5) {
box(scene, 0.34, 0.58, 0.34, x, 1.57, side * 5.03, mats.ironDark);
box(scene, 0.48, 0.14, 0.48, x, 1.88, side * 5.03, mats.iron);
}
}
// Cubic plane trees and local street furniture.
function makeTree(x, z, base = 1.3, scale = 1) {
const group = new THREE.Group();
group.position.set(x, base, z);
group.scale.setScalar(scale);
scene.add(group);
box(group, 0.42, 3.1, 0.42, 0, 1.55, 0, mats.trunk);
box(group, 0.22, 1.1, 0.22, 0.25, 2.65, 0, mats.trunk);
box(group, 0.19, 0.95, 0.19, -0.3, 2.7, 0.12, mats.trunk);
const clusters = [
[0, 3.65, 0, 2.15, 1.5, 2.0, mats.leaf],
[-0.9, 3.3, 0.2, 1.45, 1.25, 1.4, mats.leafLight],
[0.9, 3.45, -0.15, 1.45, 1.45, 1.35, mats.leafDark],
[0.25, 4.45, 0.1, 1.45, 1.2, 1.4, mats.leafLight],
[-0.25, 3.8, -0.85, 1.3, 1.15, 1.2, mats.leafDark],
[0.3, 4.05, 0.85, 1.2, 1.1, 1.1, mats.leaf]
];
for (const c of clusters) {
box(group, c[3], c[4], c[5], c[0], c[1], c[2], c[6]);
}
return group;
}
makeTree(-19, 10.4, 1.3, 1.03);
makeTree(-11.5, 10.4, 1.3, 0.9);
makeTree(10.8, 10.5, 1.3, 0.96);
makeTree(18.6, 10.4, 1.3, 1.07);
makeTree(-18.5, -10.8, 1.3, 0.92);
makeTree(-9, -11, 1.3, 1.0);
makeTree(9, -10.8, 1.3, 0.9);
makeTree(18, -10.8, 1.3, 1.02);
function makeLamp(x, z) {
box(scene, 0.42, 0.16, 0.42, x, 1.37, z, mats.ironDark);
box(scene, 0.13, 2.55, 0.13, x, 2.65, z, mats.ironDark);
box(scene, 0.43, 0.48, 0.43, x, 4.05, z, mats.lamp);
box(scene, 0.58, 0.12, 0.58, x, 4.34, z, mats.ironDark);
box(scene, 0.08, 0.57, 0.08, x, 4.56, z, mats.ironDark);
// Square life-ring motif.
box(scene, 0.08, 0.46, 0.08, x + 0.31, 2.95, z, mats.red);
box(scene, 0.08, 0.08, 0.46, x + 0.31, 3.18, z, mats.red);
}
makeLamp(-15, 5.55);
makeLamp(-5, -5.55);
makeLamp(5, 5.55);
makeLamp(15, -5.55);
// Brick warehouse frontage, based on the canal's industrial vocabulary.
function makeWarehouse(x, width, height, brickMat) {
const base = 1.3;
const frontZ = -12.15;
const centerZ = -14.25;
box(scene, width, height, 4.1, x, base + height / 2, centerZ, brickMat);
box(scene, width + 0.15, 0.28, 4.25, x, base + height + 0.08, centerZ, mats.stoneLight);
box(scene, width + 0.35, 0.35, 4.45, x, base + height + 0.36, centerZ, mats.roof);
box(scene, width * 0.78, 1.0, 3.65, x, base + height + 0.86, centerZ - 0.05, mats.roof);
const floors = height > 7 ? 3 : 2;
const columns = Math.max(3, Math.floor(width / 2.1));
for (let row = 0; row < floors; row++) {
for (let col = 0; col < columns; col++) {
const wx = x - width / 2 + 1.05 + col * ((width - 2.1) / Math.max(1, columns - 1));
const wy = base + 1.65 + row * 2.05;
box(scene, 0.98, 1.32, 0.12, wx, wy, frontZ + 0.08, mats.stoneLight);
box(scene, 0.76, 1.10, 0.10, wx, wy, frontZ + 0.16, mats.glass);
box(scene, 0.055, 1.10, 0.05, wx, wy, frontZ + 0.23, mats.cream);
box(scene, 0.76, 0.055, 0.05, wx, wy, frontZ + 0.23, mats.cream);
if ((row + col) % 2 === 0) {
box(scene, 0.26, 1.18, 0.09, wx - 0.62, wy, frontZ + 0.14, mats.iron);
box(scene, 0.26, 1.18, 0.09, wx + 0.62, wy, frontZ + 0.14, mats.iron);
}
}
}
// Tall canal-side doors.
box(scene, 1.55, 2.5, 0.13, x - width * 0.22, base + 1.25, frontZ + 0.09, mats.woodDark);
box(scene, 1.34, 2.30, 0.08, x - width * 0.22, base + 1.20, frontZ + 0.18, mats.iron);
}
makeWarehouse(-13.4, 15.0, 7.3, mats.brick);
makeWarehouse(9.7, 14.4, 6.3, mats.brickLight);
makeWarehouse(22.0, 7.2, 7.8, mats.brickDark);
// Low near-bank wall, keeping the main view open.
for (let x = -25; x < 26; x += 2) {
box(scene, 1.86, 0.72, 0.34, x, 1.68, 12.65, mats.stoneDark);
}
box(scene, 53, 0.14, 0.48, 0, 2.08, 12.65, mats.coping);
// The footbridge: stepped approaches, pale deck, green iron parapet,
// and a block-built masonry arch inspired by local canal bridges.
box(scene, 2.8, 0.35, 13.0, 0, 3.00, 0, mats.stoneLight);
box(scene, 2.45, 0.08, 12.95, 0, 3.22, 0, mats.wood);
for (let z = -6.2; z <= 6.2; z += 0.58) {
box(scene, 2.38, 0.025, 0.035, 0, 3.275, z, mats.woodDark, false);
}
// Stepped approaches down to both quays.
for (const side of [-1, 1]) {
for (let i = 0; i < 7; i++) {
const top = 3.0 - i * 0.26;
const z = side * (6.65 + i * 0.69);
const height = Math.max(0.12, top - 1.28);
box(
scene,
2.8,
height,
0.73,
0,
1.28 + height / 2,
z,
i % 2 ? mats.stoneLight : mats.coping
);
}
}
// Masonry arch blocks.
for (let i = 0; i <= 20; i++) {
const theta = i / 20 * Math.PI;
const z = 6.12 * Math.cos(theta);
const y = 0.34 + 2.34 * Math.sin(theta);
const dz = -6.12 * Math.sin(theta);
const dy = 2.34 * Math.cos(theta);
const rotation = Math.atan2(-dy, dz);
box(
scene,
2.52,
0.44,
0.72,
0,
y,
z,
i % 3 === 0 ? mats.stoneWarm : mats.stone,
true
).rotation.x = rotation;
}
// Arch springing blocks.
for (const side of [-1, 1]) {
box(scene, 2.82, 2.3, 1.05, 0, 1.4, side * 6.12, mats.stone);
box(scene, 2.98, 0.22, 1.2, 0, 2.62, side * 6.12, mats.stoneLight);
}
// Painted iron bridge rails.
for (const x of [-1.26, 1.26]) {
box(scene, 0.12, 0.12, 12.85, x, 4.05, 0, mats.iron);
box(scene, 0.09, 0.09, 12.85, x, 3.61, 0, mats.ironLight);
for (let z = -6.2; z <= 6.2; z += 0.78) {
box(scene, 0.12, 0.9, 0.12, x, 3.69, z, mats.iron);
box(scene, 0.19, 0.11, 0.19, x, 4.11, z, mats.ironLight);
}
// Sloping rails over the approaches.
const railLength = Math.hypot(4.95, 1.35);
for (const side of [-1, 1]) {
const rail = box(scene, 0.12, 0.12, railLength, x, 3.38, side * 8.83, mats.iron);
rail.rotation.x = side * 0.266;
for (let i = 0; i < 4; i++) {
const z = side * (6.85 + i * 1.43);
const y = 4.02 - i * 0.42;
box(scene, 0.11, 0.82, 0.11, x, y - 0.36, z, mats.iron);
}
}
}
// Small enamel-style bridge plaque.
box(scene, 1.08, 0.38, 0.08, 1.39, 3.85, 0.2, mats.cream);
box(scene, 0.92, 0.23, 0.09, 1.39, 3.85, 0.25, mats.ironDark);
// Canal steps down to the water, a characteristic quay detail.
for (let i = 0; i < 5; i++) {
box(
scene,
2.25,
0.22,
0.58,
-16.2,
1.08 - i * 0.22,
4.25 - i * 0.48,
i % 2 ? mats.stone : mats.stoneLight
);
}
// Benches.
function makeBench(x, z, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 1.32, z);
group.rotation.y = rotation;
scene.add(group);
box(group, 1.75, 0.14, 0.52, 0, 0.43, 0, mats.wood);
box(group, 1.75, 0.44, 0.12, 0, 0.72, -0.22, mats.wood);
box(group, 0.13, 0.55, 0.44, -0.66, 0.2, 0, mats.ironDark);
box(group, 0.13, 0.55, 0.44, 0.66, 0.2, 0, mats.ironDark);
}
makeBench(-8.4, 7.1, 0);
makeBench(13.3, -7.0, Math.PI);
// The small working boat waiting under the bridge.
const boat = new THREE.Group();
boat.position.set(0, 0.02, 0);
scene.add(boat);
box(boat, 4.65, 0.58, 1.72, 0, 0.45, 0, mats.boatGreen);
box(boat, 1.0, 0.54, 1.3, 2.15, 0.45, 0, mats.boatGreen);
box(boat, 0.52, 0.48, 0.76, 2.86, 0.45, 0, mats.boatGreen);
box(boat, 0.72, 0.48, 1.16, -2.45, 0.45, 0, mats.boatGreen);
box(boat, 4.35, 0.13, 1.43, -0.05, 0.79, 0, mats.wood);
for (const side of [-1, 1]) {
box(boat, 4.65, 0.12, 0.11, -0.05, 0.82, side * 0.84, mats.boatTrim);
box(boat, 0.11, 0.18, 0.42, -1.45, 0.55, side * 0.94, mats.black);
box(boat, 0.11, 0.18, 0.42, 0.95, 0.55, side * 0.94, mats.black);
}
box(boat, 1.8, 0.95, 1.32, -0.72, 1.32, 0, mats.cream);
box(boat, 2.02, 0.16, 1.52, -0.72, 1.87, 0, mats.boatGreen);
box(boat, 0.82, 0.48, 0.035, 0.21, 1.45, 0.675, mats.glass);
box(boat, 0.82, 0.48, 0.035, 0.21, 1.45, -0.675, mats.glass);
box(boat, 0.035, 0.48, 0.82, -1.64, 1.45, 0, mats.glass);
box(boat, 0.28, 0.5, 0.28, -0.2, 2.18, 0, mats.ironDark);
box(boat, 0.38, 0.09, 0.38, -0.2, 2.45, 0, mats.ironDark);
box(boat, 0.42, 0.16, 0.42, 1.9, 0.96, 0, mats.ironDark);
box(boat, 0.07, 0.07, 1.05, 1.48, 1.03, 0, mats.ironDark);
// A small warm-red navigation lamp.
box(boat, 0.16, 0.19, 0.16, 0.75, 2.02, 0, mats.red);
// Pedestrians, assembled as small voxel figures.
const pedestrians = [];
function makePerson(x, z, base, shirt, options = {}) {
const group = new THREE.Group();
group.position.set(x, base, z);
group.rotation.y = options.rotation ?? 0;
const scale = options.scale ?? 1;
group.scale.setScalar(scale);
scene.add(group);
const skin = options.skin ?? mats.skin;
const leftLeg = box(group, 0.22, 0.68, 0.25, -0.18, 0.48, 0, mats.trousers);
const rightLeg = box(group, 0.22, 0.68, 0.25, 0.18, 0.48, 0, mats.trousers);
box(group, 0.18, 0.13, 0.34, -0.18, 0.11, 0.04, mats.black);
box(group, 0.18, 0.13, 0.34, 0.18, 0.11, 0.04, mats.black);
box(group, 0.69, 0.73, 0.4, 0, 1.17, 0, shirt);
box(group, 0.14, 0.67, 0.19, -0.46, 1.12, 0, shirt);
box(group, 0.14, 0.67, 0.19, 0.46, 1.12, 0, shirt);
box(group, 0.43, 0.43, 0.42, 0, 1.78, 0, skin);
box(group, 0.47, 0.16, 0.45, 0, 2.02, -0.015, mats.hair);
box(group, 0.49, 0.08, 0.47, 0, 1.96, 0, options.hat ?? mats.hair);
if (options.bag) {
box(group, 0.38, 0.42, 0.19, 0.47, 0.92, 0.13, mats.bag);
}
pedestrians.push({
group,
leftLeg,
rightLeg,
phase: rand() * Math.PI * 2,
moving: options.moving ?? false,
base
});
return group;
}
makePerson(-5.4, 7.25, 1.34, mats.shirtBlue, {
rotation: Math.PI / 2,
moving: true,
bag: true
});
makePerson(8.0, 8.0, 1.34, mats.shirtRust, {
rotation: -0.4,
skin: mats.skinDark
});
makePerson(-2.7, -7.4, 1.34, mats.shirtCream, {
rotation: 0.7,
hat: mats.red
});
makePerson(6.3, -8.0, 1.34, mats.shirtBlue, {
rotation: 2.2,
moving: true
});
makePerson(0.25, 2.15, 3.28, mats.shirtRust, {
rotation: Math.PI,
scale: 0.96,
skin: mats.skinDark
});
makePerson(-0.32, -3.4, 3.28, mats.shirtCream, {
rotation: 0,
scale: 0.92,
bag: true
});
// Separate route groups: boat navigation at water level and walking at deck level.
const boatRoute = new THREE.Group();
const walkRoute = new THREE.Group();
scene.add(boatRoute, walkRoute);
const boatRouteMaterial = new THREE.MeshBasicMaterial({
color: 0x25d0df,
transparent: true,
opacity: 0.9
});
const walkRouteMaterial = new THREE.MeshBasicMaterial({
color: 0xf2a53b,
transparent: true,
opacity: 0.94
});
function addDashedRoute(points, group, mat, dash = 0.72, gap = 0.55, oriented = false) {
for (let i = 0; i < points.length - 1; i++) {
const a = points[i];
const b = points[i + 1];
const dx = b[0] - a[0];
const dy = b[1] - a[1];
const dz = b[2] - a[2];
const length = Math.hypot(dx, dy, dz);
const angle = -Math.atan2(dz, dx);
for (let d = 0.2; d < length; d += dash + gap) {
const t = d / length;
const marker = box(
group,
oriented ? dash * 0.86 : 0.16,
0.075,
oriented ? 0.13 : 0.16,
a[0] + dx * t,
a[1] + dy * t + 0.04,
a[2] + dz * t,
mat,
false
);
if (oriented) marker.rotation.y = angle;
}
}
}
// Cyan markers are strictly at canal/water level.
addDashedRoute(
[[-25, 0.14, 0], [25, 0.14, 0]],
boatRoute,
boatRouteMaterial,
0.85,
0.7,
true
);
function addBoatChevron(x) {
for (const direction of [-1, 1]) {
const piece = box(
boatRoute,
0.5,
0.075,
0.14,
x - 0.12,
0.19,
direction * 0.19,
boatRouteMaterial,
false
);
piece.rotation.y = direction * 0.68;
}
}
[-18, -10, 8, 16].forEach(addBoatChevron);
// Amber markers stay on the quay, climb the approaches and cross the bridge.
const walkingPoints = [
[-16, 1.39, 10.15],
[0, 1.39, 10.15],
[0, 3.34, 6.02],
[0, 3.34, -6.02],
[0, 1.39, -10.15],
[16, 1.39, -10.15]
];
addDashedRoute(
walkingPoints,
walkRoute,
walkRouteMaterial,
0.44,
0.46,
false
);
function addWalkChevron(x, z, y, direction) {
for (const side of [-1, 1]) {
const piece = box(
walkRoute,
0.16,
0.075,
0.38,
x,
y,
z + side * 0.15,
walkRouteMaterial,
false
);
piece.rotation.y = direction * side * 0.68;
}
}
addWalkChevron(-9.5, 10.15, 1.43, 1);
addWalkChevron(8.5, -10.15, 1.43, -1);
addWalkChevron(0, 0.3, 3.4, -1);
// UI route isolation.
const boatButton = document.getElementById("boat-mode");
const walkButton = document.getElementById("walk-mode");
const routeCopy = document.getElementById("route-copy");
const activeLabel = document.getElementById("active-label");
const sceneLabel = document.getElementById("scene-label");
function selectMode(mode) {
const isBoat = mode === "boat";
boatRoute.visible = isBoat;
walkRoute.visible = !isBoat;
boatButton.classList.toggle("active", isBoat);
walkButton.classList.toggle("active", !isBoat);
boatButton.setAttribute("aria-pressed", String(isBoat));
walkButton.setAttribute("aria-pressed", String(!isBoat));
activeLabel.textContent = isBoat ? "01 / Boat" : "02 / Walk";
routeCopy.textContent = isBoat
? "The cyan route follows the navigable center of the canal and passes directly beneath the footbridge. It is never mixed with the pedestrian route."
: "The amber route remains on the quays, climbs the stepped approaches, crosses the bridge deck, and continues on the opposite quay.";
sceneLabel.textContent = isBoat
? "Boat navigation · cyan route at water level"
: "Quay walking · amber route at pedestrian level";
flyTo(isBoat ? views.boat : views.walk);
}
boatButton.addEventListener("click", () => selectMode("boat"));
walkButton.addEventListener("click", () => selectMode("walk"));
document.getElementById("overview").addEventListener("click", () => flyTo(views.overview));
boatRoute.visible = true;
walkRoute.visible = false;
// Animation.
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const time = clock.getElapsedTime();
// A nearly imperceptible drift makes the waiting boat feel afloat.
boat.position.y = 0.02 + Math.sin(time * 0.82) * 0.026;
boat.rotation.z = Math.sin(time * 0.57) * 0.006;
for (const person of pedestrians) {
if (person.moving) {
const stride = Math.sin(time * 2.4 + person.phase) * 0.35;
person.leftLeg.rotation.x = stride;
person.rightLeg.rotation.x = -stride;
person.group.position.y = person.base + Math.abs(Math.sin(time * 2.4 + person.phase)) * 0.025;
} else {
person.group.position.y = person.base + Math.sin(time * 1.1 + person.phase) * 0.008;
}
}
if (cameraTween) {
const t = Math.min(1, (performance.now() - cameraTween.start) / cameraTween.duration);
const eased = 1 - Math.pow(1 - t, 3);
const from = cameraTween.from;
const to = cameraTween.to;
cameraState.theta = THREE.MathUtils.lerp(from.theta, to.theta, eased);
cameraState.phi = THREE.MathUtils.lerp(from.phi, to.phi, eased);
cameraState.radius = THREE.MathUtils.lerp(from.radius, to.radius, eased);
cameraState.target.lerpVectors(from.target, to.target, eased);
if (t >= 1) cameraTween = null;
}
applyCamera();
renderer.render(scene, camera);
}
function resize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
}
addEventListener("resize", resize);
applyCamera();
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 450);
});
</script>
</body>
</html>
```