Prompt specification
Build or customize the Three.js 3D scene "Ellis Island arrival-hall circulation vignette" 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: Ellis Island arrival-hall circulation vignette
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/ellis-island-arrival-hall-circulation-vignette-x2582
Scene Description Prompt:
Ellis Island arrival-hall circulation vignette. Create a referenced arrival-hall segment with benches, queues, and wayfinding. Keep families together where shown and avoid inventing individual inspection outcomes or personal histories. Please build this with Three.js from cdnjs in one self-contained HTML file, using low-poly forms.
Working Three.js Starter (ellis-island-arrival-hall-circulation-vignette-x2582):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="A low-poly Ellis Island Great Hall arrival-segment circulation vignette."
/>
<title>Ellis Island — Arrival Hall Circulation Vignette</title>
<style>
:root {
--ink: #17343a;
--paper: #f4ead6;
--gold: #d7b16c;
--rust: #9e5038;
--glass: rgba(19, 43, 48, 0.88);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #172e33;
color: var(--paper);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
outline: none;
cursor: grab;
}
#scene:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 5;
border: 1px solid rgba(215, 177, 108, 0.42);
background: var(--glass);
box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
#title-card {
top: 22px;
left: 22px;
width: min(390px, calc(100vw - 44px));
padding: 18px 20px 17px;
border-left: 4px solid var(--gold);
pointer-events: none;
}
.eyebrow {
margin: 0 0 7px;
color: var(--gold);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(25px, 4vw, 38px);
font-weight: 500;
line-height: 1;
letter-spacing: -0.025em;
}
#title-card .subtitle {
margin: 9px 0 0;
color: rgba(244, 234, 214, 0.76);
font-size: 13px;
line-height: 1.45;
}
#about-card {
top: 22px;
right: 22px;
width: min(310px, calc(100vw - 44px));
padding: 15px 17px;
pointer-events: none;
}
#about-card strong {
display: block;
margin-bottom: 6px;
color: var(--gold);
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
#about-card p {
margin: 0;
color: rgba(244, 234, 214, 0.78);
font-size: 12px;
line-height: 1.5;
}
#toolbar {
position: fixed;
z-index: 8;
bottom: 22px;
left: 22px;
display: flex;
flex-wrap: wrap;
gap: 7px;
max-width: calc(100vw - 44px);
}
button {
appearance: none;
border: 1px solid rgba(215, 177, 108, 0.42);
border-radius: 0;
padding: 10px 13px;
background: rgba(18, 42, 47, 0.91);
color: var(--paper);
font: inherit;
font-size: 11px;
font-weight: 750;
letter-spacing: 0.055em;
text-transform: uppercase;
cursor: pointer;
transition:
background 150ms ease,
border-color 150ms ease,
color 150ms ease;
}
button:hover,
button:focus-visible {
border-color: var(--gold);
background: rgba(49, 72, 73, 0.96);
outline: none;
}
button.active {
border-color: var(--gold);
background: var(--gold);
color: var(--ink);
}
#legend {
position: fixed;
z-index: 5;
right: 22px;
bottom: 22px;
display: grid;
grid-template-columns: auto auto;
gap: 7px 14px;
padding: 13px 16px;
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
color: rgba(244, 234, 214, 0.82);
font-size: 11px;
white-space: nowrap;
}
.swatch {
width: 10px;
height: 10px;
border-radius: 50%;
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24);
}
.swatch.group {
background: #d7b16c;
}
.swatch.queue {
background: #8e3e48;
}
.swatch.route {
background: #e7cf92;
}
.swatch.sign {
background: #72a9a1;
}
#hint {
position: fixed;
z-index: 4;
left: 50%;
bottom: 25px;
transform: translateX(-50%);
color: rgba(255, 255, 255, 0.68);
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
text-shadow: 0 2px 6px #000;
pointer-events: none;
white-space: nowrap;
}
#loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #172e33;
color: var(--paper);
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.loading-inner {
text-align: center;
}
.loading-mark {
width: 42px;
height: 42px;
margin: 0 auto 16px;
border: 2px solid rgba(215, 177, 108, 0.22);
border-top-color: var(--gold);
border-radius: 50%;
animation: spin 900ms linear infinite;
}
.loading-inner p {
margin: 0;
font-size: 11px;
letter-spacing: 0.18em;
text-transform: uppercase;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@media (max-width: 800px) {
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
}
#about-card {
display: none;
}
#toolbar {
bottom: 12px;
left: 12px;
max-width: calc(100vw - 24px);
}
button {
padding: 9px 10px;
font-size: 9px;
}
#legend {
right: 12px;
bottom: 68px;
}
#hint {
display: none;
}
}
@media (max-width: 520px) {
#legend {
display: none;
}
#title-card .subtitle {
font-size: 11px;
}
}
</style>
</head>
<body>
<canvas
id="scene"
tabindex="0"
aria-label="Interactive low-poly Ellis Island arrival hall with benches, queues, and wayfinding"
></canvas>
<header id="title-card" class="panel">
<p class="eyebrow">Low-poly spatial study</p>
<h1>Ellis Island</h1>
<p class="subtitle">
Great Hall arrival segment · benches, family-group circulation, queue lanes,
and overhead wayfinding.
</p>
</header>
<aside id="about-card" class="panel">
<strong>Interpretive, not an operational map</strong>
<p>
The architecture and furnishings evoke the Great Hall without reproducing a
specific historical moment. Figures are arranged as household groups; no
inspection outcomes, immigration decisions, or personal histories are implied.
</p>
</aside>
<nav id="toolbar" aria-label="Scene views">
<button class="active" data-view="overview" type="button">Overview</button>
<button data-view="seating" type="button">Seating</button>
<button data-view="queue" type="button">Queue</button>
<button data-view="plan" type="button">Plan</button>
<button id="route-toggle" class="active" type="button" aria-pressed="true">
Route marks
</button>
</nav>
<aside id="legend" class="panel" aria-label="Scene legend">
<div class="legend-item"><span class="swatch group"></span>Family group</div>
<div class="legend-item"><span class="swatch queue"></span>Queue boundary</div>
<div class="legend-item"><span class="swatch route"></span>Circulation mark</div>
<div class="legend-item"><span class="swatch sign"></span>Wayfinding</div>
</aside>
<div id="hint">Drag to orbit · Scroll to zoom · Shift-drag to pan</div>
<div id="loading" role="status" aria-live="polite">
<div class="loading-inner">
<div class="loading-mark"></div>
<p>Building arrival hall</p>
</div>
</div>
<noscript>
<div
style="
position: fixed;
inset: 0;
z-index: 30;
display: grid;
place-items: center;
background: #172e33;
color: #f4ead6;
padding: 30px;
text-align: center;
"
>
This interactive vignette requires JavaScript.
</div>
</noscript>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const loading = document.querySelector("#loading");
try {
boot();
} catch (error) {
console.error(error);
loading.querySelector("p").textContent =
"Unable to initialize the 3D scene. Please use a WebGL-capable browser.";
loading.querySelector(".loading-mark").style.animation = "none";
}
function boot() {
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x243b40);
scene.fog = new THREE.Fog(0x243b40, 48, 88);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance",
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
150,
);
const materialCache = new Map();
function material(color, options = {}) {
const key = `${color}-${JSON.stringify(options)}`;
if (!materialCache.has(key)) {
materialCache.set(
key,
new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.02,
flatShading: true,
...options,
}),
);
}
return materialCache.get(key);
}
const M = {
floor: material(0x9a6b4c),
floorEdge: material(0x6d4838),
wall: material(0x914b39),
wallDark: material(0x71392f),
trim: material(0xc8aa79),
stone: material(0xaf9d7d),
benchWood: material(0x75503b),
benchWoodLight: material(0x93674a),
metal: material(0x4e5553, { metalness: 0.45, roughness: 0.48 }),
brass: material(0xc49850, { metalness: 0.62, roughness: 0.4 }),
rope: material(0x77343d, { roughness: 0.92 }),
bag: material(0x4d443c),
cream: material(0xe7d4ad),
window: new THREE.MeshStandardMaterial({
color: 0x9dc9c9,
emissive: 0x6d9fa2,
emissiveIntensity: 0.55,
roughness: 0.38,
flatShading: true,
}),
};
function addMesh(geometry, mat, parent = scene) {
const mesh = new THREE.Mesh(geometry, mat);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function box(w, h, d, mat, x, y, z, parent = scene) {
const mesh = addMesh(new THREE.BoxGeometry(w, h, d), mat, parent);
mesh.position.set(x, y, z);
return mesh;
}
function cylinder(rTop, rBottom, h, mat, x, y, z, parent = scene, sides = 8) {
const mesh = addMesh(
new THREE.CylinderGeometry(rTop, rBottom, h, sides),
mat,
parent,
);
mesh.position.set(x, y, z);
return mesh;
}
function limb(a, b, radius, mat, parent) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const mesh = addMesh(
new THREE.CylinderGeometry(
radius,
radius,
direction.length(),
5,
),
mat,
parent,
);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize(),
);
return mesh;
}
// ------------------------------------------------------------------
// Lighting
// ------------------------------------------------------------------
scene.add(new THREE.HemisphereLight(0xdce9e6, 0x53392d, 2.15));
const sun = new THREE.DirectionalLight(0xffe0b0, 3.2);
sun.position.set(-16, 24, 13);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -32;
sun.shadow.camera.right = 32;
sun.shadow.camera.top = 30;
sun.shadow.camera.bottom = -30;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 70;
sun.shadow.bias = -0.00035;
scene.add(sun);
const coolFill = new THREE.DirectionalLight(0x91b8c0, 1.0);
coolFill.position.set(12, 12, -10);
scene.add(coolFill);
const warmFill = new THREE.PointLight(0xffbf78, 24, 30, 2);
warmFill.position.set(0, 7, 5);
scene.add(warmFill);
// ------------------------------------------------------------------
// Hall shell and tiled floor
// ------------------------------------------------------------------
box(46, 0.45, 36, M.floor, 0, -0.24, 0);
box(46.5, 0.35, 36.5, M.floorEdge, 0, -0.43, 0);
const tilePositions = [];
for (let x = -22; x <= 22; x += 2) {
tilePositions.push(x, 0.012, -17.9, x, 0.012, 17.9);
}
for (let z = -17; z <= 17; z += 2) {
tilePositions.push(-22.9, 0.012, z, 22.9, 0.012, z);
}
const tileGeometry = new THREE.BufferGeometry();
tileGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(tilePositions, 3),
);
scene.add(
new THREE.LineSegments(
tileGeometry,
new THREE.LineBasicMaterial({
color: 0x684838,
transparent: true,
opacity: 0.5,
}),
),
);
// Warm stone bands frame the tiled field.
box(45, 0.035, 0.35, M.trim, 0, 0.02, -16.9);
box(45, 0.035, 0.35, M.trim, 0, 0.02, 16.9);
box(0.35, 0.035, 34, M.trim, -21.8, 0.02, 0);
box(0.35, 0.035, 34, M.trim, 21.8, 0.02, 0);
// Rear wall.
box(46, 12.2, 0.6, M.wall, 0, 6.1, -18.3);
box(46, 0.65, 0.82, M.trim, 0, 0.33, -18.05);
box(46, 0.45, 0.92, M.trim, 0, 11.72, -17.98);
box(46, 0.28, 0.82, M.wallDark, 0, 10.95, -17.98);
// Side walls.
box(0.6, 7.2, 36, M.wall, -23, 3.6, 0);
box(0.6, 7.2, 36, M.wall, 23, 3.6, 0);
box(0.82, 0.42, 36, M.trim, -22.98, 7.15, 0);
box(0.82, 0.42, 36, M.trim, 22.98, 7.15, 0);
// ------------------------------------------------------------------
// Arched rear windows
// ------------------------------------------------------------------
function makeArchedWindow(x, width = 5.1, height = 7.2, bottom = 1.65) {
const radius = width / 2;
const shape = new THREE.Shape();
shape.moveTo(-radius, 0);
shape.lineTo(radius, 0);
shape.lineTo(radius, height - radius);
shape.absarc(0, height - radius, radius, 0, Math.PI, false);
shape.lineTo(-radius, 0);
const glass = addMesh(new THREE.ShapeGeometry(shape, 18), M.window);
glass.position.set(x, bottom, -17.965);
glass.castShadow = false;
const springY = bottom + height - radius;
const straightHeight = height - radius;
box(0.13, straightHeight, 0.16, M.trim, x - radius, bottom + straightHeight / 2, -17.83);
box(0.13, straightHeight, 0.16, M.trim, x + radius, bottom + straightHeight / 2, -17.83);
box(width, 0.13, 0.16, M.trim, x, bottom, -17.83);
box(0.10, straightHeight, 0.13, M.trim, x - width * 0.23, bottom + straightHeight / 2, -17.78);
box(0.10, straightHeight, 0.13, M.trim, x, bottom + straightHeight / 2, -17.78);
box(0.10, straightHeight, 0.13, M.trim, x + width * 0.23, bottom + straightHeight / 2, -17.78);
box(width, 0.10, 0.13, M.trim, x, bottom + straightHeight * 0.52, -17.78);
const arch = addMesh(
new THREE.TorusGeometry(radius, 0.10, 5, 20, Math.PI),
M.trim,
);
arch.position.set(x, springY, -17.79);
const innerArch = addMesh(
new THREE.TorusGeometry(radius - 0.18, 0.045, 4, 18, Math.PI),
M.stone,
);
innerArch.position.set(x, springY, -17.75);
}
[-16, -8, 0, 8, 16].forEach((x) => makeArchedWindow(x));
// Pilasters between the windows.
[-20, -12, -4, 4, 12, 20].forEach((x) => {
box(0.72, 10.5, 0.55, M.wallDark, x, 5.25, -17.68);
box(1.02, 0.42, 0.72, M.trim, x, 0.45, -17.6);
box(1.05, 0.38, 0.74, M.trim, x, 10.45, -17.58);
});
// ------------------------------------------------------------------
// Columns and roof structure
// ------------------------------------------------------------------
const roofGroup = new THREE.Group();
scene.add(roofGroup);
function makeColumn(x, z) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
box(1.7, 0.35, 1.7, M.stone, 0, 0.18, 0, group);
box(1.45, 0.28, 1.45, M.trim, 0, 0.48, 0, group);
cylinder(0.58, 0.67, 8.45, M.stone, 0, 4.95, 0, group, 10);
cylinder(0.86, 0.62, 0.5, M.trim, 0, 9.42, 0, group, 10);
box(1.55, 0.35, 1.55, M.trim, 0, 9.84, 0, group);
}
[-18, -12, -6, 0, 6, 12, 18].forEach((x) => makeColumn(x, -12.4));
// Lightweight roof frame; hidden in the plan camera preset.
[-16, -10, -4, 2, 8, 14].forEach((z) => {
box(45.5, 0.22, 0.32, M.metal, 0, 11.35, z, roofGroup);
});
[-18, -12, -6, 0, 6, 12, 18].forEach((x) => {
box(0.22, 0.28, 34, M.metal, x, 11.48, 0, roofGroup);
});
const skylight = addMesh(
new THREE.PlaneGeometry(45.5, 34),
new THREE.MeshBasicMaterial({
color: 0xc8dfdc,
transparent: true,
opacity: 0.055,
side: THREE.DoubleSide,
depthWrite: false,
}),
roofGroup,
);
skylight.rotation.x = Math.PI / 2;
skylight.position.y = 11.6;
skylight.castShadow = false;
// ------------------------------------------------------------------
// Benches
// ------------------------------------------------------------------
function makeBench(x, z, rotation = 0, length = 4.2) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
scene.add(group);
for (let i = 0; i < 5; i += 1) {
const slat = box(
length,
0.11,
0.13,
i % 2 ? M.benchWoodLight : M.benchWood,
0,
0.73,
-0.32 + i * 0.16,
group,
);
slat.castShadow = true;
}
[-0.35, 0.02, 0.38].forEach((y) => {
box(length, 0.12, 0.11, M.benchWood, 0, y, -0.43, group);
});
[-length * 0.38, length * 0.38].forEach((lx) => {
box(0.14, 0.75, 0.12, M.metal, lx, 0.37, -0.36, group);
box(0.14, 0.75, 0.12, M.metal, lx, 0.37, 0.36, group);
box(0.16, 0.12, 0.88, M.metal, lx, 0.76, 0, group);
box(0.16, 0.12, 0.88, M.metal, lx, 1.45, -0.43, group);
box(0.12, 0.74, 0.12, M.metal, lx, 1.1, -0.43, group);
});
return group;
}
makeBench(-15, -1, Math.PI / 2);
makeBench(-15, 5, Math.PI / 2);
makeBench(-6, 7.5, 0, 4.8);
makeBench(-6, 12.2, 0, 4.8);
makeBench(15, 5.5, -Math.PI / 2);
makeBench(15, 11, -Math.PI / 2);
// ------------------------------------------------------------------
// Queue stanchions and ropes
// ------------------------------------------------------------------
function makeStanchion(x, z) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
cylinder(0.32, 0.38, 0.10, M.metal, 0, 0.05, 0, group, 10);
cylinder(0.065, 0.085, 1.05, M.brass, 0, 0.58, 0, group, 8);
const cap = addMesh(new THREE.SphereGeometry(0.12, 8, 5), M.brass, group);
cap.position.set(0, 1.14, 0);
}
function ropeBetween(x1, z1, x2, z2) {
const segments = 6;
let previous = null;
for (let i = 0; i <= segments; i += 1) {
const t = i / segments;
const point = new THREE.Vector3(
THREE.MathUtils.lerp(x1, x2, t),
0.99 - Math.sin(t * Math.PI) * 0.17,
THREE.MathUtils.lerp(z1, z2, t),
);
if (previous) {
limb(
[previous.x, previous.y, previous.z],
[point.x, point.y, point.z],
0.032,
M.rope,
scene,
);
}
previous = point;
}
}
const queueXs = [2, 6, 10, 14];
const queueZs = [10, 4, -2, -8];
queueXs.forEach((x) => {
queueZs.forEach((z) => makeStanchion(x, z));
for (let i = 0; i < queueZs.length - 1; i += 1) {
ropeBetween(x, queueZs[i], x, queueZs[i + 1]);
}
});
// Cross-ropes at the queue entrance.
ropeBetween(2, 10, 6, 10);
ropeBetween(10, 10, 14, 10);
// ------------------------------------------------------------------
// Low-poly people, arranged as household groups
// ------------------------------------------------------------------
function makePerson({
coat = 0x3f6570,
trousers = 0x303a42,
skin = 0xb97855,
shoes = 0x292a29,
seated = false,
scale = 1,
} = {}) {
const group = new THREE.Group();
group.scale.setScalar(scale);
const coatMat = material(coat);
const trouserMat = material(trousers);
const skinMat = material(skin);
const shoeMat = material(shoes);
if (seated) {
const torso = cylinder(0.34, 0.46, 0.96, coatMat, 0, 1.25, 0, group, 6);
torso.rotation.x = -0.05;
const neck = cylinder(0.11, 0.13, 0.22, skinMat, 0, 1.79, 0, group, 6);
const head = addMesh(new THREE.IcosahedronGeometry(0.31, 1), skinMat, group);
head.position.set(0, 2.03, 0);
[-0.17, 0.17].forEach((lx) => {
limb([lx, 0.79, 0], [lx, 0.78, 0.52], 0.115, trouserMat, group);
limb([lx, 0.78, 0.52], [lx, 0.13, 0.52], 0.10, trouserMat, group);
box(0.24, 0.13, 0.38, shoeMat, lx, 0.07, 0.6, group);
});
[-0.39, 0.39].forEach((lx) => {
limb([lx, 1.64, 0], [lx * 1.05, 1.1, 0.18], 0.085, coatMat, group);
});
} else {
const torso = cylinder(0.34, 0.47, 1.02, coatMat, 0, 1.36, 0, group, 6);
torso.rotation.x = -0.025;
const neck = cylinder(0.11, 0.13, 0.22, skinMat, 0, 1.94, 0, group, 6);
const head = addMesh(new THREE.IcosahedronGeometry(0.31, 1), skinMat, group);
head.position.set(0, 2.19, 0);
[-0.17, 0.17].forEach((lx) => {
limb([lx, 0.91, 0], [lx, 0.12, 0], 0.105, trouserMat, group);
box(0.25, 0.14, 0.4, shoeMat, lx, 0.07, 0.09, group);
});
[-0.41, 0.41].forEach((lx, index) => {
limb(
[lx, 1.73, 0],
[lx * 1.08, 0.98, index === 0 ? 0.05 : 0.02],
0.085,
coatMat,
group,
);
});
}
return group;
}
function makeSuitcase(parent, x, z, color = 0x59483c) {
const group = new THREE.Group();
group.position.set(x, 0, z);
parent.add(group);
box(0.58, 0.82, 0.34, material(color), 0, 0.43, 0, group);
box(0.10, 0.28, 0.08, M.metal, 0, 0.98, 0, group);
box(0.33, 0.055, 0.08, M.metal, 0, 1.11, 0, group);
[-0.2, 0.2].forEach((lx) => {
const wheel = cylinder(
0.06,
0.06,
0.08,
M.metal,
lx,
0.04,
0,
group,
6,
);
wheel.rotation.z = Math.PI / 2;
});
}
function makeFamily({
x,
z,
rotation = 0,
seated = false,
palette = [0x315f6b, 0x9a5039, 0xd0a354],
skinA = 0xb97c59,
skinB = 0x8f5f43,
skinC = 0xc9916b,
suitcase = false,
}) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
scene.add(group);
const adultA = makePerson({
coat: palette[0],
trousers: 0x30363a,
skin: skinA,
seated,
});
adultA.position.x = -0.9;
group.add(adultA);
const child = makePerson({
coat: palette[2],
trousers: 0x384653,
skin: skinC,
seated,
scale: 0.73,
});
child.position.x = 0;
group.add(child);
const adultB = makePerson({
coat: palette[1],
trousers: 0x4b433e,
skin: skinB,
seated,
});
adultB.position.x = 0.9;
group.add(adultB);
// Inner arms visually connect the household group.
const shoulderY = seated ? 1.65 : 1.73;
const handY = seated ? 1.08 : 1.1;
limb(
[-0.47, shoulderY, 0],
[-0.27, handY, 0],
0.067,
material(palette[0]),
group,
);
limb(
[0.47, shoulderY, 0],
[0.27, handY, 0],
0.067,
material(palette[1]),
group,
);
if (suitcase) {
makeSuitcase(group, 1.42, 0.13, palette[1]);
}
return group;
}
// A seated household group at each principal bench zone.
makeFamily({
x: -15,
z: -1,
rotation: Math.PI / 2,
seated: true,
palette: [0x3b6672, 0x96523e, 0xc49a4f],
skinA: 0x9f684b,
skinB: 0xc48b64,
skinC: 0xa96f4e,
});
makeFamily({
x: 15,
z: 5.5,
rotation: -Math.PI / 2,
seated: true,
palette: [0x6b5542, 0x3f6873, 0xb56b48],
skinA: 0xc38b63,
skinB: 0x8d5b42,
skinC: 0xd09a70,
});
makeFamily({
x: -6,
z: 7.5,
rotation: 0,
seated: true,
palette: [0x855342, 0x385f6b, 0xd0a75d],
skinA: 0xb67553,
skinB: 0xd09b73,
skinC: 0x9d6547,
});
// A standing group remains together beside the seating area.
makeFamily({
x: -9.5,
z: 3.7,
rotation: 0.24,
palette: [0x3e6470, 0x9b5038, 0xd1a552],
skinA: 0xb97854,
skinB: 0x8d5b42,
skinC: 0xc38b63,
suitcase: true,
});
// Two household groups occupy the queue without implying outcomes.
makeFamily({
x: 4,
z: 0.6,
rotation: Math.PI,
palette: [0x73503e, 0x3f6670, 0xbc6a45],
skinA: 0x8f5d43,
skinB: 0xc48c65,
skinC: 0xa86b4c,
suitcase: true,
});
makeFamily({
x: 8,
z: -5.8,
rotation: Math.PI,
palette: [0x3b6170, 0xa2523c, 0xc39a4d],
skinA: 0xc18b64,
skinB: 0x9c674a,
skinC: 0xd09a72,
});
// ------------------------------------------------------------------
// Wayfinding signs
// ------------------------------------------------------------------
function drawArrow(ctx, direction, x, y, size, color) {
ctx.save();
ctx.translate(x, y);
ctx.fillStyle = color;
if (direction === "right") {
ctx.beginPath();
ctx.moveTo(-size * 0.55, -size * 0.16);
ctx.lineTo(size * 0.08, -size * 0.16);
ctx.lineTo(size * 0.08, -size * 0.42);
ctx.lineTo(size * 0.62, 0);
ctx.lineTo(size * 0.08, size * 0.42);
ctx.lineTo(size * 0.08, size * 0.16);
ctx.lineTo(-size * 0.55, size * 0.16);
ctx.closePath();
ctx.fill();
} else if (direction === "left") {
ctx.scale(-1, 1);
ctx.beginPath();
ctx.moveTo(-size * 0.55, -size * 0.16);
ctx.lineTo(size * 0.08, -size * 0.16);
ctx.lineTo(size * 0.08, -size * 0.42);
ctx.lineTo(size * 0.62, 0);
ctx.lineTo(size * 0.08, size * 0.42);
ctx.lineTo(size * 0.08, size * 0.16);
ctx.lineTo(-size * 0.55, size * 0.16);
ctx.closePath();
ctx.fill();
} else {
ctx.beginPath();
ctx.moveTo(-size * 0.17, size * 0.48);
ctx.lineTo(size * 0.17, size * 0.48);
ctx.lineTo(size * 0.17, -size * 0.08);
ctx.lineTo(size * 0.43, -size * 0.08);
ctx.lineTo(0, -size * 0.58);
ctx.lineTo(-size * 0.43, -size * 0.08);
ctx.lineTo(-size * 0.17, -size * 0.08);
ctx.closePath();
ctx.fill();
}
ctx.restore();
}
function makeSign({
x,
y,
z,
title,
subtitle,
arrow = "up",
width = 7,
height = 1.75,
rotation = 0,
}) {
const group = new THREE.Group();
group.position.set(x, y, z);
group.rotation.y = rotation;
scene.add(group);
const textureCanvas = document.createElement("canvas");
textureCanvas.width = 1024;
textureCanvas.height = 256;
const ctx = textureCanvas.getContext("2d");
ctx.fillStyle = "#18373c";
ctx.fillRect(0, 0, 1024, 256);
ctx.strokeStyle = "#d4ae67";
ctx.lineWidth = 10;
ctx.strokeRect(10, 10, 1004, 236);
ctx.strokeStyle = "rgba(244,234,214,0.18)";
ctx.lineWidth = 2;
ctx.strokeRect(28, 28, 968, 200);
ctx.fillStyle = "#f1e5ca";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "600 72px Georgia, serif";
ctx.fillText(title, 485, 101, 700);
ctx.fillStyle = "#d4ae67";
ctx.font = "700 29px Arial, sans-serif";
ctx.letterSpacing = "4px";
ctx.fillText(subtitle.toUpperCase(), 485, 169, 680);
drawArrow(ctx, arrow, 875, 125, 116, "#d4ae67");
const texture = new THREE.CanvasTexture(textureCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy(),
);
box(width, height, 0.16, M.metal, 0, 0, 0, group);
const face = addMesh(
new THREE.PlaneGeometry(width - 0.12, height - 0.12),
new THREE.MeshBasicMaterial({ map: texture }),
group,
);
face.position.z = 0.086;
face.castShadow = false;
const hangerLength = 11.45 - (y + height * 0.5);
[-width * 0.32, width * 0.32].forEach((lx) => {
cylinder(
0.028,
0.028,
hangerLength,
M.metal,
lx,
height * 0.5 + hangerLength / 2,
0,
group,
6,
);
});
return group;
}
makeSign({
x: 8,
y: 6.1,
z: 5.5,
title: "Registration",
subtitle: "Queue ahead",
arrow: "up",
width: 7.3,
});
makeSign({
x: -9,
y: 5.65,
z: -3.6,
title: "Baggage",
subtitle: "Claim area",
arrow: "right",
width: 6.8,
});
makeSign({
x: 0,
y: 9.55,
z: -17.45,
title: "Great Hall",
subtitle: "Public hall",
arrow: "up",
width: 7.2,
height: 1.6,
});
// ------------------------------------------------------------------
// Floor circulation marks
// ------------------------------------------------------------------
const routeGroup = new THREE.Group();
scene.add(routeGroup);
function makeFloorArrow(x, z, rotation = 0, scale = 1) {
const shape = new THREE.Shape();
shape.moveTo(-0.22, -1.15);
shape.lineTo(0.22, -1.15);
shape.lineTo(0.22, 0.35);
shape.lineTo(0.68, 0.35);
shape.lineTo(0, 1.25);
shape.lineTo(-0.68, 0.35);
shape.lineTo(-0.22, 0.35);
shape.closePath();
const arrow = addMesh(
new THREE.ShapeGeometry(shape),
new THREE.MeshBasicMaterial({
color: 0xe2c789,
transparent: true,
opacity: 0.72,
side: THREE.DoubleSide,
}),
routeGroup,
);
arrow.rotation.x = Math.PI / 2;
arrow.rotation.z = rotation;
arrow.position.set(x, 0.032, z);
arrow.scale.setScalar(scale);
arrow.castShadow = false;
}
makeFloorArrow(4, 13.2, Math.PI, 0.9);
makeFloorArrow(8, 13.2, Math.PI, 0.9);
makeFloorArrow(12, 13.2, Math.PI, 0.9);
makeFloorArrow(-9, -1, -Math.PI / 2, 0.85);
makeFloorArrow(-9, -5.8, -Math.PI / 2, 0.85);
makeFloorArrow(0, 15, Math.PI, 0.9);
// Small brass direction inlays reinforce the main circulation axis.
[-11, -3, 5, 13].forEach((x) => {
box(0.12, 0.025, 1.1, M.brass, x, 0.025, 15.8, routeGroup);
});
// ------------------------------------------------------------------
// Atmospheric dust
// ------------------------------------------------------------------
const dustCount = 240;
const dustPositions = new Float32Array(dustCount * 3);
const dustSpeeds = new Float32Array(dustCount);
for (let i = 0; i < dustCount; i += 1) {
dustPositions[i * 3] = THREE.MathUtils.randFloatSpread(42);
dustPositions[i * 3 + 1] = THREE.MathUtils.randFloat(0.5, 10.8);
dustPositions[i * 3 + 2] = THREE.MathUtils.randFloatSpread(32);
dustSpeeds[i] = THREE.MathUtils.randFloat(0.025, 0.07);
}
const dustGeometry = new THREE.BufferGeometry();
dustGeometry.setAttribute(
"position",
new THREE.BufferAttribute(dustPositions, 3),
);
const dust = new THREE.Points(
dustGeometry,
new THREE.PointsMaterial({
color: 0xf4dfb5,
size: 0.055,
transparent: true,
opacity: 0.32,
depthWrite: false,
}),
);
scene.add(dust);
// ------------------------------------------------------------------
// Custom camera controls — no Three.js addons
// ------------------------------------------------------------------
const presets = {
overview: {
yaw: 0.27,
pitch: 0.48,
distance: 39,
target: new THREE.Vector3(0, 2.1, -1.5),
},
seating: {
yaw: -0.58,
pitch: 0.3,
distance: 24,
target: new THREE.Vector3(-9.5, 1.6, 3.7),
},
queue: {
yaw: 0.56,
pitch: 0.35,
distance: 26,
target: new THREE.Vector3(7.2, 1.7, 0),
},
plan: {
yaw: 0,
pitch: 1.43,
distance: 40,
target: new THREE.Vector3(0, 0, -1),
},
};
const desired = {
yaw: presets.overview.yaw,
pitch: presets.overview.pitch,
distance: presets.overview.distance,
target: presets.overview.target.clone(),
};
const current = {
yaw: presets.overview.yaw,
pitch: presets.overview.pitch,
distance: presets.overview.distance,
target: presets.overview.target.clone(),
};
let activePreset = "overview";
let routeVisible = true;
function setPreset(name) {
const preset = presets[name];
if (!preset) return;
desired.yaw = preset.yaw;
desired.pitch = preset.pitch;
desired.distance = preset.distance;
desired.target.copy(preset.target);
activePreset = name;
document.querySelectorAll("[data-view]").forEach((button) => {
button.classList.toggle("active", button.dataset.view === name);
});
}
document.querySelectorAll("[data-view]").forEach((button) => {
button.addEventListener("click", () => setPreset(button.dataset.view));
});
const routeButton = document.querySelector("#route-toggle");
routeButton.addEventListener("click", () => {
routeVisible = !routeVisible;
routeGroup.visible = routeVisible;
routeButton.classList.toggle("active", routeVisible);
routeButton.setAttribute("aria-pressed", String(routeVisible));
routeButton.textContent = routeVisible ? "Route marks" : "Route marks off";
});
const pointers = new Map();
let lastPointer = null;
let pinchDistance = null;
canvas.addEventListener("pointerdown", (event) => {
canvas.focus();
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY,
});
lastPointer = { x: event.clientX, y: event.clientY };
if (pointers.size === 2) {
const values = [...pointers.values()];
pinchDistance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y,
);
}
});
canvas.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY,
});
if (pointers.size >= 2) {
const values = [...pointers.values()];
const nextDistance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y,
);
if (pinchDistance && nextDistance > 0) {
desired.distance = THREE.MathUtils.clamp(
desired.distance * (pinchDistance / nextDistance),
10,
58,
);
}
pinchDistance = nextDistance;
return;
}
const dx = event.clientX - lastPointer.x;
const dy = event.clientY - lastPointer.y;
lastPointer = { x: event.clientX, y: event.clientY };
if (event.shiftKey) {
const scale = desired.distance * 0.0014;
const rightX = Math.cos(desired.yaw);
const rightZ = -Math.sin(desired.yaw);
desired.target.x -= dx * scale * rightX;
desired.target.z -= dx * scale * rightZ;
desired.target.z -= dy * scale;
desired.target.x = THREE.MathUtils.clamp(
desired.target.x,
-18,
18,
);
desired.target.z = THREE.MathUtils.clamp(
desired.target.z,
-14,
14,
);
} else {
desired.yaw -= dx * 0.0055;
desired.pitch = THREE.MathUtils.clamp(
desired.pitch + dy * 0.0045,
0.12,
1.48,
);
}
});
function releasePointer(event) {
pointers.delete(event.pointerId);
pinchDistance = null;
lastPointer = pointers.size
? {
x: [...pointers.values()][0].x,
y: [...pointers.values()][0].y,
}
: null;
}
canvas.addEventListener("pointerup", releasePointer);
canvas.addEventListener("pointercancel", releasePointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desired.distance = THREE.MathUtils.clamp(
desired.distance * Math.exp(event.deltaY * 0.001),
10,
58,
);
},
{ passive: false },
);
canvas.addEventListener("dblclick", () => setPreset("overview"));
window.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
if (key === "arrowleft") desired.yaw += 0.1;
else if (key === "arrowright") desired.yaw -= 0.1;
else if (key === "arrowup") desired.pitch += 0.07;
else if (key === "arrowdown") desired.pitch -= 0.07;
else if (key === "+" || key === "=") desired.distance -= 1.5;
else if (key === "-") desired.distance += 1.5;
else if (key === "r") setPreset("overview");
else return;
event.preventDefault();
});
function updateCamera(dt) {
const easing = 1 - Math.exp(-dt * 6);
current.yaw = THREE.MathUtils.lerp(current.yaw, desired.yaw, easing);
current.pitch = THREE.MathUtils.lerp(current.pitch, desired.pitch, easing);
current.distance = THREE.MathUtils.lerp(
current.distance,
desired.distance,
easing,
);
current.target.lerp(desired.target, easing);
const horizontal = Math.cos(current.pitch) * current.distance;
camera.position.set(
current.target.x + Math.sin(current.yaw) * horizontal,
current.target.y + Math.sin(current.pitch) * current.distance,
current.target.z + Math.cos(current.yaw) * horizontal,
);
camera.lookAt(current.target);
// Open the roof as the view approaches a plan view.
roofGroup.visible = current.pitch < 1.18;
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
let firstFrame = true;
function animate() {
const dt = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
updateCamera(dt);
const positions = dust.geometry.attributes.position.array;
for (let i = 0; i < dustCount; i += 1) {
positions[i * 3 + 1] += dustSpeeds[i] * dt;
positions[i * 3] += Math.sin(elapsed * 0.2 + i) * 0.0015;
if (positions[i * 3 + 1] > 11) {
positions[i * 3 + 1] = 0.45;
}
}
dust.geometry.attributes.position.needsUpdate = true;
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
loading.classList.add("hidden");
window.setTimeout(() => {
loading.style.display = "none";
}, 450);
}
}
renderer.setAnimationLoop(animate);
}
</script>
</body>
</html>
```