Prompt specification
Build or customize the Three.js 3D scene "Small Regional Terminal Cutaway" 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: Small Regional Terminal Cutaway
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/small-regional-terminal-cutaway-x2083
Scene Description Prompt:
A voxel regional airport terminal cutaway separates passenger and baggage routes through check-in, boarding, and collection. One HTML file with Three.js from cdnjs.
Working Three.js Starter (small-regional-terminal-cutaway-x2083):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Voxel Regional Airport Terminal</title>
<style>
:root {
--ink: #102b3a;
--muted: #60727d;
--panel: rgba(248, 252, 252, 0.88);
--line: rgba(16, 43, 58, 0.13);
--cyan: #12a9a2;
--amber: #f3a638;
--coral: #ee6c58;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce8eb;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
#labels {
position: fixed;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.label {
position: absolute;
left: 0;
top: 0;
min-width: max-content;
padding: 7px 10px 7px 9px;
border: 1px solid rgba(255, 255, 255, 0.8);
border-left: 4px solid var(--cyan);
border-radius: 5px;
background: rgba(250, 253, 253, 0.92);
box-shadow: 0 5px 18px rgba(24, 48, 60, 0.15);
color: var(--ink);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.1em;
line-height: 1.15;
text-transform: uppercase;
white-space: nowrap;
transform: translate(-50%, -100%);
transition: opacity 150ms ease;
}
.label small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.08em;
}
.label.amber {
border-left-color: var(--amber);
}
.label.coral {
border-left-color: var(--coral);
}
#ui {
position: fixed;
inset: 0;
pointer-events: none;
}
.panel {
pointer-events: auto;
border: 1px solid rgba(255, 255, 255, 0.75);
background: var(--panel);
box-shadow: 0 12px 35px rgba(24, 48, 60, 0.12);
backdrop-filter: blur(12px);
}
#title-card {
position: absolute;
top: 20px;
left: 20px;
width: min(340px, calc(100vw - 40px));
padding: 16px 18px 15px;
border-radius: 10px;
}
.eyebrow {
color: var(--cyan);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 5px 0 6px;
font-size: 21px;
line-height: 1.08;
letter-spacing: -0.035em;
}
#title-card p {
margin: 0;
color: var(--muted);
font-size: 11px;
line-height: 1.45;
}
#legend {
display: flex;
flex-wrap: wrap;
gap: 8px 15px;
margin-top: 13px;
padding-top: 12px;
border-top: 1px solid var(--line);
}
.legend-item {
display: flex;
align-items: center;
gap: 6px;
color: #425762;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.07em;
text-transform: uppercase;
}
.swatch {
width: 18px;
height: 5px;
border-radius: 2px;
background: var(--cyan);
}
.swatch.amber {
background: var(--amber);
}
.swatch.coral {
background: var(--coral);
}
#controls {
position: absolute;
top: 20px;
right: 20px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
max-width: min(440px, calc(100vw - 40px));
}
button {
appearance: none;
border: 1px solid rgba(16, 43, 58, 0.12);
border-radius: 6px;
padding: 9px 11px;
background: rgba(250, 253, 253, 0.92);
color: var(--ink);
box-shadow: 0 5px 15px rgba(24, 48, 60, 0.09);
cursor: pointer;
font: inherit;
font-size: 9px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
transition:
transform 120ms ease,
background 120ms ease,
color 120ms ease;
}
button:hover {
transform: translateY(-1px);
background: #fff;
}
button.active {
border-color: var(--cyan);
background: var(--cyan);
color: white;
}
#hint {
position: absolute;
right: 20px;
bottom: 20px;
padding: 9px 12px;
border-radius: 6px;
color: #526873;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.06em;
text-transform: uppercase;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #dce8eb;
color: var(--ink);
font-size: 11px;
font-weight: 900;
letter-spacing: 0.18em;
text-transform: uppercase;
transition: opacity 300ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 700px) {
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 13px 14px;
}
h1 {
font-size: 18px;
}
#title-card p,
#legend {
display: none;
}
#controls {
top: auto;
right: 12px;
bottom: 54px;
left: 12px;
justify-content: center;
}
button {
padding: 8px 9px;
font-size: 8px;
}
#hint {
right: 12px;
bottom: 12px;
left: 12px;
text-align: center;
}
.label {
padding: 5px 7px;
font-size: 8px;
}
.label small {
display: none;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div id="labels"></div>
<div id="ui">
<section id="title-card" class="panel">
<div class="eyebrow">Terminal cutaway / Regional 01</div>
<h1>Passenger & baggage flow</h1>
<p>
A voxel airport terminal showing separated departure, boarding and
underground baggage collection routes.
</p>
<div id="legend">
<div class="legend-item"><span class="swatch"></span> Passenger</div>
<div class="legend-item"><span class="swatch amber"></span> Baggage</div>
<div class="legend-item"><span class="swatch coral"></span> Interface</div>
</div>
</section>
<nav id="controls" aria-label="Scene controls">
<button id="reset-view" type="button">Isometric</button>
<button id="top-view" type="button">Top view</button>
<button id="toggle-routes" class="active" type="button">Routes on</button>
<button id="toggle-labels" class="active" type="button">Labels on</button>
</nav>
<div id="hint" class="panel">
Drag to orbit · Shift/right-drag to pan · Scroll to zoom
</div>
</div>
<div id="loading">Building terminal cutaway…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer, camera and lighting
// ------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color("#dce8eb");
scene.fog = new THREE.Fog("#dce8eb", 55, 95);
const renderer = new THREE.WebGLRenderer({ antialias: true });
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.08;
document.querySelector("#scene").appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-20, 20, 15, -15, 0.1, 200);
const cameraTarget = new THREE.Vector3(0, -0.3, 0.8);
let cameraTheta = 0.72;
let cameraPhi = 0.96;
const cameraRadius = 55;
scene.add(new THREE.HemisphereLight("#ffffff", "#8aa0a6", 2.2));
const sun = new THREE.DirectionalLight("#fff8e9", 3.2);
sun.position.set(-18, 34, 24);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -38;
sun.shadow.camera.right = 38;
sun.shadow.camera.top = 30;
sun.shadow.camera.bottom = -30;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 90;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight("#b7dfe8", 1.1);
fill.position.set(25, 12, -20);
scene.add(fill);
// ------------------------------------------------------------
// Shared voxel construction helpers
// ------------------------------------------------------------
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const xAxis = new THREE.Vector3(1, 0, 0);
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,
...options
})
);
}
return materialCache.get(key);
}
function box(w, h, d, x, y, z, mat, parent = scene) {
const mesh = new THREE.Mesh(
unitBox,
typeof mat === "string" ? material(mat) : mat
);
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.castShadow = h > 0.08;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function beam(a, b, thickness, mat, parent = scene) {
const direction = b.clone().sub(a);
const length = direction.length();
const midpoint = a.clone().add(b).multiplyScalar(0.5);
const mesh = box(
length,
thickness,
thickness,
midpoint.x,
midpoint.y,
midpoint.z,
mat,
parent
);
mesh.quaternion.setFromUnitVectors(xAxis, direction.normalize());
return mesh;
}
function makeSign(text, subtitle, x, y, z, width, height, accent) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 256;
const context = canvas.getContext("2d");
context.fillStyle = "#102b3a";
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = accent;
context.fillRect(0, 0, canvas.width, 16);
context.fillRect(0, 238, canvas.width, 18);
context.textAlign = "center";
context.fillStyle = "#ffffff";
context.font = "800 72px system-ui, sans-serif";
context.fillText(text.toUpperCase(), 512, 125);
context.fillStyle = "#a9c2c9";
context.font = "700 27px system-ui, sans-serif";
context.fillText(subtitle.toUpperCase(), 512, 182);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
box(
width + 0.12,
height + 0.12,
0.14,
x,
y,
z - 0.09,
"#183848",
scene
);
const sign = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: texture })
);
sign.position.set(x, y, z);
scene.add(sign);
return sign;
}
// ------------------------------------------------------------
// Ground, terminal floor and exposed baggage level
// ------------------------------------------------------------
const routeGroup = new THREE.Group();
const motionGroup = new THREE.Group();
scene.add(routeGroup, motionGroup);
box(74, 0.45, 52, 0, -3.88, 0, "#b7c7ca");
box(20, 0.12, 23, 22, -3.62, -6.8, "#59686d");
box(36, 0.12, 17, 22, -3.61, -6.8, "#6f7e82");
// Upper terminal slab.
box(34, 0.48, 12.8, 0, -0.24, -1.6, "#e8eeeb");
box(34, 0.18, 0.22, 0, -0.25, 4.86, "#ee6c58");
// Entrance landing.
box(5.6, 0.48, 4.3, -14.4, -0.24, 6.25, "#e8eeeb");
box(5.6, 0.18, 0.22, -14.4, -0.25, 8.38, "#ee6c58");
// Lower baggage floor, visible through the cutaway.
box(34, 0.42, 4.6, 0, -3.26, 6.65, "#bdc9c8");
box(34, 0.16, 0.18, 0, -3.18, 8.93, "#ee6c58");
// Structural supports visible at the cut edge.
for (const x of [-16, -8, 0, 8, 16]) {
box(0.55, 2.65, 0.55, x, -1.57, 4.65, "#52707b");
box(1.5, 0.28, 1.5, x, -3.03, 4.65, "#789098");
}
// Rear wall, glazing and cut roof beam.
box(34, 1.05, 0.42, 0, 0.52, -8.2, "#183848");
box(34, 0.32, 0.55, 0, 4.18, -8.2, "#183848");
const glass = material("#a8d9dc", {
transparent: true,
opacity: 0.28,
depthWrite: false,
roughness: 0.18,
metalness: 0.05
});
for (let i = 0; i < 8; i++) {
const x = -14.9 + i * 4.25;
box(3.72, 2.95, 0.12, x, 2.55, -8.02, glass);
}
for (const x of [-17, -12.75, -8.5, -4.25, 0, 4.25, 8.5, 12.75, 17]) {
box(0.38, 4.1, 0.5, x, 2.05, -7.98, "#244b5a");
}
// Sparse floor tile joints.
for (let x = -16; x <= 16; x += 2) {
box(0.025, 0.012, 12.5, x, 0.012, -1.6, "#d4dedb");
}
for (let z = -7; z <= 4; z += 2) {
box(33.5, 0.012, 0.025, 0, 0.012, z, "#d4dedb");
}
// Exterior taxiway markings.
for (let z = -14; z <= 1; z += 2.3) {
box(0.22, 0.025, 1.2, 31.5, -3.53, z, "#e7bb4b");
}
for (let x = 18; x <= 34; x += 3.5) {
box(1.4, 0.025, 0.15, x, -3.52, 3.2, "#e7bb4b");
}
// ------------------------------------------------------------
// Check-in hall
// ------------------------------------------------------------
makeSign("Departures", "Check-in · Level 01", -11.2, 3.6, -0.3, 5.4, 1.25, "#12a9a2");
for (const x of [-13.5, -11, -8.5]) {
box(2.05, 1.05, 1.35, x, 0.53, 0.8, "#d7a26c");
box(2.18, 0.14, 1.48, x, 1.11, 0.8, "#f5f0e6");
box(0.52, 0.48, 0.12, x + 0.32, 1.42, 0.62, "#173847");
box(0.05, 0.27, 0.05, x + 0.32, 1.15, 0.62, "#789098");
box(0.38, 0.08, 0.25, x - 0.45, 1.2, 0.65, "#12a9a2");
box(1.1, 0.16, 0.42, x, 0.12, 2.08, "#324f5b");
}
// Queue stanchions.
function stanchion(x, z) {
box(0.12, 0.85, 0.12, x, 0.43, z, "#6e838c");
box(0.38, 0.08, 0.38, x, 0.04, z, "#374f59");
box(0.14, 0.12, 0.14, x, 0.91, z, "#efb657");
}
for (const x of [-15.1, -13.1, -11.1, -9.1, -7.1]) {
stanchion(x, 3.15);
if (x < -7.1) {
beam(
new THREE.Vector3(x, 0.88, 3.15),
new THREE.Vector3(x + 2, 0.88, 3.15),
0.055,
"#efb657"
);
}
}
// Baggage acceptance belt and vertical chute.
box(2.5, 0.38, 0.95, -11, 0.28, 1.65, "#273f4a");
box(1.75, 0.26, 0.72, -11, 0.42, 2.35, "#3e5964");
for (let i = 0; i < 8; i++) {
box(0.08, 0.035, 0.67, -11.7 + i * 0.2, 0.58, 2.35, "#8da0a5");
}
box(0.08, 2.25, 1.05, -10.25, -0.73, 3.45, "#526b75");
box(0.1, 0.35, 0.82, -10.25, -1.72, 3.8, "#f3a638");
// ------------------------------------------------------------
// Security screening
// ------------------------------------------------------------
makeSign("Security", "Screening · Level 01", -4.2, 3.65, -0.25, 4.2, 1.15, "#12a9a2");
function securityArch(x, z) {
box(0.28, 2.35, 0.4, x, 1.18, z - 0.85, "#244b5a");
box(0.28, 2.35, 0.4, x, 1.18, z + 0.85, "#244b5a");
box(0.34, 0.35, 1.95, x, 2.36, z, "#244b5a");
box(0.12, 0.12, 0.12, x, 2.58, z + 0.45, "#ee6c58");
}
securityArch(-4.8, 1.2);
securityArch(-3.05, 1.2);
for (const x of [-4.8, -3.05]) {
box(0.95, 0.78, 1.6, x, 0.42, 0.2, "#526b75");
box(0.78, 0.12, 1.45, x, 0.86, 0.2, "#91a3a7");
}
box(2.4, 0.86, 1.55, -3.92, 0.45, -1.05, "#3f5964");
box(2.15, 0.12, 1.4, -3.92, 0.94, -1.05, "#83969b");
// ------------------------------------------------------------
// Concourse seating, flight information and planting
// ------------------------------------------------------------
function seatRow(x, z, count = 4) {
for (let i = 0; i < count; i++) {
const sx = x + i * 0.75;
box(0.58, 0.16, 0.58, sx, 0.52, z, "#365866");
box(0.58, 0.58, 0.12, sx, 0.83, z - 0.25, "#365866");
box(0.08, 0.42, 0.08, sx - 0.22, 0.25, z, "#6f858d");
box(0.08, 0.42, 0.08, sx + 0.22, 0.25, z, "#6f858d");
}
}
seatRow(0.1, 2.25, 5);
seatRow(5.5, -2.8, 4);
seatRow(9.2, -3.7, 3);
makeSign("Gates A—B", "Boarding · Level 01", 8.1, 3.55, -6.9, 4.7, 1.15, "#12a9a2");
// Flight information display.
box(4.4, 1.75, 0.15, 2.1, 2.65, -7.85, "#102b3a");
box(3.95, 1.3, 0.03, 2.1, 2.67, -7.75, "#1d5263");
for (let i = 0; i < 3; i++) {
box(1.15, 0.075, 0.035, 1.1, 3.05 - i * 0.38, -7.71, "#77d2c9");
box(2.4, 0.055, 0.035, 2.35, 3.05 - i * 0.38, -7.7, "#d8e7e7");
}
function plant(x, z) {
box(0.72, 0.55, 0.72, x, 0.28, z, "#d89262");
box(0.52, 0.55, 0.52, x, 0.79, z, "#3d8c67");
box(0.38, 0.45, 0.38, x + 0.14, 1.24, z - 0.08, "#55a878");
}
plant(-15.6, -6.7);
plant(7.6, 1.8);
plant(13.8, -5.9);
// ------------------------------------------------------------
// Gate and jet bridge
// ------------------------------------------------------------
box(1.05, 1.05, 0.8, 11.25, 0.53, -6.75, "#d7a26c");
box(1.18, 0.14, 0.92, 11.25, 1.12, -6.75, "#f4efe5");
box(0.32, 0.05, 0.05, 11.25, 1.21, -6.45, "#12a9a2");
// Glass-sided boarding bridge.
box(6.0, 0.22, 2.0, 14.0, 0.02, -6.9, "#9eafb1");
box(6.0, 0.16, 0.12, 14.0, 2.2, -7.85, "#315563");
box(6.0, 0.16, 0.12, 14.0, 2.2, -5.95, "#315563");
box(6.0, 0.15, 2.05, 14.0, 2.29, -6.9, "#d5dfdc");
for (let x = 11.2; x < 17; x += 1.2) {
box(0.1, 2.0, 0.1, x, 1.12, -7.85, "#477180");
box(0.1, 2.0, 0.1, x, 1.12, -5.95, "#477180");
}
// ------------------------------------------------------------
// Voxel regional aircraft
// ------------------------------------------------------------
const aircraft = new THREE.Group();
aircraft.position.set(0, 0, 0);
scene.add(aircraft);
box(9.3, 2.15, 2.8, 21.7, -1.02, -6.9, "#f3f4ef", aircraft);
box(1.45, 1.72, 2.42, 16.55, -1.17, -6.9, "#eef2ee", aircraft);
box(0.65, 1.28, 1.95, 15.88, -1.35, -6.9, "#dce6e2", aircraft);
// Blue cheat line and windows.
box(8.8, 0.2, 0.035, 21.7, -1.58, -5.46, "#12a9a2", aircraft);
for (let x = 17.4; x < 25.7; x += 0.75) {
box(0.35, 0.32, 0.035, x, -0.65, -5.48, "#244b5a", aircraft);
}
// Cockpit.
box(0.75, 0.48, 1.6, 15.72, -0.66, -6.9, "#244b5a", aircraft);
// Stepped wings.
box(3.1, 0.22, 3.0, 21.5, -1.72, -6.9, "#e4e9e5", aircraft);
box(1.8, 0.2, 8.6, 22.0, -1.76, -6.9, "#e4e9e5", aircraft);
box(0.8, 0.18, 6.1, 22.7, -1.8, -6.9, "#d8e0dc", aircraft);
// Tail.
box(1.0, 2.6, 0.35, 26.2, 0.05, -6.9, "#12a9a2", aircraft);
box(1.35, 0.25, 3.9, 26.0, -0.72, -6.9, "#e4e9e5", aircraft);
// Engines and landing gear.
box(1.45, 0.75, 0.8, 20.5, -2.0, -4.85, "#d7e0dc", aircraft);
box(1.45, 0.75, 0.8, 20.5, -2.0, -8.95, "#d7e0dc", aircraft);
box(0.22, 1.15, 0.22, 19.7, -2.67, -6.9, "#52656b", aircraft);
box(0.22, 1.0, 0.22, 24.2, -2.58, -6.9, "#52656b", aircraft);
for (const x of [19.7, 24.2]) {
box(0.55, 0.28, 0.75, x, -3.23, -6.9, "#26383f", aircraft);
}
// ------------------------------------------------------------
// Lower baggage system
// ------------------------------------------------------------
makeSign("Baggage claim", "Collection · Level B1", 10.2, -0.75, 8.72, 5.6, 1.1, "#f3a638");
// Main conveyor.
box(15.5, 0.42, 1.15, -3.3, -2.65, 6.85, "#334c57");
for (let x = -10.7; x <= 4.2; x += 0.38) {
box(0.11, 0.08, 0.94, x, -2.39, 6.85, "#91a3a7");
}
// Scanner tunnel.
box(1.75, 1.85, 1.55, -5.4, -1.68, 6.85, "#e7b54e");
box(1.35, 1.3, 0.08, -5.4, -1.6, 7.65, "#29444f");
box(1.75, 0.16, 1.58, -5.4, -0.72, 6.85, "#f4c96d");
// Sorting spur.
beam(
new THREE.Vector3(3.5, -2.6, 6.85),
new THREE.Vector3(6.5, -2.6, 4.55),
0.65,
"#334c57"
);
beam(
new THREE.Vector3(6.3, -2.6, 4.65),
new THREE.Vector3(8.2, -2.6, 5.55),
0.65,
"#334c57"
);
// Claim carousel, built from square belt sections.
box(5.4, 0.28, 0.9, 10.6, -2.68, 5.2, "#334c57");
box(5.4, 0.28, 0.9, 10.6, -2.68, 8.25, "#334c57");
box(0.9, 0.28, 2.1, 8.35, -2.68, 6.72, "#334c57");
box(0.9, 0.28, 2.1, 12.85, -2.68, 6.72, "#334c57");
box(3.65, 0.42, 1.5, 10.6, -2.78, 6.72, "#799096");
// Sign supports and baggage carts.
box(0.15, 1.3, 0.15, 8.1, -2.15, 8.65, "#71878e");
box(0.15, 1.3, 0.15, 12.3, -2.15, 8.65, "#71878e");
for (const x of [3.8, 5.1]) {
box(1.0, 0.18, 1.25, x, -2.85, 4.1, "#536c75");
box(0.08, 0.55, 0.08, x - 0.34, -2.48, 3.65, "#8ba0a5");
box(0.08, 0.55, 0.08, x + 0.34, -2.48, 3.65, "#8ba0a5");
box(0.16, 0.16, 0.5, x, -2.25, 3.95, "#efb657");
}
// ------------------------------------------------------------
// Route curves, segmented voxel paths and arrows
// ------------------------------------------------------------
const passengerCurve = new THREE.CatmullRomCurve3(
[
new THREE.Vector3(-15.5, 0.08, 6.3),
new THREE.Vector3(-15.1, 0.08, 4.2),
new THREE.Vector3(-13.0, 0.08, 2.85),
new THREE.Vector3(-10.5, 0.08, 2.5),
new THREE.Vector3(-8.0, 0.08, 2.3),
new THREE.Vector3(-5.0, 0.08, 1.55),
new THREE.Vector3(-3.0, 0.08, 1.3),
new THREE.Vector3(-0.5, 0.08, -0.25),
new THREE.Vector3(3.0, 0.08, -1.2),
new THREE.Vector3(6.0, 0.08, -2.5),
new THREE.Vector3(9.0, 0.08, -4.5),
new THREE.Vector3(12.0, 0.08, -6.25),
new THREE.Vector3(16.15, 0.08, -6.9)
],
false,
"catmullrom",
0.16
);
const baggageCurve = new THREE.CatmullRomCurve3(
[
new THREE.Vector3(-11.0, 0.48, 1.85),
new THREE.Vector3(-11.0, -0.5, 2.75),
new THREE.Vector3(-11.0, -2.22, 4.8),
new THREE.Vector3(-9.0, -2.22, 6.85),
new THREE.Vector3(-5.0, -2.22, 6.85),
new THREE.Vector3(-0.5, -2.22, 6.85),
new THREE.Vector3(3.0, -2.22, 6.85),
new THREE.Vector3(5.5, -2.22, 5.2),
new THREE.Vector3(7.0, -2.22, 4.65),
new THREE.Vector3(8.2, -2.22, 5.55),
new THREE.Vector3(10.0, -2.22, 6.75),
new THREE.Vector3(12.0, -2.22, 6.75)
],
false,
"catmullrom",
0.14
);
function addRoute(curve, color, dashed = false) {
const points = curve.getSpacedPoints(120);
for (let i = 0; i < points.length - 1; i++) {
if (dashed && i % 3 === 2) continue;
const a = points[i];
const b = points[i + 1];
const direction = b.clone().sub(a);
const length = direction.length();
const midpoint = a.clone().add(b).multiplyScalar(0.5);
const segment = box(
length + 0.015,
0.055,
0.14,
midpoint.x,
midpoint.y,
midpoint.z,
color,
routeGroup
);
segment.quaternion.setFromUnitVectors(xAxis, direction.normalize());
segment.castShadow = false;
}
for (const t of [0.12, 0.3, 0.52, 0.73, 0.9]) {
const position = curve.getPointAt(t);
const tangent = curve.getTangentAt(t);
const arrow = new THREE.Group();
routeGroup.add(arrow);
box(0.16, 0.07, 0.74, 0, 0, -0.08, color, arrow);
const left = box(0.64, 0.07, 0.15, -0.18, 0, 0.2, color, arrow);
const right = box(0.64, 0.07, 0.15, 0.18, 0, 0.2, color, arrow);
left.rotation.y = -0.72;
right.rotation.y = 0.72;
arrow.position.copy(position);
arrow.rotation.y = Math.atan2(tangent.x, tangent.z);
}
}
addRoute(passengerCurve, "#12a9a2");
addRoute(baggageCurve, "#f3a638", true);
// ------------------------------------------------------------
// Animated voxel passengers and baggage
// ------------------------------------------------------------
function createPerson(color, scale = 1) {
const group = new THREE.Group();
const body = material(color);
box(0.38, 0.62, 0.28, 0, 0.98, 0, body, group);
box(0.31, 0.31, 0.29, 0, 1.48, 0, "#dca57d", group);
box(0.33, 0.1, 0.31, 0, 1.61, 0, "#263d48", group);
const leftLeg = box(0.14, 0.55, 0.16, -0.11, 0.35, 0, "#263d48", group);
const rightLeg = box(0.14, 0.55, 0.16, 0.11, 0.35, 0, "#263d48", group);
box(0.13, 0.48, 0.14, -0.29, 0.94, 0, body, group);
box(0.13, 0.48, 0.14, 0.29, 0.94, 0, body, group);
group.scale.setScalar(scale);
return { group, leftLeg, rightLeg };
}
const travelers = [];
const travelerColors = [
"#ef6c58",
"#2d7c91",
"#e4ad3d",
"#735b93",
"#4b9b7b",
"#d87991"
];
travelerColors.forEach((color, index) => {
const person = createPerson(color, 0.78 + (index % 3) * 0.06);
motionGroup.add(person.group);
const luggage = new THREE.Group();
box(0.28, 0.38, 0.22, 0, 0.22, 0, color, luggage);
box(0.035, 0.42, 0.035, -0.09, 0.55, 0, "#607681", luggage);
box(0.035, 0.42, 0.035, 0.09, 0.55, 0, "#607681", luggage);
box(0.19, 0.045, 0.045, 0, 0.75, 0, "#607681", luggage);
luggage.position.set(0.46, 0, -0.32);
person.group.add(luggage);
travelers.push({
...person,
offset: index / travelerColors.length,
speed: 0.011 + index * 0.0006
});
});
// Static passengers at check-in and security.
[
[-12.8, 2.95, "#4b9b7b"],
[-9.3, 2.15, "#ef6c58"],
[-3.9, 1.4, "#735b93"],
[4.1, -0.8, "#d87991"],
[10.2, -5.35, "#2d7c91"]
].forEach(([x, z, color]) => {
const person = createPerson(color, 0.78);
person.group.position.set(x, 0.02, z);
person.group.rotation.y = Math.PI;
motionGroup.add(person.group);
});
const movingBags = [];
["#e85f55", "#f2ac39", "#3a8992", "#785e92", "#4d9c76"].forEach(
(color, index) => {
const bag = new THREE.Group();
box(0.34, 0.44, 0.27, 0, 0.22, 0, color, bag);
box(0.035, 0.26, 0.035, -0.1, 0.56, 0, "#d7e0df", bag);
box(0.035, 0.26, 0.035, 0.1, 0.56, 0, "#d7e0df", bag);
box(0.22, 0.04, 0.04, 0, 0.68, 0, "#d7e0df", bag);
motionGroup.add(bag);
movingBags.push({
group: bag,
offset: index / 5,
speed: 0.017 + index * 0.001
});
}
);
// Bags circulating around the claim carousel.
const carouselBags = [];
for (let i = 0; i < 7; i++) {
const bag = new THREE.Group();
const colors = ["#ee6c58", "#f3a638", "#5c708d", "#4e9b79"];
box(0.3, 0.38, 0.24, 0, 0.18, 0, colors[i % colors.length], bag);
box(0.035, 0.24, 0.035, -0.08, 0.47, 0, "#d7e0df", bag);
box(0.035, 0.24, 0.035, 0.08, 0.47, 0, "#d7e0df", bag);
motionGroup.add(bag);
carouselBags.push(bag);
}
// ------------------------------------------------------------
// Projected HTML labels
// ------------------------------------------------------------
const labelElements = [];
function addLabel(title, subtitle, position, tone = "") {
const element = document.createElement("div");
element.className = `label ${tone}`;
element.innerHTML = `${title}<small>${subtitle}</small>`;
document.querySelector("#labels").appendChild(element);
labelElements.push({ element, position: position.clone() });
}
addLabel(
"Entrance",
"Public departures",
new THREE.Vector3(-15.1, 2.0, 6.4),
"coral"
);
addLabel(
"01 / Check-in",
"Acceptance & bag drop",
new THREE.Vector3(-11.2, 2.65, 0.6)
);
addLabel(
"02 / Security",
"Passenger screening",
new THREE.Vector3(-4.0, 2.8, 0.3)
);
addLabel(
"03 / Gates",
"Boarding concourse",
new THREE.Vector3(7.3, 2.7, -4.4)
);
addLabel(
"04 / Boarding",
"Jet bridge",
new THREE.Vector3(13.7, 2.7, -6.7)
);
addLabel(
"Bag drop",
"Chute to B1",
new THREE.Vector3(-11.0, 0.9, 2.6),
"amber"
);
addLabel(
"Baggage system",
"Sortation conveyor",
new THREE.Vector3(-0.5, -1.25, 6.9),
"amber"
);
addLabel(
"05 / Collection",
"Baggage claim",
new THREE.Vector3(10.6, -0.55, 6.7),
"amber"
);
// ------------------------------------------------------------
// Custom camera controls — no external controls module
// ------------------------------------------------------------
const canvas = renderer.domElement;
const pointers = new Map();
let previousPinchDistance = 0;
function updateCamera() {
const sinPhi = Math.sin(cameraPhi);
camera.position.set(
cameraTarget.x + cameraRadius * sinPhi * Math.sin(cameraTheta),
cameraTarget.y + cameraRadius * Math.cos(cameraPhi),
cameraTarget.z + cameraRadius * sinPhi * Math.cos(cameraTheta)
);
camera.lookAt(cameraTarget);
camera.updateMatrixWorld();
}
function orbit(dx, dy) {
cameraTheta -= dx * 0.006;
cameraPhi = THREE.MathUtils.clamp(cameraPhi - dy * 0.005, 0.12, 1.35);
updateCamera();
}
function pan(dx, dy) {
const direction = new THREE.Vector3();
camera.getWorldDirection(direction);
const right = new THREE.Vector3()
.crossVectors(direction, camera.up)
.normalize();
const up = new THREE.Vector3().crossVectors(right, direction).normalize();
const worldPerPixel =
(camera.top - camera.bottom) / camera.zoom / canvas.clientHeight;
cameraTarget.addScaledVector(right, -dx * worldPerPixel);
cameraTarget.addScaledVector(up, dy * worldPerPixel);
cameraTarget.x = THREE.MathUtils.clamp(cameraTarget.x, -20, 20);
cameraTarget.z = THREE.MathUtils.clamp(cameraTarget.z, -12, 12);
cameraTarget.y = THREE.MathUtils.clamp(cameraTarget.y, -3, 3);
updateCamera();
}
canvas.addEventListener("contextmenu", (event) => event.preventDefault());
canvas.addEventListener("pointerdown", (event) => {
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY,
button: event.button
});
if (pointers.size === 2) {
const [a, b] = [...pointers.values()];
previousPinchDistance = Math.hypot(a.x - b.x, a.y - b.y);
}
});
canvas.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY,
button: previous.button
});
if (pointers.size === 1) {
if (event.shiftKey || previous.button === 2) {
pan(dx, dy);
} else {
orbit(dx, dy);
}
} else if (pointers.size === 2) {
const [a, b] = [...pointers.values()];
const distance = Math.hypot(a.x - b.x, a.y - b.y);
if (previousPinchDistance > 0) {
camera.zoom = THREE.MathUtils.clamp(
camera.zoom * (distance / previousPinchDistance),
0.55,
3.8
);
camera.updateProjectionMatrix();
}
previousPinchDistance = distance;
}
});
function removePointer(event) {
pointers.delete(event.pointerId);
previousPinchDistance = 0;
}
canvas.addEventListener("pointerup", removePointer);
canvas.addEventListener("pointercancel", removePointer);
canvas.addEventListener("lostpointercapture", removePointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
camera.zoom = THREE.MathUtils.clamp(
camera.zoom * Math.exp(-event.deltaY * 0.001),
0.55,
3.8
);
camera.updateProjectionMatrix();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetView);
function resetView() {
cameraTheta = 0.72;
cameraPhi = 0.96;
cameraTarget.set(0, -0.3, 0.8);
camera.zoom = 1;
camera.updateProjectionMatrix();
updateCamera();
}
document.querySelector("#reset-view").addEventListener("click", resetView);
document.querySelector("#top-view").addEventListener("click", () => {
cameraTheta = 0;
cameraPhi = 0.06;
cameraTarget.set(0, -0.6, 0);
camera.zoom = 0.95;
camera.updateProjectionMatrix();
updateCamera();
});
let routesVisible = true;
let labelsVisible = true;
document.querySelector("#toggle-routes").addEventListener("click", (event) => {
routesVisible = !routesVisible;
routeGroup.visible = routesVisible;
motionGroup.visible = routesVisible;
event.currentTarget.textContent = routesVisible ? "Routes on" : "Routes off";
event.currentTarget.classList.toggle("active", routesVisible);
});
document.querySelector("#toggle-labels").addEventListener("click", (event) => {
labelsVisible = !labelsVisible;
event.currentTarget.textContent = labelsVisible ? "Labels on" : "Labels off";
event.currentTarget.classList.toggle("active", labelsVisible);
});
// ------------------------------------------------------------
// Responsive orthographic framing
// ------------------------------------------------------------
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
let viewHeight = 29;
if (viewHeight * aspect < 41) {
viewHeight = 41 / aspect;
}
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
resize();
updateCamera();
// ------------------------------------------------------------
// Animation loop
// ------------------------------------------------------------
const clock = new THREE.Clock();
const projected = new THREE.Vector3();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
travelers.forEach((traveler) => {
const t = (elapsed * traveler.speed + traveler.offset) % 1;
const position = passengerCurve.getPointAt(t);
const tangent = passengerCurve.getTangentAt(t);
traveler.group.position.copy(position);
traveler.group.rotation.y = Math.atan2(tangent.x, tangent.z);
const stride = Math.sin(elapsed * 7 + traveler.offset * 10) * 0.32;
traveler.leftLeg.rotation.x = stride;
traveler.rightLeg.rotation.x = -stride;
});
movingBags.forEach((bag, index) => {
const t = (elapsed * bag.speed + bag.offset) % 1;
bag.group.position.copy(baggageCurve.getPointAt(t));
bag.group.rotation.y = elapsed * 0.25 + index;
});
carouselBags.forEach((bag, index) => {
const t = (elapsed * 0.035 + index / carouselBags.length) % 1;
const side = t < 0.25 ? 0 : t < 0.5 ? 1 : t < 0.75 ? 2 : 3;
const local = (t * 4) % 1;
let x;
let z;
if (side === 0) {
x = THREE.MathUtils.lerp(8.8, 12.4, local);
z = 5.45;
} else if (side === 1) {
x = 12.4;
z = THREE.MathUtils.lerp(5.45, 7.95, local);
} else if (side === 2) {
x = THREE.MathUtils.lerp(12.4, 8.8, local);
z = 7.95;
} else {
x = 8.8;
z = THREE.MathUtils.lerp(7.95, 5.45, local);
}
bag.position.set(x, -2.28, z);
bag.rotation.y = -Math.PI / 2;
});
if (labelsVisible) {
labelElements.forEach(({ element, position }) => {
projected.copy(position).project(camera);
const visible =
projected.z >= -1 &&
projected.z <= 1 &&
projected.x > -1.15 &&
projected.x < 1.15 &&
projected.y > -1.15 &&
projected.y < 1.15;
element.style.opacity = visible ? "1" : "0";
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
element.style.transform = `translate(-50%, -100%) translate(${x}px, ${y}px)`;
});
} else {
labelElements.forEach(({ element }) => {
element.style.opacity = "0";
});
}
renderer.render(scene, camera);
}
animate();
requestAnimationFrame(() => {
const loading = document.querySelector("#loading");
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 350);
});
</script>
</body>
</html>
```