Prompt specification
Build or customize the Three.js 3D scene "National Mall gathering spatial study" 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: National Mall gathering spatial study
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/national-mall-gathering-spatial-study-x2443
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing the 1963 March on Washington. Build a compact referenced spatial model of the 1963 gathering area with monument, reflecting pool, and crowd zones. Avoid unsupported crowd counts or individual behavior claims. Low-poly.
Working Three.js Starter (national-mall-gathering-spatial-study-x2443):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>1963 March on Washington — Spatial Model</title>
<style>
:root {
--ink: #18262b;
--panel: rgba(249, 247, 238, 0.94);
--border: rgba(24, 38, 43, 0.22);
--accent: #a95432;
--accent-light: #dba071;
--water: #3f7481;
--green: #718167;
--shadow: 0 10px 32px rgba(20, 35, 40, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #a9c4d0;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#app,
#app canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
#app canvas {
touch-action: none;
outline: none;
}
.glass {
background: var(--panel);
border: 1px solid var(--border);
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
#heading {
position: fixed;
top: 18px;
left: 18px;
z-index: 10;
width: min(540px, calc(100vw - 36px));
padding: 16px 18px 14px;
border-radius: 14px;
pointer-events: none;
}
.eyebrow {
margin: 0 0 5px;
color: var(--accent);
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(1.45rem, 3vw, 2.15rem);
font-weight: 600;
line-height: 1.05;
letter-spacing: -0.025em;
}
.subtitle {
margin: 7px 0 0;
font-size: 0.87rem;
line-height: 1.4;
color: rgba(24, 38, 43, 0.78);
}
.scope-line {
display: inline-flex;
align-items: center;
gap: 7px;
margin-top: 11px;
padding-top: 9px;
width: 100%;
border-top: 1px solid var(--border);
font-size: 0.73rem;
font-weight: 700;
letter-spacing: 0.025em;
color: rgba(24, 38, 43, 0.72);
}
.scope-line::before {
content: "";
width: 9px;
height: 9px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 3px rgba(169, 84, 50, 0.14);
}
#toolbar {
position: fixed;
z-index: 12;
right: 18px;
top: 18px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
max-width: min(460px, calc(100vw - 36px));
}
button {
appearance: none;
border: 1px solid var(--border);
border-radius: 9px;
padding: 9px 11px;
background: rgba(249, 247, 238, 0.94);
color: var(--ink);
font: inherit;
font-size: 0.78rem;
font-weight: 750;
cursor: pointer;
box-shadow: 0 4px 16px rgba(20, 35, 40, 0.11);
transition:
transform 120ms ease,
background 120ms ease,
color 120ms ease;
}
button:hover {
transform: translateY(-1px);
background: #fffdf6;
}
button:focus-visible {
outline: 3px solid rgba(169, 84, 50, 0.35);
outline-offset: 2px;
}
button[aria-pressed="true"] {
color: #fffaf0;
background: var(--accent);
border-color: var(--accent);
}
#infoPanel {
position: fixed;
z-index: 20;
top: 74px;
right: 18px;
width: min(390px, calc(100vw - 36px));
max-height: calc(100vh - 96px);
overflow: auto;
padding: 18px;
border-radius: 14px;
transform: translateX(calc(100% + 30px));
opacity: 0;
pointer-events: none;
transition:
transform 180ms ease,
opacity 180ms ease;
}
#infoPanel.open {
transform: translateX(0);
opacity: 1;
pointer-events: auto;
}
#infoPanel h2 {
margin: 0 38px 10px 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 1.25rem;
font-weight: 600;
}
#infoPanel h3 {
margin: 18px 0 7px;
font-size: 0.73rem;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--accent);
}
#infoPanel p,
#infoPanel li {
font-size: 0.81rem;
line-height: 1.5;
}
#infoPanel p {
margin: 8px 0;
}
#infoPanel ul {
margin: 7px 0;
padding-left: 19px;
}
#infoPanel a {
color: #7e3f28;
font-weight: 700;
text-underline-offset: 2px;
}
#closeInfo {
position: absolute;
top: 12px;
right: 12px;
width: 32px;
height: 32px;
padding: 0;
border-radius: 50%;
font-size: 1rem;
}
#legend {
position: fixed;
z-index: 10;
left: 18px;
bottom: 18px;
width: min(340px, calc(100vw - 36px));
padding: 13px 15px;
border-radius: 13px;
pointer-events: none;
}
.legend-title {
margin: 0 0 9px;
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
gap: 9px;
margin: 7px 0;
font-size: 0.76rem;
color: rgba(24, 38, 43, 0.82);
}
.swatch {
flex: 0 0 auto;
width: 25px;
height: 14px;
border: 1px solid rgba(24, 38, 43, 0.25);
border-radius: 3px;
}
.swatch.zone {
background: repeating-linear-gradient(
135deg,
rgba(169, 84, 50, 0.12),
rgba(169, 84, 50, 0.12) 4px,
rgba(169, 84, 50, 0.55) 4px,
rgba(169, 84, 50, 0.55) 6px
);
}
.swatch.water {
background: var(--water);
}
.swatch.edge {
height: 0;
border: 0;
border-top: 2px dashed var(--accent);
}
#help {
position: fixed;
z-index: 10;
right: 18px;
bottom: 18px;
max-width: min(440px, calc(100vw - 36px));
padding: 10px 13px;
border-radius: 11px;
pointer-events: none;
font-size: 0.73rem;
line-height: 1.45;
text-align: right;
color: rgba(24, 38, 43, 0.78);
}
#loading {
position: fixed;
z-index: 50;
inset: 0;
display: grid;
place-items: center;
background: #a9c4d0;
transition: opacity 300ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.loading-card {
padding: 18px 22px;
border-radius: 12px;
font-size: 0.86rem;
font-weight: 750;
letter-spacing: 0.03em;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 760px) {
#heading {
top: 10px;
left: 10px;
width: calc(100vw - 20px);
padding: 12px 14px;
}
#toolbar {
top: auto;
right: 10px;
bottom: 66px;
max-width: calc(100vw - 20px);
}
#legend {
left: 10px;
bottom: 10px;
width: calc(100vw - 20px);
padding: 10px 12px;
}
#legend .legend-row:nth-of-type(n + 3) {
display: none;
}
#help {
display: none;
}
#infoPanel {
top: 112px;
right: 10px;
width: calc(100vw - 20px);
max-height: calc(100vh - 132px);
}
button {
padding: 8px 9px;
font-size: 0.72rem;
}
}
</style>
</head>
<body>
<div id="app" aria-label="Interactive low-poly spatial model of the 1963 March on Washington gathering area"></div>
<header id="heading" class="glass">
<p class="eyebrow">Washington, D.C. · August 28, 1963</p>
<h1>March on Washington for Jobs and Freedom</h1>
<p class="subtitle">
A compact spatial model of the Lincoln Memorial, Reflecting Pool,
Washington Monument, and broad gathering areas.
</p>
<div class="scope-line">
Schematic interpretation—not a surveyed reconstruction or attendance graphic
</div>
</header>
<nav id="toolbar" aria-label="Model controls">
<button id="overviewBtn" type="button" title="Return to the perspective overview">Overview</button>
<button id="topBtn" type="button" title="View the Mall axis from above">Top view</button>
<button id="zonesBtn" type="button" aria-pressed="true">Zones: On</button>
<button id="labelsBtn" type="button" aria-pressed="true">Labels: On</button>
<button id="resetBtn" type="button">Reset</button>
<button id="infoBtn" type="button" aria-expanded="false">Sources & scope</button>
</nav>
<aside id="infoPanel" class="glass" aria-hidden="true">
<button id="closeInfo" type="button" aria-label="Close sources and scope">×</button>
<h2>References and interpretive limits</h2>
<h3>Reference basis</h3>
<p>
Landmark relationships were synthesized from National Park Service site
descriptions and maps. Broad gathering areas were placed using the general
arrangement visible in contemporaneous overview photographs; they are not
mapped as precise crowd boundaries.
</p>
<ul>
<li>
<a href="https://www.nps.gov/linc/index.htm"
target="_blank" rel="noopener noreferrer">
National Park Service — Lincoln Memorial
</a>
: memorial form, steps, and orientation.
</li>
<li>
<a href="https://www.nps.gov/nama/planyourvisit/reflecting-pool.htm"
target="_blank" rel="noopener noreferrer">
National Park Service — Reflecting Pool
</a>
: pool position along the National Mall.
</li>
<li>
<a href="https://www.nps.gov/nama/planyourvisit/maps.htm"
target="_blank" rel="noopener noreferrer">
National Park Service — National Mall maps
</a>
: relative placement of Mall landmarks.
</li>
<li>
<a href="https://www.loc.gov/pictures/search/?q=March%20on%20Washington%20for%20Jobs%20and%20Freedom%201963"
target="_blank" rel="noopener noreferrer">
Library of Congress — March on Washington photographic views
</a>
: broad visual context for the gathering-area interpretation.
</li>
</ul>
<h3>What the model does not claim</h3>
<ul>
<li>No attendance figure or crowd density is encoded.</li>
<li>No person-scale figures or individual actions are represented.</li>
<li>Hatching marks an approximate area, not a historical perimeter.</li>
<li>Architecture and distances are deliberately simplified for orientation.</li>
<li>The scene is a contemporary interpretive model, not a period reconstruction.</li>
</ul>
<h3>Navigation</h3>
<p>
Drag to orbit, use the wheel or pinch to zoom, and use the arrow keys to
rotate. Press <strong>+</strong>/<strong>−</strong> to zoom,
<strong>T</strong> for a top view, <strong>G</strong> for crowd zones,
<strong>L</strong> for labels, and <strong>R</strong> to reset.
</p>
</aside>
<section id="legend" class="glass" aria-label="Legend">
<p class="legend-title">Model legend</p>
<div class="legend-row">
<span class="swatch zone"></span>
Broad crowd zone; approximate area, not density
</div>
<div class="legend-row">
<span class="swatch water"></span>
Reflecting Pool
</div>
<div class="legend-row">
<span class="swatch edge"></span>
Dashed edge indicates an interpretive boundary
</div>
</section>
<div id="help" class="glass">
Drag to orbit · Wheel or pinch to zoom · Arrow keys to rotate<br>
T top view · G zones · L labels · R reset
</div>
<div id="loading">
<div class="loading-card glass">Preparing the spatial model…</div>
</div>
<div id="announcement" class="sr-only" aria-live="polite"></div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Scene and renderer
// ------------------------------------------------------------
const app = document.getElementById("app");
const announcement = document.getElementById("announcement");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xa9c4d0);
scene.fog = new THREE.Fog(0xa9c4d0, 155, 330);
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
600
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Drag to orbit the low-poly model of the March on Washington gathering area"
);
app.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xdcecf2, 0x6e7059, 2.1);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff1d6, 3.0);
sun.position.set(-65, 105, 65);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -125;
sun.shadow.camera.right = 125;
sun.shadow.camera.top = 100;
sun.shadow.camera.bottom = -100;
sun.shadow.camera.near = 10;
sun.shadow.camera.far = 250;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xb8d7e3, 0.65);
fill.position.set(80, 45, -80);
scene.add(fill);
// ------------------------------------------------------------
// Materials
// ------------------------------------------------------------
const materials = {
grass: new THREE.MeshStandardMaterial({
color: 0x718167,
roughness: 1,
flatShading: true
}),
path: new THREE.MeshStandardMaterial({
color: 0xb9aa8d,
roughness: 1,
flatShading: true
}),
pathEdge: new THREE.MeshStandardMaterial({
color: 0x877b68,
roughness: 1,
flatShading: true
}),
stone: new THREE.MeshStandardMaterial({
color: 0xe4dfd1,
roughness: 0.87,
flatShading: true
}),
stoneSide: new THREE.MeshStandardMaterial({
color: 0xcac5b9,
roughness: 0.92,
flatShading: true
}),
recess: new THREE.MeshStandardMaterial({
color: 0x343a3a,
roughness: 1,
flatShading: true
}),
monument: new THREE.MeshStandardMaterial({
color: 0xc9b99a,
roughness: 0.96,
flatShading: true
}),
water: new THREE.MeshStandardMaterial({
color: 0x3f7481,
roughness: 0.28,
metalness: 0.08,
flatShading: true
}),
coping: new THREE.MeshStandardMaterial({
color: 0xc8c5bb,
roughness: 0.9,
flatShading: true
}),
arrow: new THREE.MeshStandardMaterial({
color: 0x8a4d35,
roughness: 0.9,
flatShading: true
})
};
const world = new THREE.Group();
scene.add(world);
function addBox(size, position, material, parent = world) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
material
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addPlane(width, depth, x, y, z, material, parent = world) {
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, depth),
material
);
mesh.rotation.x = -Math.PI / 2;
mesh.position.set(x, y, z);
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// ------------------------------------------------------------
// Ground and Mall axis
// Local axes: +X east, +Z north, +Y up.
// ------------------------------------------------------------
addPlane(360, 250, 0, -0.08, 0, materials.grass);
// Broad paved surfaces around the western gathering area.
addPlane(100, 72, -28, 0.01, 0, materials.path);
addPlane(145, 72, 83, 0.015, 0, materials.path);
// Narrow green median beyond the Reflecting Pool.
addPlane(50, 15, 40, 0.025, 0, materials.grass);
// ------------------------------------------------------------
// Reflecting Pool
// ------------------------------------------------------------
const pool = new THREE.Group();
world.add(pool);
addBox([60, 0.34, 27], [-15, 0.19, 0], materials.coping, pool);
const water = addPlane(
57.8,
24.8,
-15,
0.405,
0,
materials.water,
pool
);
water.castShadow = false;
// Coping around the long rectangular basin.
addBox([60, 0.48, 1.2], [-15, 0.40, -13.1], materials.coping, pool);
addBox([60, 0.48, 1.2], [-15, 0.40, 13.1], materials.coping, pool);
addBox([1.2, 0.48, 27], [-44.4, 0.40, 0], materials.coping, pool);
addBox([1.2, 0.48, 27], [14.4, 0.40, 0], materials.coping, pool);
// ------------------------------------------------------------
// Lincoln Memorial — simplified low-poly architecture
// East-facing steps and colonnade overlook the pool.
// ------------------------------------------------------------
const memorial = new THREE.Group();
world.add(memorial);
addBox([16, 2.4, 52], [-66, 1.2, 0], materials.stoneSide, memorial);
// Four broad, simplified steps.
for (let i = 0; i < 4; i++) {
const height = 0.6 * (i + 1);
addBox(
[1.2, height, 52 - i * 0.7],
[-55.7 - i * 0.78, height / 2, 0],
i % 2 === 0 ? materials.stone : materials.stoneSide,
memorial
);
}
addBox([12, 2.2, 46], [-67, 3.3, 0], materials.stone, memorial);
// Dark recessed interior visible through the colonnade.
addBox([0.7, 8.6, 41.5], [-61.7, 8.7, 0], materials.recess, memorial);
addBox([41.5, 8.6, 0.7], [-67, 8.7, -22.4], materials.recess, memorial);
addBox([41.5, 8.6, 0.7], [-67, 8.7, 22.4], materials.recess, memorial);
const columnGeometry = new THREE.CylinderGeometry(
0.78,
0.92,
8.7,
8,
1,
false
);
function addColumn(x, z) {
const column = new THREE.Mesh(columnGeometry, materials.stone);
column.position.set(x, 8.75, z);
column.castShadow = true;
column.receiveShadow = true;
memorial.add(column);
}
// Twelve columns on each principal face.
for (let i = 0; i < 12; i++) {
const z = -20.9 + i * 3.8;
addColumn(-60.9, z);
addColumn(-73.1, z);
}
// Six interior columns on each side.
for (let i = 0; i < 6; i++) {
const x = -71.6 + i * 1.9;
addColumn(x, -23.0);
addColumn(x, 23.0);
}
addBox([14.2, 2.3, 51], [-67, 14.25, 0], materials.stone, memorial);
addBox([11.5, 2.4, 47.5], [-67, 16.7, 0], materials.stoneSide, memorial);
addBox([12.0, 0.35, 48.0], [-67, 18.05, 0], materials.stone, memorial);
// ------------------------------------------------------------
// Washington Monument — orientation landmark
// ------------------------------------------------------------
const washingtonMonument = new THREE.Group();
washingtonMonument.position.x = 72;
world.add(washingtonMonument);
addBox([14, 1, 14], [0, 0.5, 0], materials.stoneSide, washingtonMonument);
addBox([11, 1, 11], [0, 1.5, 0], materials.stone, washingtonMonument);
addBox([8.8, 1, 8.8], [0, 2.5, 0], materials.stoneSide, washingtonMonument);
const shaft = new THREE.Mesh(
new THREE.CylinderGeometry(2.2, 4.2, 50, 4, 1, false),
materials.monument
);
shaft.rotation.y = Math.PI / 4;
shaft.position.y = 28;
shaft.castShadow = true;
shaft.receiveShadow = true;
washingtonMonument.add(shaft);
const tip = new THREE.Mesh(
new THREE.ConeGeometry(2.2, 4, 4),
materials.monument
);
tip.rotation.y = Math.PI / 4;
tip.position.y = 55;
tip.castShadow = true;
washingtonMonument.add(tip);
// ------------------------------------------------------------
// Broad crowd-zone overlays
// The hatch deliberately avoids person-scale marks or density cues.
// ------------------------------------------------------------
const zoneGroup = new THREE.Group();
world.add(zoneGroup);
function makeHatchTexture() {
const canvas = document.createElement("canvas");
canvas.width = 64;
canvas.height = 64;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 64, 64);
ctx.strokeStyle = "rgba(169,84,50,0.90)";
ctx.lineWidth = 6;
for (let offset = -64; offset <= 128; offset += 16) {
ctx.beginPath();
ctx.moveTo(offset, 0);
ctx.lineTo(offset - 64, 64);
ctx.stroke();
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
return texture;
}
const baseHatch = makeHatchTexture();
function addCrowdZone(name, x, z, length, width) {
const texture = baseHatch.clone();
texture.needsUpdate = true;
texture.repeat.set(length / 8, width / 8);
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
opacity: 0.62,
depthWrite: false,
side: THREE.DoubleSide
});
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(length, width),
material
);
mesh.rotation.x = -Math.PI / 2;
mesh.position.set(x, 0.105, z);
mesh.renderOrder = 4;
zoneGroup.add(mesh);
const halfL = length / 2;
const halfW = width / 2;
const points = [
new THREE.Vector3(x - halfL, 0.135, z - halfW),
new THREE.Vector3(x + halfL, 0.135, z - halfW),
new THREE.Vector3(x + halfL, 0.135, z + halfW),
new THREE.Vector3(x - halfL, 0.135, z + halfW)
];
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.LineLoop(
geometry,
new THREE.LineDashedMaterial({
color: 0xa95432,
dashSize: 2.2,
gapSize: 1.25,
transparent: true,
opacity: 0.92,
depthWrite: false
})
);
line.computeLineDistances();
line.renderOrder = 5;
zoneGroup.add(line);
mesh.userData.name = name;
}
// Forecourt immediately east of the Lincoln Memorial.
addCrowdZone("Memorial forecourt", -49.5, 0, 11.5, 46);
// Broad areas along the north and south sides of the Reflecting Pool.
addCrowdZone("North pool-side gathering area", -15, 21.4, 58, 14.2);
addCrowdZone("South pool-side gathering area", -15, -21.4, 58, 14.2);
// ------------------------------------------------------------
// Canvas-based labels — no external renderer or add-on
// ------------------------------------------------------------
const labelGroup = new THREE.Group();
scene.add(labelGroup);
function roundedRect(ctx, x, y, width, height, radius) {
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(
x + width,
y + height,
x + width - radius,
y + height
);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
}
function makeLabel(title, subtitle, worldWidth, position) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 160;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRect(ctx, 4, 4, 760, 152, 22);
ctx.fillStyle = "rgba(22,34,39,0.84)";
ctx.fill();
ctx.strokeStyle = "rgba(255,255,255,0.28)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = "#fff8e9";
ctx.font = "700 40px system-ui, sans-serif";
ctx.fillText(title, 384, subtitle ? 60 : 80, 720);
if (subtitle) {
ctx.fillStyle = "rgba(255,248,233,0.76)";
ctx.font = "500 25px system-ui, sans-serif";
ctx.fillText(subtitle, 384, 108, 710);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
const spriteHeight = worldWidth * (160 / 768);
sprite.scale.set(worldWidth, spriteHeight, 1);
sprite.position.set(position[0], position[1], position[2]);
sprite.renderOrder = 30;
labelGroup.add(sprite);
return sprite;
}
makeLabel(
"LINCOLN MEMORIAL",
"landmark and steps",
29,
[-68, 23, 0]
);
makeLabel(
"REFLECTING POOL",
"National Mall axis",
28,
[-15, 2.0, 0]
);
makeLabel(
"WASHINGTON MONUMENT",
"orientation landmark",
32,
[72, 64, 0]
);
makeLabel(
"BROAD CROWD ZONES",
"approximate areas — not density or count",
34,
[-17, 8.5, 30.5]
);
makeLabel(
"MEMORIAL FORECOURT",
"broad interpretive zone",
28,
[-49, 9.0, -29.5]
);
makeLabel(
"EAST · NATIONAL MALL",
"toward the U.S. Capitol",
27,
[43, 3.0, -35]
);
makeLabel("N", "", 7, [8, 3.0, -31]);
// Ground-direction arrows.
const eastArrow = new THREE.Group();
world.add(eastArrow);
const eastShaft = addBox(
[12, 0.16, 0.55],
[31, 0.16, -35],
materials.arrow,
eastArrow
);
eastShaft.castShadow = false;
const eastHead = new THREE.Mesh(
new THREE.ConeGeometry(1.5, 3.4, 3),
materials.arrow
);
eastHead.rotation.z = -Math.PI / 2;
eastHead.position.set(38.5, 0.2, -35);
eastArrow.add(eastHead);
const northShaft = addBox(
[0.55, 0.16, 9],
[8, 0.16, -38.5],
materials.arrow
);
northShaft.castShadow = false;
const northHead = new THREE.Mesh(
new THREE.ConeGeometry(1.35, 3.0, 3),
materials.arrow
);
northHead.rotation.x = Math.PI / 2;
northHead.position.set(8, 0.2, -32.4);
world.add(northHead);
// ------------------------------------------------------------
// Custom orbit camera — implemented directly, no add-on imports
// ------------------------------------------------------------
const controls = {
target: new THREE.Vector3(-5, 4, 0),
theta: 0.72,
phi: 1.06,
radius: 151,
minRadius: 52,
maxRadius: 245,
minPhi: 0.08,
maxPhi: 1.45
};
function applyCamera() {
const sinPhi = Math.sin(controls.phi);
camera.position.set(
controls.target.x +
controls.radius * sinPhi * Math.sin(controls.theta),
controls.target.y + controls.radius * Math.cos(controls.phi),
controls.target.z +
controls.radius * sinPhi * Math.cos(controls.theta)
);
camera.lookAt(controls.target);
}
function clampControls() {
controls.radius = THREE.MathUtils.clamp(
controls.radius,
controls.minRadius,
controls.maxRadius
);
controls.phi = THREE.MathUtils.clamp(
controls.phi,
controls.minPhi,
controls.maxPhi
);
}
function setOverview() {
controls.target.set(-5, 4, 0);
controls.theta = 0.72;
controls.phi = 1.06;
controls.radius = 151;
applyCamera();
}
function setTopView() {
controls.target.set(-4, 0, 0);
controls.theta = Math.PI;
controls.phi = 0.08;
controls.radius = 178;
applyCamera();
}
const pointers = new Map();
let dragX = 0;
let dragY = 0;
let lastPinchDistance = 0;
const canvas = renderer.domElement;
function pointerDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
canvas.addEventListener("pointerdown", event => {
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
dragX = event.clientX;
dragY = event.clientY;
lastPinchDistance = pointerDistance();
});
canvas.addEventListener("pointermove", event => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1) {
const dx = event.clientX - dragX;
const dy = event.clientY - dragY;
controls.theta -= dx * 0.006;
controls.phi += dy * 0.005;
dragX = event.clientX;
dragY = event.clientY;
clampControls();
applyCamera();
} else if (pointers.size === 2) {
const distance = pointerDistance();
if (lastPinchDistance > 0 && distance > 0) {
controls.radius *= lastPinchDistance / distance;
clampControls();
applyCamera();
}
lastPinchDistance = distance;
}
});
function endPointer(event) {
pointers.delete(event.pointerId);
lastPinchDistance = pointerDistance();
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener("lostpointercapture", endPointer);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
controls.radius *= Math.exp(event.deltaY * 0.001);
clampControls();
applyCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", setOverview);
document.addEventListener("keydown", event => {
const tag = event.target.tagName;
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return;
let handled = true;
switch (event.key.toLowerCase()) {
case "arrowleft":
controls.theta -= 0.08;
break;
case "arrowright":
controls.theta += 0.08;
break;
case "arrowup":
controls.phi -= 0.05;
break;
case "arrowdown":
controls.phi += 0.05;
break;
case "+":
case "=":
controls.radius *= 0.9;
break;
case "-":
case "_":
controls.radius *= 1.1;
break;
case "t":
setTopView();
announce("Top view selected.");
break;
case "g":
toggleZones();
break;
case "l":
toggleLabels();
break;
case "r":
setOverview();
announce("Overview reset.");
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
clampControls();
applyCamera();
}
});
// ------------------------------------------------------------
// UI controls
// ------------------------------------------------------------
const infoPanel = document.getElementById("infoPanel");
const infoButton = document.getElementById("infoBtn");
const closeInfo = document.getElementById("closeInfo");
const zonesButton = document.getElementById("zonesBtn");
const labelsButton = document.getElementById("labelsBtn");
let zonesVisible = true;
let labelsVisible = true;
function announce(message) {
announcement.textContent = "";
requestAnimationFrame(() => {
announcement.textContent = message;
});
}
function toggleZones() {
zonesVisible = !zonesVisible;
zoneGroup.visible = zonesVisible;
zonesButton.textContent = zonesVisible ? "Zones: On" : "Zones: Off";
zonesButton.setAttribute("aria-pressed", String(zonesVisible));
announce(
zonesVisible
? "Broad crowd zones shown. These are approximate areas, not density or counts."
: "Broad crowd zones hidden."
);
}
function toggleLabels() {
labelsVisible = !labelsVisible;
labelGroup.visible = labelsVisible;
labelsButton.textContent = labelsVisible ? "Labels: On" : "Labels: Off";
labelsButton.setAttribute("aria-pressed", String(labelsVisible));
announce(labelsVisible ? "Labels shown." : "Labels hidden.");
}
function openInfo() {
infoPanel.classList.add("open");
infoPanel.setAttribute("aria-hidden", "false");
infoButton.setAttribute("aria-expanded", "true");
closeInfo.focus();
}
function hideInfo() {
infoPanel.classList.remove("open");
infoPanel.setAttribute("aria-hidden", "true");
infoButton.setAttribute("aria-expanded", "false");
infoButton.focus();
}
document.getElementById("overviewBtn").addEventListener("click", () => {
setOverview();
announce("Perspective overview selected.");
});
document.getElementById("topBtn").addEventListener("click", () => {
setTopView();
announce("Top view selected.");
});
document.getElementById("resetBtn").addEventListener("click", () => {
setOverview();
announce("Overview reset.");
});
zonesButton.addEventListener("click", toggleZones);
labelsButton.addEventListener("click", toggleLabels);
infoButton.addEventListener("click", openInfo);
closeInfo.addEventListener("click", hideInfo);
document.addEventListener("keydown", event => {
if (event.key === "Escape" && infoPanel.classList.contains("open")) {
hideInfo();
}
});
// ------------------------------------------------------------
// Resize and animation
// ------------------------------------------------------------
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", resize);
applyCamera();
let firstFrame = true;
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
document.getElementById("loading").classList.add("hidden");
setTimeout(() => {
document.getElementById("loading").remove();
}, 350);
}
}
animate();
</script>
</body>
</html>
```