Prompt specification
Build or customize the Three.js 3D scene "Museum Lost-Object Story" 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: Museum Lost-Object Story
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/museum-lost-object-story-x3751
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows different observers' partial knowledge of events. Build a small original museum scene where witnesses see different parts of a parcel's route. Present their available visual evidence and avoid inventing unsupported intentions. Voxel style.
Working Three.js Starter (museum-lost-object-story-x3751):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Parcel in Pieces — Museum of Partial Records</title>
<style>
:root {
--ink: #17313a;
--paper: #f3ecdc;
--muted: #66777b;
--accent: #e7674f;
--line: rgba(23, 49, 58, 0.18);
}
* { box-sizing: border-box; }
html, body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: #d8d2c3;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
}
.hud {
position: fixed;
inset: 0;
pointer-events: none;
}
.panel {
pointer-events: auto;
background: rgba(247, 241, 227, 0.94);
border: 1px solid rgba(23, 49, 58, 0.22);
box-shadow: 0 12px 35px rgba(23, 49, 58, 0.13);
backdrop-filter: blur(12px);
}
.title-panel {
position: absolute;
top: 22px;
left: 22px;
width: 350px;
padding: 18px 20px 17px;
border-top: 6px solid var(--ink);
}
.eyebrow {
margin: 0 0 8px;
font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.17em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(31px, 3.3vw, 49px);
line-height: 0.92;
letter-spacing: -0.055em;
text-transform: uppercase;
}
.subtitle {
margin: 12px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.45;
}
.tools {
position: absolute;
top: 22px;
right: 22px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
max-width: 390px;
}
.tool {
min-height: 38px;
padding: 9px 13px;
border: 1px solid rgba(23, 49, 58, 0.25);
background: rgba(247, 241, 227, 0.92);
color: var(--ink);
cursor: pointer;
font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.06em;
text-transform: uppercase;
transition: transform 150ms ease, background 150ms ease;
}
.tool:hover,
.tool:focus-visible {
transform: translateY(-2px);
background: #fffaf0;
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.method {
position: absolute;
top: 78px;
right: 22px;
width: 305px;
padding: 14px 15px;
border-left: 4px solid var(--accent);
}
.method strong {
display: block;
margin-bottom: 6px;
font: 700 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.method p {
margin: 0;
color: #52666c;
font-size: 12px;
line-height: 1.48;
}
.detail {
position: absolute;
left: 22px;
bottom: 22px;
width: 420px;
padding: 17px 18px 15px;
border-left: 6px solid var(--accent);
transition: border-color 180ms ease;
}
.detail-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
}
.detail h2 {
margin: 3px 0 0;
font-size: 24px;
line-height: 1.05;
letter-spacing: -0.025em;
}
.detail-index {
flex: 0 0 auto;
padding: 6px 8px;
border: 2px solid var(--accent);
color: var(--accent);
font: 800 14px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.evidence-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 17px;
margin-top: 15px;
}
.evidence-grid h3 {
margin: 0 0 7px;
font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.evidence-grid ul {
margin: 0;
padding: 0;
list-style: none;
}
.evidence-grid li {
position: relative;
margin: 0 0 7px;
padding-left: 12px;
color: #455c63;
font-size: 11.5px;
line-height: 1.35;
}
.evidence-grid li::before {
content: "";
position: absolute;
top: 0.48em;
left: 0;
width: 5px;
height: 5px;
background: var(--accent);
}
.unknown li::before {
background: transparent;
border: 1px solid #839096;
}
.detail-note {
margin: 13px 0 0;
padding-top: 11px;
border-top: 1px solid var(--line);
color: #65767a;
font-size: 11px;
line-height: 1.4;
}
.focus-button {
margin-top: 12px;
padding: 8px 10px;
border: 1px solid var(--ink);
background: var(--ink);
color: var(--paper);
cursor: pointer;
font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.focus-button:hover,
.focus-button:focus-visible {
background: var(--accent);
border-color: var(--accent);
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.stations {
position: absolute;
right: 22px;
bottom: 22px;
width: 285px;
padding: 12px;
}
.stations-label {
margin: 0 0 9px 2px;
color: var(--muted);
font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.station-button {
display: grid;
grid-template-columns: 34px 1fr;
align-items: center;
width: 100%;
margin-top: 6px;
padding: 9px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.34);
color: var(--ink);
text-align: left;
cursor: pointer;
transition: background 150ms ease, transform 150ms ease;
}
.station-button:hover,
.station-button:focus-visible {
background: #fffaf0;
transform: translateX(-3px);
outline: 2px solid var(--station-color);
outline-offset: 1px;
}
.station-button[aria-pressed="true"] {
border-color: var(--station-color);
background: #fffaf0;
box-shadow: inset 4px 0 0 var(--station-color);
}
.station-number {
color: var(--station-color);
font: 800 17px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.station-name {
font-size: 12px;
font-weight: 700;
}
.station-note {
display: block;
margin-top: 2px;
color: var(--muted);
font: 9px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.hint {
position: absolute;
left: 50%;
bottom: 24px;
transform: translateX(-50%);
padding: 8px 11px;
border-radius: 2px;
background: rgba(23, 49, 58, 0.86);
color: #f5eddf;
font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.07em;
text-transform: uppercase;
white-space: nowrap;
}
@media (max-width: 1000px) {
.method { display: none; }
.title-panel { width: 315px; }
.detail { width: 380px; }
.hint { display: none; }
}
@media (max-width: 720px) {
.title-panel {
top: 10px;
left: 10px;
width: min(290px, calc(100% - 70px));
padding: 12px 14px;
}
.title-panel h1 { font-size: 29px; }
.subtitle { display: none; }
.tools {
top: 10px;
right: 10px;
max-width: 56px;
}
.tool {
width: 56px;
min-height: 34px;
padding: 7px 4px;
font-size: 9px;
}
.detail {
left: 10px;
right: 10px;
bottom: 10px;
width: auto;
max-height: 43vh;
overflow: auto;
padding: 13px 14px;
}
.detail h2 { font-size: 20px; }
.evidence-grid { gap: 10px; margin-top: 10px; }
.evidence-grid li { font-size: 10.5px; }
.detail-note { display: none; }
.stations {
top: 72px;
right: 10px;
bottom: auto;
width: 58px;
padding: 6px;
}
.stations-label { display: none; }
.station-button {
display: flex;
align-items: center;
justify-content: center;
height: 37px;
padding: 4px;
}
.station-name, .station-note { display: none; }
}
</style>
</head>
<body>
<div id="scene"></div>
<main class="hud">
<header class="title-panel panel">
<p class="eyebrow">Museum of Partial Records · Case 03</p>
<h1>The Parcel<br>in Pieces</h1>
<p class="subtitle">
Three local records of a possible route. Each observer can establish only
what enters their frame.
</p>
</header>
<div class="tools" aria-label="Scene controls">
<button class="tool" id="overview">Overview</button>
<button class="tool" id="pause" aria-pressed="false">Pause</button>
<button class="tool" id="sightlines" aria-pressed="true">Sightlines</button>
</div>
<aside class="method panel">
<strong>Continuity is not demonstrated</strong>
<p>
A blue tape stripe appears in all three local records. That supports —
but does not prove — a shared parcel. No motive, ownership, contents,
recipient, or unseen route is assigned.
</p>
</aside>
<section class="detail panel" id="detail" aria-live="polite">
<div class="detail-top">
<div>
<p class="eyebrow" id="detail-kicker">Observer 01 · Local record</p>
<h2 id="detail-title">Loading-bay recorder</h2>
</div>
<span class="detail-index" id="detail-index">01</span>
</div>
<div class="evidence-grid">
<div>
<h3>Visible evidence</h3>
<ul id="visible-list"></ul>
</div>
<div class="unknown">
<h3>Not established</h3>
<ul id="unknown-list"></ul>
</div>
</div>
<p class="detail-note" id="detail-note"></p>
<button class="focus-button" id="focus-evidence">Focus this evidence</button>
</section>
<nav class="stations panel" aria-label="Evidence exhibits">
<p class="stations-label">Choose a local record</p>
<button class="station-button" data-station="dock" aria-pressed="true"
style="--station-color:#e7674f">
<span class="station-number">01</span>
<span>
<span class="station-name">Loading bay</span>
<span class="station-note">Threshold only</span>
</span>
</button>
<button class="station-button" data-station="bridge" aria-pressed="false"
style="--station-color:#4d9f9a">
<span class="station-number">02</span>
<span>
<span class="station-name">Upper walkway</span>
<span class="station-note">Crossing only</span>
</span>
</button>
<button class="station-button" data-station="screen" aria-pressed="false"
style="--station-color:#d9a93e">
<span class="station-number">03</span>
<span>
<span class="station-name">Screen gap</span>
<span class="station-note">Gap only</span>
</span>
</button>
</nav>
<div class="hint">Drag to orbit · Right-drag to pan · Wheel to zoom · Select an exhibit</div>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Data: each entry states only what its local view can support.
// -------------------------------------------------------------------------
const stations = [
{
id: "dock",
number: "01",
title: "Loading-bay recorder",
short: "LOADING BAY",
color: 0xe7674f,
css: "#e7674f",
x: -5.4,
z: 0.8,
visible: [
"A kraft-brown box appears on the yellow service line.",
"A blue tape stripe crosses the lid."
],
unknown: [
"Who placed or moved the box.",
"What happened beyond the doorway."
],
note: "The replay ends at the doorway. No handoff is shown."
},
{
id: "bridge",
number: "02",
title: "Gallery-window witness",
short: "UPPER WALKWAY",
color: 0x4d9f9a,
css: "#4d9f9a",
x: 0,
z: 0.8,
visible: [
"A kraft-brown box passes along the raised gallery walkway.",
"One blue tape stripe remains visible on the lid."
],
unknown: [
"How the box reached the walkway.",
"Whether matching tape proves it is the same box."
],
note: "The walkway is continuous; the records before and after it are not."
},
{
id: "screen",
number: "03",
title: "Archive-window witness",
short: "SCREEN GAP",
color: 0xd9a93e,
css: "#d9a93e",
x: 5.4,
z: 0.8,
visible: [
"A kraft-brown box appears through the central gap in a slatted screen.",
"One blue tape stripe remains visible on the lid."
],
unknown: [
"Whether anyone carried it.",
"Its contents, recipient, or final destination."
],
note: "Only the screen gap is shown. The room beyond is not recorded."
}
];
const stationById = Object.fromEntries(stations.map(s => [s.id, s]));
let selectedId = "dock";
let showSightlines = true;
let paused = false;
// -------------------------------------------------------------------------
// Renderer, camera, lights.
// -------------------------------------------------------------------------
const mount = document.getElementById("scene");
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"A voxel-style museum containing three independent records of a parcel."
);
mount.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8d2c3);
scene.fog = new THREE.Fog(0xd8d2c3, 27, 52);
const camera = new THREE.OrthographicCamera(-10, 10, 7, -7, 0.1, 100);
camera.position.set(14, 14, 18);
const hemisphere = new THREE.HemisphereLight(0xfff4df, 0x53666b, 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe8c8, 3.1);
sun.position.set(-8, 15, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -15;
sun.shadow.camera.right = 15;
sun.shadow.camera.top = 12;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 38;
sun.shadow.normalBias = 0.035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xbcd9dc, 1.05);
fill.position.set(12, 8, -10);
scene.add(fill);
// -------------------------------------------------------------------------
// Direct camera controls: orbit, pan and zoom without add-ons.
// -------------------------------------------------------------------------
const desired = {
target: new THREE.Vector3(0, 1.05, 0),
yaw: 0.72,
pitch: 0.78,
zoom: 1
};
const current = {
target: desired.target.clone(),
yaw: desired.yaw,
pitch: desired.pitch,
zoom: desired.zoom
};
function updateFrustum() {
const aspect = window.innerWidth / window.innerHeight;
const height = aspect < 1.15 ? 21 / aspect : 13.6;
camera.left = -height * aspect / 2;
camera.right = height * aspect / 2;
camera.top = height / 2;
camera.bottom = -height / 2;
camera.updateProjectionMatrix();
}
updateFrustum();
let pointer = null;
let totalPointerTravel = 0;
renderer.domElement.addEventListener("contextmenu", event => event.preventDefault());
renderer.domElement.addEventListener("pointerdown", event => {
pointer = {
id: event.pointerId,
x: event.clientX,
y: event.clientY,
startX: event.clientX,
startY: event.clientY,
pan: event.button === 2 || event.shiftKey
};
totalPointerTravel = 0;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", event => {
if (!pointer || pointer.id !== event.pointerId) return;
const dx = event.clientX - pointer.x;
const dy = event.clientY - pointer.y;
pointer.x = event.clientX;
pointer.y = event.clientY;
totalPointerTravel += Math.abs(dx) + Math.abs(dy);
if (pointer.pan) {
const scale = 0.014 / current.zoom;
desired.target.x -= dx * scale * Math.cos(current.yaw);
desired.target.z += dx * scale * Math.sin(current.yaw);
desired.target.x += dy * scale * Math.sin(current.yaw);
desired.target.z += dy * scale * Math.cos(current.yaw);
} else {
desired.yaw -= dx * 0.006;
desired.pitch = THREE.MathUtils.clamp(
desired.pitch + dy * 0.005,
0.35,
1.25
);
}
});
renderer.domElement.addEventListener("pointerup", event => {
if (!pointer || pointer.id !== event.pointerId) return;
if (totalPointerTravel < 7) {
selectFromCanvas(event);
}
pointer = null;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
});
renderer.domElement.addEventListener("pointercancel", () => {
pointer = null;
});
renderer.domElement.addEventListener("wheel", event => {
event.preventDefault();
desired.zoom = THREE.MathUtils.clamp(
desired.zoom * Math.exp(-event.deltaY * 0.001),
0.72,
2.8
);
}, { passive: false });
function focusOverview() {
desired.target.set(0, 1.05, 0);
desired.yaw = 0.72;
desired.pitch = 0.78;
desired.zoom = 1;
}
function focusStation(id) {
const station = stationById[id];
desired.target.set(station.x, 1.05, station.z);
desired.yaw = 0.68;
desired.pitch = 0.75;
desired.zoom = 1.58;
}
// -------------------------------------------------------------------------
// Voxel construction helpers.
// -------------------------------------------------------------------------
const materialCache = new Map();
function material(color) {
if (color && color.isMaterial) return color;
if (!materialCache.has(color)) {
materialCache.set(
color,
new THREE.MeshStandardMaterial({
color,
roughness: 0.82,
metalness: 0.015,
flatShading: true
})
);
}
return materialCache.get(color);
}
function box(parent, size, position, color, outlined = false) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
material(color)
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
if (outlined) {
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(mesh.geometry),
new THREE.LineBasicMaterial({
color: 0x17313a,
transparent: true,
opacity: 0.32
})
);
mesh.add(edges);
}
return mesh;
}
function plane(parent, texture, size, position, rotation = [0, 0, 0]) {
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(size[0], size[1]),
new THREE.MeshBasicMaterial({ map: texture })
);
mesh.position.set(position[0], position[1], position[2]);
mesh.rotation.set(rotation[0], rotation[1], rotation[2]);
parent.add(mesh);
return mesh;
}
function textureFromCanvas(draw, width = 1024, height = 512) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const context = canvas.getContext("2d");
draw(context, width, height);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.generateMipmaps = false;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function makeTitleTexture() {
return textureFromCanvas((ctx, w, h) => {
ctx.fillStyle = "#17313a";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#f3ecdc";
ctx.font = "800 76px monospace";
ctx.textBaseline = "middle";
ctx.fillText("THE PARCEL / IN PIECES", 52, 88);
ctx.fillStyle = "#8eb9b4";
ctx.font = "700 24px monospace";
ctx.fillText(
"THREE LOCAL RECORDS · NO UNSEEN LINK IS CLAIMED",
56,
158
);
ctx.fillStyle = "#e7674f";
ctx.fillRect(55, 199, 220, 8);
ctx.fillStyle = "#4d9f9a";
ctx.fillRect(285, 199, 220, 8);
ctx.fillStyle = "#d9a93e";
ctx.fillRect(515, 199, 220, 8);
}, 1400, 240);
}
function makeRouteBoardTexture() {
return textureFromCanvas((ctx, w, h) => {
ctx.fillStyle = "#203a42";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#f3ecdc";
ctx.font = "800 25px monospace";
ctx.fillText("OBSERVED SEGMENTS ONLY", 45, 42);
const segments = [
{ x: 55, color: "#e7674f", label: "01 THRESHOLD" },
{ x: 505, color: "#4d9f9a", label: "02 WALKWAY" },
{ x: 955, color: "#d9a93e", label: "03 SCREEN GAP" }
];
segments.forEach(segment => {
ctx.fillStyle = segment.color;
ctx.fillRect(segment.x, 92, 300, 34);
ctx.fillStyle = "#dce4df";
ctx.font = "700 22px monospace";
ctx.fillText(segment.label, segment.x, 159);
});
ctx.fillStyle = "#f3ecdc";
ctx.font = "800 38px monospace";
ctx.textAlign = "center";
ctx.fillText("?", 445, 121);
ctx.fillText("?", 895, 121);
ctx.fillStyle = "#9db0b3";
ctx.font = "18px monospace";
ctx.fillText(
"CONNECTIONS BETWEEN RECORDS ARE NOT DEMONSTRATED",
w / 2,
222
);
ctx.textAlign = "left";
}, 1400, 260);
}
function makeStationPlaqueTexture(station) {
return textureFromCanvas((ctx, w, h) => {
ctx.fillStyle = "#f0e7d4";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = station.css;
ctx.fillRect(0, 0, w, 35);
ctx.fillStyle = "#17313a";
ctx.font = "800 135px monospace";
ctx.fillText(station.number, 25, 165);
ctx.fillStyle = "#53686e";
ctx.font = "800 23px monospace";
ctx.fillText("LOCAL RECORD", 200, 85);
ctx.fillStyle = "#17313a";
ctx.font = "800 31px monospace";
ctx.fillText(station.short, 200, 135);
ctx.strokeStyle = "#b9b09f";
ctx.beginPath();
ctx.moveTo(200, 170);
ctx.lineTo(w - 25, 170);
ctx.stroke();
ctx.fillStyle = "#64767a";
ctx.font = "19px monospace";
ctx.fillText("ONLY THIS BAY", 200, 218);
ctx.fillText("IS SHOWN", 200, 247);
ctx.fillStyle = station.css;
ctx.fillRect(24, 265, 135, 12);
}, 512, 384);
}
function makeNumberTexture(station) {
return textureFromCanvas((ctx, w, h) => {
ctx.fillStyle = "#17313a";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = station.css;
ctx.font = "800 150px monospace";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(station.number, w / 2, h / 2 + 5);
}, 256, 256);
}
// -------------------------------------------------------------------------
// Museum shell.
// -------------------------------------------------------------------------
const museum = new THREE.Group();
scene.add(museum);
box(museum, [18.4, 0.65, 12.4], [0, -0.54, 0], 0x23383f, true);
box(museum, [18, 0.38, 12], [0, -0.19, 0], 0xe8dfcc, true);
const tileColors = [0xeee6d7, 0xe6ddcd, 0xeadfcb, 0xe2dac9];
for (let x = 0; x < 6; x++) {
for (let z = 0; z < 4; z++) {
box(
museum,
[2.94, 0.045, 2.94],
[-7.5 + x * 3, 0.015, -4.5 + z * 3],
tileColors[(x + z) % tileColors.length]
);
}
}
box(museum, [18, 6.3, 0.36], [0, 3.15, -6], 0xd7cdb9, true);
box(museum, [0.36, 4.8, 7.3], [-9, 2.4, -2.35], 0xc9bea9, true);
box(museum, [0.3, 1.6, 7.2], [9, 0.8, -2.4], 0xc9bea9, true);
box(museum, [18.15, 0.23, 0.52], [0, 0.32, -5.78], 0x7d9697);
box(museum, [0.52, 6.35, 0.52], [-8.35, 3.17, -5.75], 0x8ba0a0);
box(museum, [0.52, 6.35, 0.52], [8.35, 3.17, -5.75], 0x8ba0a0);
plane(
museum,
makeTitleTexture(),
[9.5, 1.63],
[0, 4.93, -5.79]
);
plane(
museum,
makeRouteBoardTexture(),
[10.8, 2.0],
[0, 3.15, -5.78]
);
// Track lights and small wall blocks.
box(museum, [13.5, 0.12, 0.22], [0, 5.94, -5.45], 0x263d43);
for (let i = -3; i <= 3; i++) {
box(museum, [0.38, 0.24, 0.52], [i * 1.85, 5.75, -5.27], 0x30484d);
box(museum, [0.25, 0.08, 0.08], [i * 1.85, 5.62, -5.05], 0xffe0a4);
}
function makePlanter(x, z) {
const group = new THREE.Group();
group.position.set(x, 0, z);
museum.add(group);
box(group, [1.05, 0.55, 1.05], [0, 0.28, 0], 0xb77555, true);
box(group, [0.84, 0.08, 0.84], [0, 0.57, 0], 0x5d493b);
box(group, [0.35, 0.8, 0.35], [0, 0.92, 0], 0x4f7660);
box(group, [0.58, 0.55, 0.45], [0.16, 1.08, 0.02], 0x628b68);
box(group, [0.4, 0.42, 0.6], [-0.18, 0.88, -0.06], 0x3f6957);
}
makePlanter(-8.15, 4.6);
makePlanter(8.15, 4.6);
box(museum, [3.1, 0.25, 0.72], [0, 0.42, 4.85], 0x8a6c54, true);
box(museum, [0.22, 0.45, 0.5], [-1.2, 0.2, 4.85], 0x3c5156);
box(museum, [0.22, 0.45, 0.5], [1.2, 0.2, 4.85], 0x3c5156);
// -------------------------------------------------------------------------
// Parcel, figures and station components.
// -------------------------------------------------------------------------
function makeParcel() {
const group = new THREE.Group();
const kraft = 0xb98758;
const tape = 0x5f9eb8;
const body = box(group, [0.68, 0.52, 0.58], [0, 0, 0], kraft, true);
box(group, [0.115, 0.025, 0.59], [0.12, 0.274, 0], tape);
box(group, [0.115, 0.45, 0.025], [0.12, 0.015, 0.302], tape);
box(group, [0.17, 0.012, 0.14], [-0.19, 0.28, 0.08], 0xe8d7ac);
// Small dark edge under the lid adds definition without smoothing the form.
box(group, [0.69, 0.025, 0.59], [0, 0.255, 0], 0x87603d);
group.userData.body = body;
return group;
}
function makeObserver(position, rotation, accent) {
const group = new THREE.Group();
group.position.copy(position);
group.rotation.y = rotation;
museum.add(group);
const skin = 0xc9916e;
const dark = 0x263c43;
box(group, [0.16, 0.36, 0.18], [-0.12, 0.18, 0], dark);
box(group, [0.16, 0.36, 0.18], [0.12, 0.18, 0], dark);
box(group, [0.43, 0.62, 0.31], [0, 0.66, 0], accent, true);
box(group, [0.13, 0.56, 0.14], [-0.29, 0.66, 0], skin);
box(group, [0.13, 0.56, 0.14], [0.29, 0.66, 0], skin);
box(group, [0.38, 0.38, 0.36], [0, 1.16, -0.015], skin, true);
box(group, [0.4, 0.12, 0.38], [0, 1.35, -0.01], 0x3b3331);
box(group, [0.07, 0.07, 0.025], [-0.09, 1.19, -0.205], 0x16282e);
box(group, [0.07, 0.07, 0.025], [0.09, 1.19, -0.205], 0x16282e);
// A simple blocky viewing device, held rather than implying a motive.
box(group, [0.24, 0.17, 0.12], [0, 0.72, -0.27], 0x334b52, true);
box(group, [0.09, 0.09, 0.08], [0, 0.72, -0.36], 0x8fb0b2);
return group;
}
const hitBoxes = [];
const stationVisuals = {};
function addCommonStation(station, group) {
box(group, [4.8, 0.24, 4.8], [0, 0.12, 0], 0xe7decc, true);
box(group, [4.55, 0.065, 0.16], [0, 0.26, 2.25], station.color);
box(group, [0.18, 0.065, 4.45], [-2.25, 0.26, 0], station.color);
// Number pedestal.
box(group, [0.68, 0.68, 0.68], [-1.72, 0.58, -1.72], 0x233b43, true);
plane(
group,
makeNumberTexture(station),
[0.56, 0.56],
[-1.72, 0.62, -1.365]
);
// Angled evidence lectern.
box(group, [0.16, 0.78, 0.16], [1.55, 0.63, 1.48], 0x496269, true);
box(group, [1.68, 0.1, 0.58], [1.55, 0.34, 1.48], 0x496269, true);
plane(
group,
makeStationPlaqueTexture(station),
[1.55, 1.16],
[1.55, 1.36, 1.49],
[-0.28, 0, 0]
);
const hit = new THREE.Mesh(
new THREE.BoxGeometry(4.8, 3.1, 4.8),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false,
colorWrite: false
})
);
hit.position.set(0, 1.55, 0);
hit.userData.stationId = station.id;
group.add(hit);
hitBoxes.push(hit);
const edge = new THREE.LineSegments(
new THREE.EdgesGeometry(new THREE.BoxGeometry(4.83, 0.25, 4.83)),
new THREE.LineBasicMaterial({
color: station.color,
transparent: true,
opacity: 0.18
})
);
edge.position.y = 0.12;
group.add(edge);
}
function addSightlines(station, group, eye, left, right) {
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute([
eye.x, eye.y, eye.z,
left.x, left.y, left.z,
right.x, right.y, right.z
], 3)
);
geometry.computeVertexNormals();
const coneMaterial = new THREE.MeshBasicMaterial({
color: station.color,
transparent: true,
opacity: 0.065,
side: THREE.DoubleSide,
depthWrite: false
});
const cone = new THREE.Mesh(geometry, coneMaterial);
group.add(cone);
const rays = new THREE.Group();
[left, right].forEach(target => {
const lineGeometry = new THREE.BufferGeometry().setFromPoints([eye, target]);
const line = new THREE.Line(
lineGeometry,
new THREE.LineDashedMaterial({
color: station.color,
transparent: true,
opacity: 0.38,
dashSize: 0.11,
gapSize: 0.08
})
);
line.computeLineDistances();
rays.add(line);
});
group.add(rays);
stationVisuals[station.id].cone = cone;
stationVisuals[station.id].rays = rays;
}
function makeStation(station) {
const group = new THREE.Group();
group.position.set(station.x, 0, station.z);
museum.add(group);
stationVisuals[station.id] = { group };
addCommonStation(station, group);
const base = 0.24;
const routeMaterial = new THREE.MeshStandardMaterial({
color: station.color,
emissive: station.color,
emissiveIntensity: 0.07,
roughness: 0.9
});
if (station.id === "dock") {
// Half-height service wall and an open doorway.
box(group, [4.25, 1.35, 0.2], [0, base + 0.675, -2.08], 0x82999a, true);
box(group, [0.2, 2.5, 0.3], [-1.25, base + 1.25, -1.48], 0x547278, true);
box(group, [0.2, 2.5, 0.3], [1.25, base + 1.25, -1.48], 0x547278, true);
box(group, [2.7, 0.22, 0.3], [0, base + 2.42, -1.48], 0x547278, true);
for (let i = 0; i < 4; i++) {
box(
group,
[2.42, 0.12, 0.25],
[0, base + 2.1 - i * 0.16, -1.48],
0x9ca8a2
);
}
box(group, [2.55, 0.035, 0.28], [0, base + 0.02, -1.48], 0xe8b843);
for (let i = 0; i < 7; i++) {
box(
group,
[0.24, 0.025, 0.13],
[0, base + 0.015, 0.75 - i * 0.42],
routeMaterial
);
}
// Blocky utility cart at the edge of the record.
box(group, [0.85, 0.12, 0.58], [-1.55, base + 0.28, 0.08], 0x67777a, true);
box(group, [0.12, 0.36, 0.12], [-1.82, base + 0.12, -0.13], 0x293e43);
box(group, [0.12, 0.36, 0.12], [-1.28, base + 0.12, -0.13], 0x293e43);
box(group, [0.64, 0.55, 0.48], [-1.55, base + 0.61, 0.08], 0xa97851, true);
makeObserver(
new THREE.Vector3(-1.55, base, 1.42),
0.08,
0xd97759
);
const parcel = makeParcel();
group.add(parcel);
stationVisuals[station.id].parcel = parcel;
addSightlines(
station,
group,
new THREE.Vector3(-1.55, base + 1.18, 1.28),
new THREE.Vector3(-1.05, base + 0.28, -1.48),
new THREE.Vector3(1.05, base + 0.28, -1.48)
);
}
if (station.id === "bridge") {
const walkwayY = base + 0.9;
box(group, [3.55, 0.18, 0.9], [0, walkwayY, -0.55], 0x789496, true);
box(group, [0.18, 0.9, 0.72], [-1.42, base + 0.45, -0.55], 0x4d686e, true);
box(group, [0.18, 0.9, 0.72], [1.42, base + 0.45, -0.55], 0x4d686e, true);
for (const x of [-1.55, -0.55, 0.55, 1.55]) {
box(group, [0.08, 0.72, 0.08], [x, walkwayY + 0.4, -0.93], 0x3b5359);
box(group, [0.08, 0.72, 0.08], [x, walkwayY + 0.4, -0.17], 0x3b5359);
}
box(group, [3.55, 0.08, 0.08], [0, walkwayY + 0.75, -0.93], 0x3b5359);
box(group, [3.55, 0.08, 0.08], [0, walkwayY + 0.75, -0.17], 0x3b5359);
for (let i = 0; i < 8; i++) {
box(
group,
[0.23, 0.025, 0.14],
[-1.4 + i * 0.4, walkwayY + 0.105, -0.55],
routeMaterial
);
}
makeObserver(
new THREE.Vector3(1.58, base, 1.3),
0.64,
0x5aa6a0
);
const parcel = makeParcel();
group.add(parcel);
stationVisuals[station.id].parcel = parcel;
addSightlines(
station,
group,
new THREE.Vector3(1.58, base + 1.18, 1.18),
new THREE.Vector3(-1.45, walkwayY + 0.28, -0.55),
new THREE.Vector3(1.45, walkwayY + 0.28, -0.55)
);
}
if (station.id === "screen") {
// Slatted screen with one central gap.
for (const side of [-1, 1]) {
for (let i = 0; i < 5; i++) {
const x = side * (0.55 + i * 0.19);
box(group, [0.095, 2.18, 0.18], [x, base + 1.09, -0.38], 0xa98252, true);
}
box(group, [1.03, 0.11, 0.22], [side * 0.94, base + 0.12, -0.38], 0x896743);
box(group, [1.03, 0.11, 0.22], [side * 0.94, base + 2.14, -0.38], 0x896743);
}
box(group, [0.16, 2.25, 0.22], [-1.54, base + 1.12, -0.38], 0x6f5539);
box(group, [0.16, 2.25, 0.22], [1.54, base + 1.12, -0.38], 0x6f5539);
for (let i = 0; i < 7; i++) {
box(
group,
[0.13, 0.025, 0.22],
[0, base + 0.015, 1.05 - i * 0.4],
routeMaterial
);
}
makeObserver(
new THREE.Vector3(1.55, base, 1.28),
0.74,
0xd5aa49
);
const parcel = makeParcel();
parcel.rotation.y = Math.PI / 2;
group.add(parcel);
stationVisuals[station.id].parcel = parcel;
addSightlines(
station,
group,
new THREE.Vector3(1.55, base + 1.18, 1.16),
new THREE.Vector3(-0.45, base + 0.28, -0.38),
new THREE.Vector3(0.45, base + 0.28, -0.38)
);
}
}
stations.forEach(makeStation);
// -------------------------------------------------------------------------
// UI state and interaction.
// -------------------------------------------------------------------------
const detail = document.getElementById("detail");
const detailKicker = document.getElementById("detail-kicker");
const detailTitle = document.getElementById("detail-title");
const detailIndex = document.getElementById("detail-index");
const visibleList = document.getElementById("visible-list");
const unknownList = document.getElementById("unknown-list");
const detailNote = document.getElementById("detail-note");
const stationButtons = [...document.querySelectorAll(".station-button")];
function updateStationAppearance() {
stations.forEach(station => {
const visual = stationVisuals[station.id];
const selected = station.id === selectedId;
visual.group.traverse(object => {
if (object.isLineSegments && object.material?.color) {
const isPlatformEdge =
object.geometry?.attributes?.position?.count === 24;
if (isPlatformEdge) {
object.material.opacity = selected ? 0.95 : 0.16;
}
}
});
visual.cone.material.opacity = selected ? 0.12 : 0.045;
visual.rays.visible = showSightlines;
visual.cone.visible = showSightlines;
});
}
function selectStation(id, shouldFocus = true) {
const station = stationById[id];
selectedId = id;
document.documentElement.style.setProperty("--accent", station.css);
detailKicker.textContent = `Observer ${station.number} · Local record`;
detailTitle.textContent = station.title;
detailIndex.textContent = station.number;
detailNote.textContent = station.note;
visibleList.innerHTML = station.visible
.map(text => `<li>${text}</li>`)
.join("");
unknownList.innerHTML = station.unknown
.map(text => `<li>${text}</li>`)
.join("");
stationButtons.forEach(button => {
button.setAttribute(
"aria-pressed",
String(button.dataset.station === selectedId)
);
});
updateStationAppearance();
if (shouldFocus) focusStation(id);
}
stationButtons.forEach(button => {
button.addEventListener("click", () => {
selectStation(button.dataset.station, true);
});
});
document.getElementById("overview").addEventListener("click", focusOverview);
document.getElementById("focus-evidence").addEventListener("click", () => {
focusStation(selectedId);
});
const pauseButton = document.getElementById("pause");
pauseButton.addEventListener("click", () => {
paused = !paused;
pauseButton.setAttribute("aria-pressed", String(paused));
pauseButton.textContent = paused ? "Resume" : "Pause";
});
const sightlineButton = document.getElementById("sightlines");
sightlineButton.addEventListener("click", () => {
showSightlines = !showSightlines;
sightlineButton.setAttribute("aria-pressed", String(showSightlines));
updateStationAppearance();
});
const raycaster = new THREE.Raycaster();
const pointerNDC = new THREE.Vector2();
function selectFromCanvas(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointerNDC.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointerNDC.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointerNDC, camera);
const hits = raycaster.intersectObjects(hitBoxes, false);
if (hits.length) {
selectStation(hits[0].object.userData.stationId, true);
}
}
selectStation("dock", false);
updateStationAppearance();
// -------------------------------------------------------------------------
// Independent local replays. No replay is connected to another.
// -------------------------------------------------------------------------
let replayTime = 0;
function pingPong(value) {
const wrapped = ((value % 1) + 1) % 1;
return wrapped < 0.5 ? wrapped * 2 : (1 - wrapped) * 2;
}
function updateParcels() {
const dock = stationVisuals.dock.parcel;
const dockT = pingPong(replayTime * 0.16);
dock.position.set(0, 0.51, 0.82 - dockT * 2.52);
const bridge = stationVisuals.bridge.parcel;
const bridgeT = pingPong(replayTime * 0.14 + 0.23);
bridge.position.set(-1.4 + bridgeT * 2.8, 1.51, -0.55);
const screen = stationVisuals.screen.parcel;
const screenT = pingPong(replayTime * 0.13 + 0.51);
screen.position.set(0, 0.51, 1.08 - screenT * 2.72);
}
// -------------------------------------------------------------------------
// Render loop and resize.
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
if (!paused) replayTime += delta;
updateParcels();
const smoothing = 1 - Math.exp(-delta * 7.5);
current.target.lerp(desired.target, smoothing);
current.yaw = THREE.MathUtils.lerp(current.yaw, desired.yaw, smoothing);
current.pitch = THREE.MathUtils.lerp(current.pitch, desired.pitch, smoothing);
current.zoom = THREE.MathUtils.lerp(current.zoom, desired.zoom, smoothing);
const distance = 24;
camera.position.set(
current.target.x + distance * Math.sin(current.yaw) * Math.cos(current.pitch),
current.target.y + distance * Math.sin(current.pitch),
current.target.z + distance * Math.cos(current.yaw) * Math.cos(current.pitch)
);
camera.lookAt(current.target);
camera.zoom = current.zoom;
camera.updateProjectionMatrix();
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
window.addEventListener("resize", () => {
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
updateFrustum();
});
</script>
</body>
</html>
```