Prompt specification
Build or customize the Three.js 3D scene "Suez inauguration convoy fragment" 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: Suez inauguration convoy fragment
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/suez-inauguration-convoy-fragment-x2478
Scene Description Prompt:
I'd like to see this as a cutaway Three.js scene: Suez inauguration convoy fragment. Create a referenced 1869 canal-opening vignette with a small portion of the ceremonial convoy and shoreline observers. Identify the event without reproducing unverified ship arrangements. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (suez-inauguration-convoy-fragment-x2478):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Suez Canal Inauguration, 1869 — Interpretive Cutaway</title>
<style>
:root {
--ink: #17343b;
--ink-soft: #4b5f61;
--paper: rgba(248, 244, 235, 0.94);
--paper-solid: #f7f2e8;
--gold: #b58a42;
--gold-light: #dfbd78;
--water: #4f9caa;
--earth: #b68758;
--line: rgba(23, 52, 59, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 28%, #eee6d9 0%, #d8cdbd 60%, #c7bba9 100%);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#viewport,
#viewport canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
}
#viewport canvas {
display: block;
outline: none;
touch-action: none;
cursor: grab;
}
#viewport canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 10;
background: var(--paper);
border: 1px solid rgba(23, 52, 59, 0.13);
box-shadow:
0 18px 50px rgba(43, 50, 45, 0.13),
0 2px 8px rgba(43, 50, 45, 0.08);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.title-card {
top: 22px;
left: 22px;
width: min(470px, calc(100vw - 44px));
padding: 20px 22px 18px;
border-top: 4px solid var(--gold);
}
.eyebrow {
margin-bottom: 7px;
color: #8c682d;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(27px, 3vw, 39px);
font-weight: 500;
line-height: 1.03;
letter-spacing: -0.025em;
}
.subtitle {
margin: 9px 0 0;
color: var(--ink-soft);
font-size: 14px;
line-height: 1.45;
}
.caveat {
display: flex;
gap: 9px;
align-items: flex-start;
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid var(--line);
color: #5d5b52;
font-size: 11.5px;
line-height: 1.45;
}
.caveat::before {
content: "◆";
flex: 0 0 auto;
color: var(--gold);
font-size: 9px;
margin-top: 2px;
}
.source-card {
top: 22px;
right: 22px;
width: 340px;
overflow: hidden;
}
.source-card details {
margin: 0;
}
.source-card summary {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px 17px;
cursor: pointer;
list-style: none;
color: #80612e;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.source-card summary::-webkit-details-marker {
display: none;
}
.chevron {
font-size: 16px;
transition: transform 160ms ease;
}
details[open] .chevron {
transform: rotate(180deg);
}
.source-content {
padding: 0 17px 17px;
border-top: 1px solid var(--line);
color: #536064;
font-size: 12px;
line-height: 1.48;
}
.source-content p {
margin: 12px 0;
}
.source-content ol {
margin: 8px 0 0;
padding-left: 18px;
}
.source-content li {
margin: 7px 0;
}
.source-content a {
color: #295e69;
text-decoration-color: rgba(41, 94, 105, 0.35);
text-underline-offset: 2px;
}
.source-content a:hover {
color: #17343b;
}
.source-note {
margin-top: 12px !important;
padding: 10px 11px;
border-left: 3px solid var(--gold);
background: rgba(181, 138, 66, 0.08);
color: #655d4e;
font-size: 11px;
}
#labels {
position: fixed;
inset: 0;
z-index: 5;
pointer-events: none;
overflow: hidden;
}
#labels.hidden {
display: none;
}
.scene-label {
position: absolute;
min-width: 145px;
max-width: 220px;
padding: 8px 11px 9px;
transform: translate(-50%, -100%);
border-left: 3px solid var(--gold);
background: rgba(247, 242, 232, 0.91);
box-shadow: 0 7px 20px rgba(30, 45, 47, 0.12);
color: var(--ink);
opacity: 0;
transition: opacity 120ms linear;
white-space: nowrap;
}
.scene-label::after {
content: "";
position: absolute;
top: 100%;
left: 12px;
width: 1px;
height: 18px;
background: linear-gradient(var(--gold), transparent);
}
.scene-label strong {
display: block;
font-size: 10px;
font-weight: 850;
letter-spacing: 0.12em;
}
.scene-label span {
display: block;
margin-top: 3px;
color: #66706d;
font-size: 10px;
letter-spacing: 0.01em;
}
.legend {
position: fixed;
left: 22px;
bottom: 22px;
z-index: 10;
display: flex;
flex-wrap: wrap;
gap: 9px 15px;
max-width: min(620px, calc(100vw - 44px));
padding: 11px 14px;
border-radius: 2px;
background: rgba(247, 242, 232, 0.88);
border: 1px solid rgba(23, 52, 59, 0.11);
color: #536064;
font-size: 10.5px;
backdrop-filter: blur(8px);
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 7px;
}
.swatch {
width: 12px;
height: 8px;
border-radius: 1px;
border: 1px solid rgba(0, 0, 0, 0.1);
}
.swatch.water {
background: #5ca9b5;
}
.swatch.earth {
background: #b68758;
}
.swatch.boat {
background: #29464e;
}
.swatch.people {
background: #d2a553;
}
.controls {
position: fixed;
right: 22px;
bottom: 22px;
z-index: 10;
display: flex;
align-items: center;
gap: 7px;
padding: 7px;
background: var(--paper);
border: 1px solid rgba(23, 52, 59, 0.12);
box-shadow: 0 8px 24px rgba(36, 49, 47, 0.11);
}
.controls button {
min-width: 36px;
height: 34px;
padding: 0 11px;
border: 1px solid rgba(23, 52, 59, 0.15);
background: transparent;
color: var(--ink);
font: inherit;
font-size: 12px;
cursor: pointer;
transition: background 120ms ease, border-color 120ms ease;
}
.controls button:hover,
.controls button:focus-visible {
background: #eee4d2;
border-color: rgba(23, 52, 59, 0.3);
outline: none;
}
.controls .label-toggle {
min-width: 86px;
}
.hint {
position: fixed;
left: 50%;
bottom: 24px;
z-index: 8;
transform: translateX(-50%);
color: rgba(23, 52, 59, 0.58);
font-size: 10.5px;
letter-spacing: 0.04em;
pointer-events: none;
white-space: nowrap;
}
#loading {
position: fixed;
inset: 0;
z-index: 100;
display: grid;
place-items: center;
background: #ded5c7;
color: var(--ink);
font-family: Georgia, "Times New Roman", serif;
font-size: 18px;
letter-spacing: 0.04em;
transition: opacity 350ms ease;
}
#loading.done {
opacity: 0;
pointer-events: none;
}
@media (max-width: 1050px) {
.source-card {
top: auto;
right: 22px;
bottom: 76px;
width: 310px;
}
.source-card:not([open]) {
width: 205px;
}
.hint {
display: none;
}
}
@media (max-width: 700px) {
.title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 15px 16px 13px;
}
h1 {
font-size: 27px;
}
.subtitle {
font-size: 12px;
}
.caveat {
margin-top: 10px;
padding-top: 9px;
font-size: 10.5px;
}
.source-card {
right: 12px;
bottom: 69px;
width: min(300px, calc(100vw - 24px));
}
.source-card:not([open]) {
width: 178px;
}
.legend {
left: 12px;
bottom: 12px;
max-width: calc(100vw - 24px);
gap: 7px 10px;
padding: 8px 10px;
font-size: 9px;
}
.controls {
right: 12px;
bottom: 62px;
}
.controls .label-toggle {
display: none;
}
.scene-label {
min-width: 120px;
padding: 6px 8px 7px;
}
.scene-label strong {
font-size: 8.5px;
}
.scene-label span {
font-size: 8.5px;
}
}
</style>
</head>
<body>
<div id="viewport"></div>
<div id="labels" aria-hidden="true"></div>
<header class="panel title-card">
<div class="eyebrow">Interpretive historical vignette · 1869</div>
<h1>Suez Canal Inauguration</h1>
<p class="subtitle">
Formal opening of the Suez Canal — 17 November 1869.
A cutaway view of the waterway, anonymous ceremonial craft, and shoreline observers.
</p>
<div class="caveat">
<span>
The craft are generic visual proxies. Their identities, order, spacing, scale,
and the placement of observers are deliberately not presented as a verified
reconstruction of the historical flotilla or shoreline.
</span>
</div>
</header>
<aside class="panel source-card">
<details open>
<summary>
<span>Reference frame</span>
<span class="chevron">⌄</span>
</summary>
<div class="source-content">
<p>
This scene identifies the formal inauguration of the Suez Canal in Egypt
on <strong>17 November 1869</strong>. The references below establish the
event and date; they are not presented as evidence for a specific ship lineup.
</p>
<ol>
<li>
<a href="https://www.britannica.com/topic/Suez-Canal"
target="_blank" rel="noopener noreferrer">
Encyclopaedia Britannica, “Suez Canal”
</a>
— historical overview of the canal and its 1869 opening.
</li>
<li>
<a href="https://www.sca.gov.eg/en/About/Pages/CanalHistory.aspx"
target="_blank" rel="noopener noreferrer">
Suez Canal Authority, “Canal History”
</a>
— official historical chronology of the canal.
</li>
</ol>
<p class="source-note">
Visualization method: an illustrative longitudinal section with deliberately
anonymous vessels and simplified period figures. Geological layers, bank
geometry, vessel proportions, and crowd placement are symbolic and not
drawn to survey scale.
</p>
</div>
</details>
</aside>
<div class="legend" aria-label="Scene legend">
<span class="legend-item"><i class="swatch water"></i>Canal waterway</span>
<span class="legend-item"><i class="swatch earth"></i>Illustrative earth section</span>
<span class="legend-item"><i class="swatch boat"></i>Generic ceremonial craft</span>
<span class="legend-item"><i class="swatch people"></i>Symbolic observers</span>
</div>
<div class="controls" aria-label="Scene controls">
<button id="zoom-out" type="button" aria-label="Zoom out">−</button>
<button id="zoom-in" type="button" aria-label="Zoom in">+</button>
<button id="reset" type="button">Reset view</button>
<button id="toggle-labels" class="label-toggle" type="button" aria-pressed="true">
Labels on
</button>
</div>
<div class="hint">Drag to orbit · Wheel/pinch to zoom · R resets · L toggles labels</div>
<div id="loading">Opening the Suez vignette…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.querySelector("#viewport");
const labelLayer = document.querySelector("#labels");
const loading = document.querySelector("#loading");
// ---------------------------------------------------------------------
// Renderer, scene, camera
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd9d0c2);
scene.fog = new THREE.Fog(0xd9d0c2, 31, 58);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
100
);
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.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive cutaway of the 1869 inauguration of the Suez Canal"
);
viewport.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xfff4df, 0x71604d, 2.0);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe4b3, 3.15);
sun.position.set(-10, 19, 12);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -19;
sun.shadow.camera.right = 19;
sun.shadow.camera.top = 18;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 55;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xcce7ed, 0.7);
fill.position.set(12, 9, -10);
scene.add(fill);
// ---------------------------------------------------------------------
// Deterministic decorative textures
// ---------------------------------------------------------------------
let seed = 1869;
function random() {
seed = (1664525 * seed + 1013904223) >>> 0;
return seed / 4294967296;
}
function makeGrainTexture(baseColor, colors, count = 1800) {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 256;
const ctx = canvas.getContext("2d");
ctx.fillStyle = baseColor;
ctx.fillRect(0, 0, 256, 256);
for (let i = 0; i < count; i++) {
const x = Math.floor(random() * 256);
const y = Math.floor(random() * 256);
const size = random() < 0.92 ? 1 : 2;
ctx.globalAlpha = 0.12 + random() * 0.24;
ctx.fillStyle = colors[Math.floor(random() * colors.length)];
ctx.fillRect(x, y, size, size);
}
ctx.globalAlpha = 1;
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(4, 4);
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
const sandTexture = makeGrainTexture(
"#c8b181",
["#8f795b", "#e1cfaa", "#a68a60", "#d7bd8e"],
2300
);
// ---------------------------------------------------------------------
// Materials
// ---------------------------------------------------------------------
const material = {
plinth: new THREE.MeshStandardMaterial({
color: 0x203b43,
roughness: 0.72,
metalness: 0.05
}),
strata: [
new THREE.MeshStandardMaterial({ color: 0x8e644e, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xa87955, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xbe9362, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xc7a573, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xd0b183, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xd7bb8d, roughness: 1.0 }),
new THREE.MeshStandardMaterial({ color: 0xdfc69a, roughness: 1.0 })
],
cap: new THREE.MeshStandardMaterial({
color: 0xcbb78c,
map: sandTexture,
roughness: 1.0
}),
waterVolume: new THREE.MeshStandardMaterial({
color: 0x438e9b,
transparent: true,
opacity: 0.19,
roughness: 0.34,
metalness: 0.02,
depthWrite: false,
side: THREE.DoubleSide
}),
waterSurface: new THREE.MeshStandardMaterial({
color: 0x64aeba,
transparent: true,
opacity: 0.72,
roughness: 0.24,
metalness: 0.04,
depthWrite: false,
side: THREE.DoubleSide
}),
ripple: new THREE.LineBasicMaterial({
color: 0xd8f3ef,
transparent: true,
opacity: 0.34
}),
hull: new THREE.MeshStandardMaterial({
color: 0x263d43,
roughness: 0.55,
metalness: 0.08
}),
hullAccent: new THREE.MeshStandardMaterial({
color: 0xa97739,
roughness: 0.65,
metalness: 0.05
}),
deck: new THREE.MeshStandardMaterial({
color: 0xc9aa76,
roughness: 0.8
}),
cabin: new THREE.MeshStandardMaterial({
color: 0xe5d6b8,
roughness: 0.8
}),
roof: new THREE.MeshStandardMaterial({
color: 0x69483d,
roughness: 0.75
}),
funnel: new THREE.MeshStandardMaterial({
color: 0x3c4d4e,
roughness: 0.62,
metalness: 0.12
}),
crate: new THREE.MeshStandardMaterial({
color: 0x9c754a,
roughness: 0.95
})
};
// ---------------------------------------------------------------------
// Diorama base and the cutaway earth section
// ---------------------------------------------------------------------
const diorama = new THREE.Group();
scene.add(diorama);
const shadowCatcher = new THREE.Mesh(
new THREE.PlaneGeometry(70, 70),
new THREE.MeshStandardMaterial({
color: 0xc9c0b2,
roughness: 1.0
})
);
shadowCatcher.rotation.x = -Math.PI / 2;
shadowCatcher.position.y = -0.53;
shadowCatcher.receiveShadow = true;
scene.add(shadowCatcher);
const plinth = new THREE.Mesh(
new THREE.BoxGeometry(25.2, 0.48, 14.8),
material.plinth
);
plinth.position.y = -0.24;
plinth.castShadow = true;
plinth.receiveShadow = true;
diorama.add(plinth);
const goldTrim = new THREE.Mesh(
new THREE.BoxGeometry(24.7, 0.09, 14.3),
new THREE.MeshStandardMaterial({
color: 0xc19a50,
roughness: 0.48,
metalness: 0.25
})
);
goldTrim.position.y = 0.02;
goldTrim.castShadow = true;
diorama.add(goldTrim);
function extrudedPolygon(points, mat, depth = 14) {
const shape = new THREE.Shape(
points.map(([x, y]) => new THREE.Vector2(x, y))
);
const geometry = new THREE.ExtrudeGeometry(shape, {
depth,
bevelEnabled: false,
curveSegments: 1,
steps: 1
});
geometry.translate(0, 0, -depth / 2);
const mesh = new THREE.Mesh(geometry, mat);
mesh.castShadow = true;
mesh.receiveShadow = true;
return mesh;
}
const layers = [
{ y0: 0.05, y1: 0.60, inner0: 2.15, inner1: 2.15 },
{ y0: 0.60, y1: 1.18, inner0: 2.15, inner1: 2.35 },
{ y0: 1.18, y1: 1.78, inner0: 2.35, inner1: 2.60 },
{ y0: 1.78, y1: 2.38, inner0: 2.60, inner1: 2.92 },
{ y0: 2.38, y1: 2.98, inner0: 2.92, inner1: 3.26 },
{ y0: 2.98, y1: 3.58, inner0: 3.26, inner1: 3.68 },
{ y0: 3.58, y1: 4.20, inner0: 3.68, inner1: 4.55 }
];
layers.forEach((layer, index) => {
const left = extrudedPolygon(
[
[-12, layer.y0],
[-layer.inner0, layer.y0],
[-layer.inner1, layer.y1],
[-12, layer.y1]
],
material.strata[index]
);
diorama.add(left);
const right = extrudedPolygon(
[
[layer.inner0, layer.y0],
[12, layer.y0],
[12, layer.y1],
[layer.inner1, layer.y1]
],
material.strata[index]
);
diorama.add(right);
});
const leftCap = extrudedPolygon(
[
[-12, 4.20],
[-4.55, 4.20],
[-12, 4.46]
],
material.cap
);
diorama.add(leftCap);
const rightCap = extrudedPolygon(
[
[4.55, 4.20],
[12, 4.20],
[12, 4.46]
],
material.cap
);
diorama.add(rightCap);
// Thin brass line accentuates the exposed cut face.
const profilePoints = [
[-12, 0.05, 7.03],
[-2.15, 0.05, 7.03],
[-2.15, 0.60, 7.03],
[-2.35, 1.18, 7.03],
[-2.60, 1.78, 7.03],
[-2.92, 2.38, 7.03],
[-3.26, 2.98, 7.03],
[-3.68, 3.58, 7.03],
[-4.55, 4.20, 7.03],
[-12, 4.20, 7.03],
[12, 4.20, 7.03],
[4.55, 4.20, 7.03],
[3.68, 3.58, 7.03],
[3.26, 2.98, 7.03],
[2.92, 2.38, 7.03],
[2.60, 1.78, 7.03],
[2.35, 1.18, 7.03],
[2.15, 0.60, 7.03],
[2.15, 0.05, 7.03],
[12, 0.05, 7.03]
];
const profileGeometry = new THREE.BufferGeometry().setFromPoints(
profilePoints.map(([x, y, z]) => new THREE.Vector3(x, y, z))
);
const profileLine = new THREE.Line(
profileGeometry,
new THREE.LineBasicMaterial({
color: 0xe0b96d,
transparent: true,
opacity: 0.78
})
);
diorama.add(profileLine);
// ---------------------------------------------------------------------
// Water volume, surface, and restrained graphic ripples
// ---------------------------------------------------------------------
const waterVolume = new THREE.Mesh(
new THREE.BoxGeometry(5.05, 1.75, 13.88),
material.waterVolume
);
waterVolume.position.set(0, 0.94, 0);
waterVolume.renderOrder = 1;
diorama.add(waterVolume);
const waterSurface = new THREE.Mesh(
new THREE.BoxGeometry(5.05, 0.075, 13.88),
material.waterSurface
);
waterSurface.position.set(0, 1.84, 0);
waterSurface.renderOrder = 2;
waterSurface.receiveShadow = true;
diorama.add(waterSurface);
const waterLineGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(-2.66, 1.895, 7.015),
new THREE.Vector3(2.66, 1.895, 7.015)
]);
const waterLine = new THREE.Line(
waterLineGeometry,
new THREE.LineBasicMaterial({
color: 0xc3eeeb,
transparent: true,
opacity: 0.85
})
);
diorama.add(waterLine);
for (let i = 0; i < 17; i++) {
const z = -6.4 + i * 0.78;
const points = [];
for (let j = 0; j < 15; j++) {
const x = -2.05 + j * 0.29;
const wave = Math.sin(j * 0.82 + i * 1.7) * 0.025;
points.push(new THREE.Vector3(x, 1.887 + wave, z + wave * 0.35));
}
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(points),
material.ripple
);
line.renderOrder = 3;
diorama.add(line);
}
// ---------------------------------------------------------------------
// Anonymous ceremonial craft
// These are intentionally generic and carry no names, flags, or insignia.
// ---------------------------------------------------------------------
const movingCraft = [];
function makeHullGeometry(length, width, height) {
const shape = new THREE.Shape([
new THREE.Vector2(-width * 0.43, -length * 0.47),
new THREE.Vector2(width * 0.43, -length * 0.47),
new THREE.Vector2(width * 0.50, length * 0.13),
new THREE.Vector2(width * 0.27, length * 0.50),
new THREE.Vector2(-width * 0.27, length * 0.50),
new THREE.Vector2(-width * 0.50, length * 0.13)
]);
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: height,
bevelEnabled: true,
bevelSegments: 1,
bevelSize: 0.035,
bevelThickness: 0.035,
steps: 1
});
geometry.rotateX(Math.PI / 2);
return geometry;
}
function addBox(group, size, position, mat) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
mat
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
group.add(mesh);
return mesh;
}
function makeSteamCraft({
x,
z,
rotation,
length,
width,
phase
}) {
const group = new THREE.Group();
group.position.set(x, 2.05, z);
group.rotation.y = rotation;
group.userData.baseY = 2.05;
group.userData.phase = phase;
const hull = new THREE.Mesh(
makeHullGeometry(length, width, 0.43),
material.hull
);
hull.castShadow = true;
hull.receiveShadow = true;
group.add(hull);
addBox(
group,
[width * 0.84, 0.09, length * 0.77],
[0, 0.035, -0.04],
material.deck
);
addBox(
group,
[width * 0.61, 0.11, length * 0.76],
[0, 0.055, -0.04],
material.hullAccent
);
addBox(
group,
[width * 0.58, 0.39, length * 0.27],
[0, 0.27, -length * 0.14],
material.cabin
);
addBox(
group,
[width * 0.66, 0.075, length * 0.31],
[0, 0.49, -length * 0.14],
material.roof
);
const funnel = new THREE.Mesh(
new THREE.CylinderGeometry(0.085, 0.105, 0.43, 10),
material.funnel
);
funnel.position.set(0, 0.65, -length * 0.28);
funnel.castShadow = true;
group.add(funnel);
const funnelBand = new THREE.Mesh(
new THREE.CylinderGeometry(0.089, 0.089, 0.09, 10),
material.hullAccent
);
funnelBand.position.set(0, 0.70, -length * 0.28);
group.add(funnelBand);
diorama.add(group);
movingCraft.push(group);
return group;
}
function makeLowBarge({ x, z, rotation, phase }) {
const group = new THREE.Group();
group.position.set(x, 1.99, z);
group.rotation.y = rotation;
group.userData.baseY = 1.99;
group.userData.phase = phase;
const hull = new THREE.Mesh(
makeHullGeometry(2.65, 0.98, 0.31),
material.hull
);
hull.castShadow = true;
hull.receiveShadow = true;
group.add(hull);
addBox(
group,
[0.78, 0.07, 2.12],
[0, 0.04, -0.02],
material.deck
);
addBox(
group,
[0.42, 0.42, 0.48],
[-0.13, 0.25, -0.35],
material.crate
);
addBox(
group,
[0.38, 0.32, 0.42],
[0.17, 0.21, 0.20],
material.crate
);
addBox(
group,
[0.29, 0.27, 0.34],
[-0.12, 0.19, 0.52],
material.deck
);
diorama.add(group);
movingCraft.push(group);
return group;
}
makeSteamCraft({
x: -0.22,
z: -1.95,
rotation: -0.075,
length: 4.15,
width: 1.18,
phase: 0.3
});
makeSteamCraft({
x: 0.55,
z: 1.72,
rotation: 0.12,
length: 2.75,
width: 0.88,
phase: 1.9
});
makeLowBarge({
x: -0.44,
z: 4.35,
rotation: -0.17,
phase: 3.4
});
// ---------------------------------------------------------------------
// Symbolic shoreline observers
// ---------------------------------------------------------------------
const spectatorColors = [
0x394d57,
0x78634d,
0xb1915d,
0x765f6e,
0x425d60,
0x9b6e49,
0xd0b47c
];
function makeObserver(x, z, index) {
const group = new THREE.Group();
group.position.set(x, 4.46, z);
group.rotation.y = index % 2 ? -1.48 : -1.66;
const scale = 0.88 + (index % 4) * 0.055;
group.scale.setScalar(scale);
const clothing = new THREE.MeshStandardMaterial({
color: spectatorColors[index % spectatorColors.length],
roughness: 0.92
});
const skin = new THREE.MeshStandardMaterial({
color: index % 3 === 0 ? 0x8a5f43 : 0xb88460,
roughness: 0.92
});
const legMaterial = new THREE.MeshStandardMaterial({
color: 0x344347,
roughness: 0.95
});
const leftLeg = new THREE.Mesh(
new THREE.CylinderGeometry(0.045, 0.055, 0.38, 7),
legMaterial
);
leftLeg.position.set(-0.075, 0.19, 0);
leftLeg.castShadow = true;
group.add(leftLeg);
const rightLeg = leftLeg.clone();
rightLeg.position.x = 0.075;
group.add(rightLeg);
const torso = new THREE.Mesh(
new THREE.CylinderGeometry(0.12, 0.18, 0.48, 8),
clothing
);
torso.position.y = 0.61;
torso.castShadow = true;
group.add(torso);
const shoulders = new THREE.Mesh(
new THREE.SphereGeometry(0.13, 10, 7),
clothing
);
shoulders.scale.set(1.25, 0.55, 0.72);
shoulders.position.y = 0.81;
shoulders.castShadow = true;
group.add(shoulders);
const head = new THREE.Mesh(
new THREE.SphereGeometry(0.105, 10, 8),
skin
);
head.position.set(-0.012, 0.98, 0);
head.castShadow = true;
group.add(head);
const nose = new THREE.Mesh(
new THREE.SphereGeometry(0.025, 7, 5),
skin
);
nose.position.set(-0.108, 0.975, 0);
group.add(nose);
if (index % 3 !== 1) {
const hat = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.115, 0.12, 9),
index % 4 === 0 ? material.roof : clothing
);
hat.position.y = 1.10;
hat.castShadow = true;
group.add(hat);
}
const armMaterial = clothing;
const leftArm = new THREE.Mesh(
new THREE.CylinderGeometry(0.035, 0.045, 0.42, 7),
armMaterial
);
leftArm.position.set(-0.15, 0.58, 0);
leftArm.rotation.z = -0.15;
leftArm.castShadow = true;
group.add(leftArm);
const rightArm = leftArm.clone();
rightArm.position.x = 0.15;
rightArm.rotation.z = 0.15;
group.add(rightArm);
diorama.add(group);
}
const observerPositions = [
[5.25, -4.65],
[5.85, -3.95],
[5.32, -3.25],
[6.05, -2.55],
[5.40, -1.70],
[5.95, -0.85],
[5.28, 0.05],
[6.10, 0.90],
[5.42, 1.75],
[6.05, 2.60],
[5.38, 3.45],
[5.95, 4.25]
];
observerPositions.forEach(([x, z], index) => {
makeObserver(x, z, index);
});
// ---------------------------------------------------------------------
// Physical identification plate on the front of the cutaway
// ---------------------------------------------------------------------
function createPlaqueTexture() {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 256;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#19363d";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "#c7a05b";
ctx.lineWidth = 7;
ctx.strokeRect(11, 11, canvas.width - 22, canvas.height - 22);
ctx.strokeStyle = "rgba(222, 190, 127, 0.38)";
ctx.lineWidth = 2;
ctx.strokeRect(23, 23, canvas.width - 46, canvas.height - 46);
ctx.textAlign = "center";
ctx.fillStyle = "#f0dfbd";
ctx.font = "600 49px Georgia";
ctx.fillText("SUEZ CANAL", 512, 91);
ctx.fillStyle = "#d5b46e";
ctx.font = "700 27px Arial";
ctx.fillText("INAUGURATION · 17 NOVEMBER 1869", 512, 145);
ctx.fillStyle = "#a9babc";
ctx.font = "20px Arial";
ctx.fillText("INTERPRETIVE CUTAWAY · NOT TO SCALE", 512, 194);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
const plaque = new THREE.Mesh(
new THREE.PlaneGeometry(6.15, 1.54),
new THREE.MeshStandardMaterial({
map: createPlaqueTexture(),
roughness: 0.72,
metalness: 0.08
})
);
plaque.position.set(7.77, 2.65, 7.055);
plaque.castShadow = true;
diorama.add(plaque);
// A small marker at the cutaway does not imply a surveyed location.
const sectionPin = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.055, 0.36, 8),
new THREE.MeshStandardMaterial({
color: 0xc59d50,
roughness: 0.5,
metalness: 0.3
})
);
sectionPin.rotation.x = Math.PI / 2;
sectionPin.position.set(-4.72, 3.34, 7.08);
sectionPin.castShadow = true;
diorama.add(sectionPin);
// ---------------------------------------------------------------------
// Projected HTML annotations
// ---------------------------------------------------------------------
const labelDefinitions = [
{
title: "EARTHEN CUTAWAY",
subtitle: "Illustrative strata · not surveyed",
position: new THREE.Vector3(-7.3, 4.85, 5.75)
},
{
title: "CONVOY FRAGMENT",
subtitle: "Anonymous craft · no historical order implied",
position: new THREE.Vector3(-1.25, 3.48, -1.25)
},
{
title: "SHORE OBSERVERS",
subtitle: "Period silhouettes · placement symbolic",
position: new THREE.Vector3(7.15, 5.75, 1.7)
},
{
title: "WATERWAY SECTION",
subtitle: "Water depth and banks generalized",
position: new THREE.Vector3(0.0, 1.05, 7.15)
}
];
labelDefinitions.forEach((definition) => {
const element = document.createElement("div");
element.className = "scene-label";
element.innerHTML = `
<strong>${definition.title}</strong>
<span>${definition.subtitle}</span>
`;
labelLayer.appendChild(element);
definition.element = element;
});
function updateLabels() {
const width = renderer.domElement.clientWidth;
const height = renderer.domElement.clientHeight;
labelDefinitions.forEach((definition) => {
const projected = definition.position.clone().project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.15 &&
Math.abs(projected.y) < 1.15;
if (!visible) {
definition.element.style.opacity = "0";
return;
}
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
definition.element.style.left = `${x}px`;
definition.element.style.top = `${y}px`;
definition.element.style.opacity = "0.95";
});
}
// ---------------------------------------------------------------------
// Custom camera controls — no Three.js addons
// ---------------------------------------------------------------------
const controls = {
target: new THREE.Vector3(0, 1.75, 0),
radius: 25.5,
theta: 0.72,
phi: 1.14
};
const homeState = {
radius: 25.5,
theta: 0.72,
phi: 1.14
};
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 resetView() {
controls.radius = homeState.radius;
controls.theta = homeState.theta;
controls.phi = homeState.phi;
applyCamera();
}
function zoomBy(amount) {
controls.radius = THREE.MathUtils.clamp(
controls.radius + amount,
17,
38
);
applyCamera();
}
const pointers = new Map();
let lastPointer = null;
let lastPinchDistance = 0;
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
);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1) {
lastPointer = { x: event.clientX, y: event.clientY };
} else if (pointers.size === 2) {
lastPinchDistance = pointerDistance();
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1 && lastPointer) {
const dx = event.clientX - lastPointer.x;
const dy = event.clientY - lastPointer.y;
controls.theta -= dx * 0.006;
controls.phi = THREE.MathUtils.clamp(
controls.phi - dy * 0.005,
0.48,
1.39
);
lastPointer = { x: event.clientX, y: event.clientY };
applyCamera();
} else if (pointers.size === 2) {
const distance = pointerDistance();
if (distance > 0 && lastPinchDistance > 0) {
controls.radius = THREE.MathUtils.clamp(
controls.radius * (lastPinchDistance / distance),
17,
38
);
applyCamera();
}
lastPinchDistance = distance;
}
});
function endPointer(event) {
pointers.delete(event.pointerId);
if (pointers.size === 1) {
const remaining = [...pointers.values()][0];
lastPointer = { x: remaining.x, y: remaining.y };
} else {
lastPointer = null;
}
lastPinchDistance = pointers.size === 2 ? pointerDistance() : 0;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
zoomBy(event.deltaY * 0.012);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetView);
document.querySelector("#reset").addEventListener("click", resetView);
document.querySelector("#zoom-in").addEventListener("click", () => zoomBy(-1.6));
document.querySelector("#zoom-out").addEventListener("click", () => zoomBy(1.6));
const labelToggle = document.querySelector("#toggle-labels");
let labelsVisible = true;
function toggleLabels() {
labelsVisible = !labelsVisible;
labelLayer.classList.toggle("hidden", !labelsVisible);
labelToggle.textContent = labelsVisible ? "Labels on" : "Labels off";
labelToggle.setAttribute("aria-pressed", String(labelsVisible));
}
labelToggle.addEventListener("click", toggleLabels);
window.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
if (key === "r") {
resetView();
} else if (key === "l") {
toggleLabels();
} else if (key === "arrowleft") {
controls.theta += 0.08;
applyCamera();
event.preventDefault();
} else if (key === "arrowright") {
controls.theta -= 0.08;
applyCamera();
event.preventDefault();
} else if (key === "arrowup") {
controls.phi = Math.max(0.48, controls.phi - 0.06);
applyCamera();
event.preventDefault();
} else if (key === "arrowdown") {
controls.phi = Math.min(1.39, controls.phi + 0.06);
applyCamera();
event.preventDefault();
} else if (key === "+" || key === "=") {
zoomBy(-1.3);
} else if (key === "-" || key === "_") {
zoomBy(1.3);
}
});
// ---------------------------------------------------------------------
// Resize and animation
// ---------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
movingCraft.forEach((craft) => {
craft.position.y =
craft.userData.baseY +
Math.sin(elapsed * 0.75 + craft.userData.phase) * 0.018;
craft.rotation.z =
Math.sin(elapsed * 0.48 + craft.userData.phase) * 0.004;
});
updateLabels();
renderer.render(scene, camera);
}
applyCamera();
renderer.setAnimationLoop(animate);
requestAnimationFrame(() => {
requestAnimationFrame(() => {
loading.classList.add("done");
setTimeout(() => loading.remove(), 400);
});
});
</script>
</body>
</html>
```