Prompt specification
Build or customize the Three.js 3D scene "Historical Earth-observation exhibit across scales" 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: Historical Earth-observation exhibit across scales
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/historical-earth-observation-exhibit-across-scales-x2491
Scene Description Prompt:
Make a voxel Earth-observation exhibit connecting satellite, sensor footprint, raw raster image, and interpreted land use. Three.js from cdnjs, standalone HTML.
Working Three.js Starter (historical-earth-observation-exhibit-across-scales-x2491):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Terra Observatory — Earth Observation Pipeline</title>
<style>
:root {
color-scheme: dark;
--bg: #050a12;
--panel: rgba(8, 17, 29, 0.78);
--panel-border: rgba(134, 219, 255, 0.14);
--text: #eaf8ff;
--muted: #8ba6b9;
--cyan: #70e7ff;
--green: #62f2bd;
--orange: #ffb454;
--purple: #b89cff;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 66% 42%, #10283a 0%, transparent 34%),
radial-gradient(circle at 28% 18%, #102032 0%, transparent 30%),
var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
color: inherit;
font: inherit;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
#scene canvas:active {
cursor: grabbing;
}
.ui {
position: fixed;
inset: 0;
pointer-events: none;
}
.glass {
background: var(--panel);
border: 1px solid var(--panel-border);
box-shadow:
0 24px 70px rgba(0, 0, 0, 0.34),
inset 0 1px rgba(255, 255, 255, 0.025);
backdrop-filter: blur(18px) saturate(125%);
}
header {
position: absolute;
top: 22px;
left: 24px;
right: 24px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
}
.brand-mark {
position: relative;
width: 38px;
height: 38px;
border: 1px solid rgba(112, 231, 255, 0.45);
border-radius: 50%;
box-shadow: 0 0 24px rgba(112, 231, 255, 0.12);
}
.brand-mark::before,
.brand-mark::after {
content: "";
position: absolute;
inset: 7px;
border: 1px solid rgba(112, 231, 255, 0.6);
border-radius: 50%;
}
.brand-mark::after {
inset: 16px -5px;
border-radius: 50%;
transform: rotate(-28deg);
}
.brand-name {
font-size: 12px;
font-weight: 800;
letter-spacing: 0.22em;
}
.brand-subtitle {
margin-top: 3px;
color: var(--muted);
font-size: 10px;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.header-tools {
display: flex;
align-items: center;
gap: 9px;
pointer-events: auto;
}
.live-pill,
.reset-button {
height: 34px;
display: flex;
align-items: center;
gap: 9px;
padding: 0 13px;
border-radius: 999px;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.live-pill {
color: var(--green);
border: 1px solid rgba(98, 242, 189, 0.18);
background: rgba(9, 33, 32, 0.62);
}
.live-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 12px var(--green);
animation: pulse 1.7s ease-in-out infinite;
}
.reset-button {
cursor: pointer;
color: #a8bfce;
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(8, 17, 29, 0.6);
}
.reset-button:hover {
color: white;
border-color: rgba(112, 231, 255, 0.3);
}
.sidebar {
position: absolute;
top: 88px;
left: 24px;
bottom: 24px;
width: 326px;
padding: 23px;
border-radius: 19px;
overflow: auto;
pointer-events: auto;
scrollbar-width: thin;
scrollbar-color: #234456 transparent;
}
.eyebrow {
color: var(--cyan);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 10px 0 8px;
font-size: 30px;
line-height: 1.05;
letter-spacing: -0.045em;
font-weight: 650;
}
.intro {
margin: 0 0 22px;
color: var(--muted);
font-size: 12px;
line-height: 1.65;
}
.pipeline {
display: grid;
gap: 8px;
}
.pipeline-step {
position: relative;
display: grid;
grid-template-columns: 34px 1fr auto;
align-items: center;
gap: 10px;
width: 100%;
min-height: 58px;
padding: 9px 11px;
border: 1px solid rgba(255, 255, 255, 0.055);
border-radius: 11px;
color: #9eb4c3;
background: rgba(255, 255, 255, 0.018);
text-align: left;
cursor: pointer;
transition:
border-color 180ms ease,
background 180ms ease,
color 180ms ease,
transform 180ms ease;
}
.pipeline-step:hover {
color: white;
background: rgba(112, 231, 255, 0.035);
transform: translateX(2px);
}
.pipeline-step.active {
color: white;
border-color: rgba(112, 231, 255, 0.3);
background: linear-gradient(
90deg,
rgba(112, 231, 255, 0.105),
rgba(112, 231, 255, 0.025)
);
}
.step-index {
display: grid;
place-items: center;
width: 29px;
height: 29px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.08);
color: #7994a5;
font-size: 10px;
font-weight: 800;
background: rgba(0, 0, 0, 0.16);
}
.pipeline-step.active .step-index {
color: #061019;
border-color: transparent;
background: var(--cyan);
box-shadow: 0 0 18px rgba(112, 231, 255, 0.25);
}
.step-title {
font-size: 12px;
font-weight: 720;
}
.step-subtitle {
margin-top: 3px;
color: #678293;
font-size: 9px;
letter-spacing: 0.04em;
}
.pipeline-step.active .step-subtitle {
color: #8db8ca;
}
.step-arrow {
color: #4f697a;
font-size: 16px;
}
.detail {
margin-top: 17px;
padding: 16px;
min-height: 140px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.055);
background: rgba(1, 7, 13, 0.32);
}
.detail-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.detail-number {
color: var(--cyan);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
}
.detail-status {
display: flex;
align-items: center;
gap: 5px;
color: var(--green);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.1em;
}
.detail-status::before {
content: "";
width: 5px;
height: 5px;
border-radius: 50%;
background: currentColor;
box-shadow: 0 0 8px currentColor;
}
.detail h2 {
margin: 0 0 7px;
font-size: 15px;
font-weight: 650;
}
.detail p {
margin: 0;
color: #8ba6b9;
font-size: 11px;
line-height: 1.55;
}
.metrics {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 13px;
}
.metric {
padding: 9px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.025);
}
.metric-label {
color: #577081;
font-size: 7px;
font-weight: 800;
letter-spacing: 0.13em;
}
.metric-value {
margin-top: 4px;
color: #c9e4ef;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 10px;
}
.tour-button {
display: flex;
align-items: center;
justify-content: center;
gap: 9px;
width: 100%;
height: 41px;
margin-top: 13px;
border: 1px solid rgba(112, 231, 255, 0.22);
border-radius: 10px;
color: var(--cyan);
background: rgba(112, 231, 255, 0.07);
cursor: pointer;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: background 160ms ease;
}
.tour-button:hover,
.tour-button.playing {
color: #031016;
background: var(--cyan);
}
.play-icon {
width: 0;
height: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 7px solid currentColor;
}
.tour-button.playing .play-icon {
width: 7px;
height: 8px;
border: 0;
border-left: 2px solid currentColor;
border-right: 2px solid currentColor;
}
.node-layer {
position: absolute;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.node-label {
position: absolute;
display: flex;
align-items: center;
gap: 7px;
padding: 6px 9px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 999px;
color: #a5bdca;
background: rgba(5, 12, 20, 0.72);
backdrop-filter: blur(9px);
font-size: 9px;
font-weight: 760;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
pointer-events: auto;
cursor: pointer;
transform: translate(-50%, -50%);
transition:
color 180ms ease,
border-color 180ms ease,
background 180ms ease;
}
.node-label::before {
content: "";
width: 6px;
height: 6px;
border-radius: 50%;
background: #658090;
}
.node-label.active {
color: white;
border-color: rgba(112, 231, 255, 0.45);
background: rgba(9, 27, 39, 0.88);
box-shadow: 0 0 24px rgba(112, 231, 255, 0.09);
}
.node-label.active::before {
background: var(--cyan);
box-shadow: 0 0 10px var(--cyan);
}
.legend {
position: absolute;
right: 24px;
bottom: 24px;
width: 244px;
padding: 17px;
border-radius: 15px;
}
.legend-title {
margin-bottom: 12px;
color: #dceff7;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.legend-items {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px 12px;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
color: #91a9b8;
font-size: 9px;
}
.legend-swatch {
width: 9px;
height: 9px;
border-radius: 2px;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.legend-note {
margin-top: 13px;
padding-top: 11px;
border-top: 1px solid rgba(255, 255, 255, 0.06);
color: #5e7888;
font-size: 8px;
line-height: 1.5;
}
.controls-hint {
position: absolute;
left: 50%;
bottom: 25px;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 15px;
padding: 9px 14px;
border-radius: 999px;
color: #698494;
background: rgba(5, 12, 20, 0.5);
border: 1px solid rgba(255, 255, 255, 0.05);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
}
.controls-hint span {
display: flex;
align-items: center;
gap: 5px;
}
.mouse-icon {
width: 11px;
height: 15px;
border: 1px solid #698494;
border-radius: 6px;
position: relative;
}
.mouse-icon::before {
content: "";
position: absolute;
top: 2px;
left: 4px;
width: 1px;
height: 4px;
background: #698494;
}
@keyframes pulse {
0%, 100% { opacity: 0.45; }
50% { opacity: 1; }
}
@media (max-width: 900px) {
header {
top: 14px;
left: 14px;
right: 14px;
}
.brand-subtitle,
.live-pill span:last-child,
.legend,
.controls-hint {
display: none;
}
.sidebar {
top: auto;
left: 12px;
right: 12px;
bottom: 12px;
width: auto;
max-height: 235px;
padding: 15px;
}
h1 {
font-size: 23px;
}
.intro,
.detail,
.metrics {
display: none;
}
.pipeline {
display: flex;
overflow-x: auto;
margin-top: 13px;
padding-bottom: 3px;
}
.pipeline-step {
min-width: 175px;
}
.tour-button {
position: absolute;
right: 15px;
top: 13px;
width: 94px;
margin: 0;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div class="ui">
<header>
<div class="brand">
<div class="brand-mark"></div>
<div>
<div class="brand-name">TERRA OBSERVATORY</div>
<div class="brand-subtitle">Earth observation data pipeline</div>
</div>
</div>
<div class="header-tools">
<div class="live-pill">
<i class="live-dot"></i>
<span>Synthetic scene active</span>
</div>
<button class="reset-button" id="resetView" type="button">Reset view</button>
</div>
</header>
<aside class="sidebar glass">
<div class="eyebrow">Observation pipeline</div>
<h1>From photons<br>to places.</h1>
<p class="intro">
Follow one Earth-observation signal as it travels from orbit to a classified
map of land use.
</p>
<nav class="pipeline" aria-label="Pipeline stages">
<button class="pipeline-step active" data-step="1" type="button">
<span class="step-index">01</span>
<span>
<span class="step-title">Satellite</span>
<span class="step-subtitle">Acquire the signal</span>
</span>
<span class="step-arrow">›</span>
</button>
<button class="pipeline-step" data-step="2" type="button">
<span class="step-index">02</span>
<span>
<span class="step-title">Sensor footprint</span>
<span class="step-subtitle">Project onto the surface</span>
</span>
<span class="step-arrow">›</span>
</button>
<button class="pipeline-step" data-step="3" type="button">
<span class="step-index">03</span>
<span>
<span class="step-title">Raw raster</span>
<span class="step-subtitle">Uncalibrated pixel values</span>
</span>
<span class="step-arrow">›</span>
</button>
<button class="pipeline-step" data-step="4" type="button">
<span class="step-index">04</span>
<span>
<span class="step-title">Interpreted land use</span>
<span class="step-subtitle">Classify surface features</span>
</span>
<span class="step-arrow">›</span>
</button>
</nav>
<section class="detail" aria-live="polite">
<div class="detail-heading">
<span class="detail-number" id="detailNumber">STAGE 01 / 04</span>
<span class="detail-status">NOMINAL</span>
</div>
<h2 id="detailTitle">Orbital sensor</h2>
<p id="detailDescription">
A multispectral instrument records energy reflected from Earth. Each
measurement preserves the geometry of the observed scene.
</p>
<div class="metrics">
<div class="metric">
<div class="metric-label">MODE</div>
<div class="metric-value" id="metricA">MULTISPECTRAL</div>
</div>
<div class="metric">
<div class="metric-label" id="metricLabelB">ORBIT</div>
<div class="metric-value" id="metricB">LEO · 705 KM</div>
</div>
</div>
</section>
<button class="tour-button" id="tourButton" type="button">
<i class="play-icon"></i>
<span>Play data flow</span>
</button>
</aside>
<div class="node-layer">
<button class="node-label active" data-step="1" type="button">Satellite</button>
<button class="node-label" data-step="2" type="button">Footprint</button>
<button class="node-label" data-step="3" type="button">Raw raster</button>
<button class="node-label" data-step="4" type="button">Land use</button>
</div>
<section class="legend glass">
<div class="legend-title">Land-use classes</div>
<div class="legend-items">
<div class="legend-item">
<i class="legend-swatch" style="background:#2364d7"></i>
Water
</div>
<div class="legend-item">
<i class="legend-swatch" style="background:#16a873"></i>
Forest
</div>
<div class="legend-item">
<i class="legend-swatch" style="background:#d6b83f"></i>
Cropland
</div>
<div class="legend-item">
<i class="legend-swatch" style="background:#ef713d"></i>
Urban
</div>
<div class="legend-item">
<i class="legend-swatch" style="background:#8b78c9"></i>
Bare land
</div>
<div class="legend-item">
<i class="legend-swatch" style="background:linear-gradient(#121e27,#e8f5f7)"></i>
Raw DN
</div>
</div>
<div class="legend-note">
Demo data · 32 × 32 pixels · five thematic classes.
Colors represent classified categories, not literal surface color.
</div>
</section>
<div class="controls-hint">
<span><i class="mouse-icon"></i> Drag to orbit</span>
<span>Scroll to zoom</span>
<span>Select a stage</span>
</div>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneHost = document.getElementById("scene");
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
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.12;
renderer.domElement.setAttribute("aria-label", "Interactive 3D Earth observation exhibit");
sceneHost.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0x050b14, 0.012);
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
120
);
const controls = {
target: new THREE.Vector3(0.55, 0.48, 0),
radius: 17.2,
theta: 0.22,
phi: 1.13,
desiredRadius: 17.2,
desiredTheta: 0.22,
desiredPhi: 1.13
};
scene.add(new THREE.HemisphereLight(0x8edbff, 0x07101b, 1.55));
const keyLight = new THREE.DirectionalLight(0xdaf4ff, 3.1);
keyLight.position.set(7, 11, 9);
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x4a8cff, 1.4);
rimLight.position.set(-8, 4, -6);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffa54f, 7, 8, 2);
warmLight.position.set(-2.7, 2.3, 2.5);
scene.add(warmLight);
const pickables = [];
const flows = [];
const animatedRings = [];
function register(group, step) {
group.userData.step = step;
group.traverse((object) => {
if (object.isMesh || object.isLine) {
object.userData.step = step;
pickables.push(object);
}
});
}
// ------------------------------------------------------------------
// Star field
// ------------------------------------------------------------------
{
const count = 1300;
const positions = new Float32Array(count * 3);
const colors = new Float32Array(count * 3);
const color = new THREE.Color();
for (let i = 0; i < count; i++) {
const radius = 34 + Math.random() * 38;
const theta = Math.random() * Math.PI * 2;
const phi = Math.acos(2 * Math.random() - 1);
positions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);
positions[i * 3 + 1] = radius * Math.cos(phi);
positions[i * 3 + 2] = radius * Math.sin(phi) * Math.sin(theta);
color.setHSL(0.52 + Math.random() * 0.12, 0.35, 0.58 + Math.random() * 0.3);
colors[i * 3] = color.r;
colors[i * 3 + 1] = color.g;
colors[i * 3 + 2] = color.b;
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute("position", new THREE.BufferAttribute(positions, 3));
geometry.setAttribute("color", new THREE.BufferAttribute(colors, 3));
const stars = new THREE.Points(
geometry,
new THREE.PointsMaterial({
size: 0.075,
vertexColors: true,
transparent: true,
opacity: 0.72,
sizeAttenuation: true,
depthWrite: false
})
);
scene.add(stars);
}
// ------------------------------------------------------------------
// Exhibit floor and platform
// ------------------------------------------------------------------
const grid = new THREE.GridHelper(32, 64, 0x226179, 0x12303e);
grid.position.y = -3.08;
grid.material.transparent = true;
grid.material.opacity = 0.16;
scene.add(grid);
const earthCenter = new THREE.Vector3(-3.7, -0.48, 0);
const earthRadius = 2.13;
const platform = new THREE.Mesh(
new THREE.CylinderGeometry(3.05, 3.25, 0.18, 64),
new THREE.MeshStandardMaterial({
color: 0x07131d,
roughness: 0.76,
metalness: 0.45
})
);
platform.position.set(earthCenter.x, -2.82, earthCenter.z);
scene.add(platform);
const platformRing = new THREE.Mesh(
new THREE.TorusGeometry(3.04, 0.018, 8, 120),
new THREE.MeshBasicMaterial({
color: 0x43cbef,
transparent: true,
opacity: 0.42
})
);
platformRing.rotation.x = Math.PI / 2;
platformRing.position.set(earthCenter.x, -2.7, earthCenter.z);
scene.add(platformRing);
const platformRing2 = new THREE.Mesh(
new THREE.TorusGeometry(2.73, 0.009, 8, 120),
new THREE.MeshBasicMaterial({
color: 0x2b7f9b,
transparent: true,
opacity: 0.24
})
);
platformRing2.rotation.x = Math.PI / 2;
platformRing2.position.set(earthCenter.x, -2.71, earthCenter.z);
scene.add(platformRing2);
// ------------------------------------------------------------------
// Voxel Earth
// ------------------------------------------------------------------
const earthGroup = new THREE.Group();
earthGroup.position.copy(earthCenter);
scene.add(earthGroup);
const oceanCore = new THREE.Mesh(
new THREE.SphereGeometry(2.07, 48, 32),
new THREE.MeshStandardMaterial({
color: 0x062333,
roughness: 0.94,
metalness: 0.05,
emissive: 0x03141e,
emissiveIntensity: 0.3
})
);
earthGroup.add(oceanCore);
const voxelCount = 2500;
const voxelGeometry = new THREE.BoxGeometry(0.145, 0.145, 0.145);
const voxelMaterial = new THREE.MeshStandardMaterial({
roughness: 0.72,
metalness: 0.08
});
const voxels = new THREE.InstancedMesh(
voxelGeometry,
voxelMaterial,
voxelCount
);
const dummy = new THREE.Object3D();
const up = new THREE.Vector3(0, 1, 0);
const voxelColor = new THREE.Color();
const goldenAngle = Math.PI * (3 - Math.sqrt(5));
for (let i = 0; i < voxelCount; i++) {
const y = 1 - (2 * (i + 0.5)) / voxelCount;
const radius = Math.sqrt(1 - y * y);
const theta = goldenAngle * i;
const normal = new THREE.Vector3(
Math.cos(theta) * radius,
y,
Math.sin(theta) * radius
);
dummy.position.copy(normal).multiplyScalar(2.105);
dummy.quaternion.setFromUnitVectors(up, normal);
const variation = 0.88 + Math.random() * 0.23;
dummy.scale.setScalar(variation);
dummy.updateMatrix();
voxels.setMatrixAt(i, dummy.matrix);
const continent =
Math.sin(normal.x * 4.1 + Math.sin(normal.z * 2.2) * 1.4) +
Math.sin(normal.z * 3.8 + Math.sin(normal.x * 2.5) * 1.2) +
Math.sin((normal.x + normal.y) * 5.2 + normal.x * 3) * 0.55;
const terrain = Math.sin(normal.x * 9 + normal.z * 5) * 0.5 + 0.5;
if (continent > 0.38) {
if (terrain > 0.58) {
voxelColor.setHSL(0.23, 0.34, 0.31 + terrain * 0.11);
} else {
voxelColor.setHSL(0.1, 0.35, 0.36 + terrain * 0.13);
}
} else {
voxelColor.setHSL(0.56, 0.52, 0.18 + terrain * 0.08);
}
voxels.setColorAt(i, voxelColor);
}
voxels.instanceMatrix.needsUpdate = true;
voxels.instanceColor.needsUpdate = true;
earthGroup.add(voxels);
register(voxels, 2);
const atmosphere = new THREE.Mesh(
new THREE.SphereGeometry(2.3, 48, 32),
new THREE.MeshBasicMaterial({
color: 0x4fc9ff,
transparent: true,
opacity: 0.065,
side: THREE.BackSide,
depthWrite: false
})
);
earthGroup.add(atmosphere);
const atmosphereRim = new THREE.Mesh(
new THREE.SphereGeometry(2.22, 48, 32),
new THREE.MeshBasicMaterial({
color: 0x6edcff,
wireframe: true,
transparent: true,
opacity: 0.025,
depthWrite: false
})
);
earthGroup.add(atmosphereRim);
// ------------------------------------------------------------------
// Satellite
// ------------------------------------------------------------------
const footprintNormal = new THREE.Vector3(0.12, 0.88, 0.46).normalize();
const satellitePosition = earthCenter.clone().addScaledVector(footprintNormal, 4.85);
const satellite = new THREE.Group();
satellite.position.copy(satellitePosition);
const earthDirection = earthCenter.clone().sub(satellitePosition).normalize();
satellite.quaternion.setFromUnitVectors(
new THREE.Vector3(0, -1, 0),
earthDirection
);
const satelliteBodyMaterial = new THREE.MeshStandardMaterial({
color: 0xd7a44e,
roughness: 0.42,
metalness: 0.72,
emissive: 0x6c3d0e,
emissiveIntensity: 0.15
});
const body = new THREE.Mesh(
new THREE.BoxGeometry(0.72, 0.58, 0.58),
satelliteBodyMaterial
);
satellite.add(body);
const bodyFrame = new THREE.Mesh(
new THREE.BoxGeometry(0.76, 0.12, 0.62),
new THREE.MeshStandardMaterial({
color: 0xe9eef0,
roughness: 0.3,
metalness: 0.8
})
);
bodyFrame.position.y = 0.12;
satellite.add(bodyFrame);
const solarMaterial = new THREE.MeshStandardMaterial({
color: 0x123c72,
roughness: 0.32,
metalness: 0.64,
emissive: 0x092853,
emissiveIntensity: 0.22
});
const solarGridMaterial = new THREE.MeshBasicMaterial({
color: 0x67bfff,
transparent: true,
opacity: 0.5
});
for (const side of [-1, 1]) {
const panel = new THREE.Mesh(
new THREE.BoxGeometry(1.18, 0.65, 0.075),
solarMaterial
);
panel.position.x = side * 0.98;
satellite.add(panel);
for (let line = -2; line <= 2; line++) {
const gridLine = new THREE.Mesh(
new THREE.BoxGeometry(0.012, 0.61, 0.008),
solarGridMaterial
);
gridLine.position.set(side * 0.98 + line * 0.21, 0, 0.043);
satellite.add(gridLine);
}
}
const antenna = new THREE.Mesh(
new THREE.CylinderGeometry(0.18, 0.29, 0.14, 24),
new THREE.MeshStandardMaterial({
color: 0xd9e5e9,
roughness: 0.3,
metalness: 0.75,
side: THREE.DoubleSide
})
);
antenna.position.y = -0.43;
satellite.add(antenna);
const sensor = new THREE.Mesh(
new THREE.CylinderGeometry(0.075, 0.075, 0.12, 18),
new THREE.MeshBasicMaterial({ color: 0xffb454 })
);
sensor.position.y = -0.56;
satellite.add(sensor);
const aperture = new THREE.Object3D();
aperture.position.set(0, -0.66, 0);
satellite.add(aperture);
scene.add(satellite);
register(satellite, 1);
// ------------------------------------------------------------------
// Sensor footprint on the spherical surface
// ------------------------------------------------------------------
const tangentA = new THREE.Vector3()
.crossVectors(footprintNormal, new THREE.Vector3(0, 0, 1))
.normalize();
if (tangentA.lengthSq() < 0.1) {
tangentA.crossVectors(footprintNormal, new THREE.Vector3(1, 0, 0)).normalize();
}
const tangentB = new THREE.Vector3()
.crossVectors(footprintNormal, tangentA)
.normalize();
const patchCenter = earthCenter.clone().addScaledVector(footprintNormal, earthRadius);
const ringSegments = 56;
const patchRing = [];
function sphericalPatchPoint(angle) {
const u = Math.cos(angle) * 0.235;
const v = Math.sin(angle) * 0.165;
const direction = footprintNormal
.clone()
.addScaledVector(tangentA, u)
.addScaledVector(tangentB, v)
.normalize();
return earthCenter.clone().addScaledVector(direction, earthRadius + 0.025);
}
for (let i = 0; i < ringSegments; i++) {
patchRing.push(sphericalPatchPoint((i / ringSegments) * Math.PI * 2));
}
const patchGeometry = new THREE.BufferGeometry();
const patchPositions = [patchCenter.x, patchCenter.y, patchCenter.z];
for (const point of patchRing) {
patchPositions.push(point.x, point.y, point.z);
}
const patchIndices = [];
for (let i = 0; i < ringSegments; i++) {
patchIndices.push(0, i + 1, ((i + 1) % ringSegments) + 1);
}
patchGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(patchPositions, 3)
);
patchGeometry.setIndex(patchIndices);
patchGeometry.computeVertexNormals();
const footprintMaterial = new THREE.MeshBasicMaterial({
color: 0xffa44d,
transparent: true,
opacity: 0.22,
side: THREE.DoubleSide,
depthWrite: false
});
const footprintMesh = new THREE.Mesh(patchGeometry, footprintMaterial);
scene.add(footprintMesh);
register(footprintMesh, 2);
const footprintOutline = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(patchRing),
new THREE.LineBasicMaterial({
color: 0xffb454,
transparent: true,
opacity: 0.9
})
);
scene.add(footprintOutline);
register(footprintOutline, 2);
const scanRingGeometry = new THREE.BufferGeometry().setFromPoints(
patchRing.map((point) => point.clone().sub(patchCenter).multiplyScalar(0.72).add(patchCenter))
);
const scanRing = new THREE.Line(
scanRingGeometry,
new THREE.LineBasicMaterial({
color: 0xffdf9e,
transparent: true,
opacity: 0.65
})
);
scene.add(scanRing);
register(scanRing, 2);
animatedRings.push(scanRing);
scene.updateMatrixWorld(true);
const aperturePosition = aperture.getWorldPosition(new THREE.Vector3());
const conePositions = [];
const coneIndices = [];
for (let i = 0; i < ringSegments; i++) {
conePositions.push(
aperturePosition.x,
aperturePosition.y,
aperturePosition.z,
patchRing[i].x,
patchRing[i].y,
patchRing[i].z
);
const next = (i + 1) % ringSegments;
conePositions.push(
aperturePosition.x,
aperturePosition.y,
aperturePosition.z,
patchRing[next].x,
patchRing[next].y,
patchRing[next].z
);
const base = i * 2;
coneIndices.push(base, base + 1, base + 2);
}
const coneGeometry = new THREE.BufferGeometry();
coneGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(conePositions, 3)
);
coneGeometry.setIndex(coneIndices);
const cone = new THREE.Mesh(
coneGeometry,
new THREE.MeshBasicMaterial({
color: 0xffa44d,
transparent: true,
opacity: 0.055,
side: THREE.DoubleSide,
depthWrite: false
})
);
scene.add(cone);
const coneEdgePoints = [aperturePosition];
for (let i = 0; i < ringSegments; i += 7) {
coneEdgePoints.push(patchRing[i]);
}
const coneEdges = new THREE.LineSegments(
new THREE.BufferGeometry().setFromPoints(coneEdgePoints),
new THREE.LineBasicMaterial({
color: 0xffa44d,
transparent: true,
opacity: 0.38
})
);
scene.add(coneEdges);
// ------------------------------------------------------------------
// Procedural raster and classification data
// ------------------------------------------------------------------
const gridSize = 32;
const classes = new Uint8Array(gridSize * gridSize);
const elevation = new Float32Array(gridSize * gridSize);
const classColors = [
[35, 100, 215],
[22, 168, 115],
[214, 184, 63],
[239, 113, 61],
[139, 120, 201]
];
function hash2(x, y) {
const value = Math.sin(x * 127.1 + y * 311.7) * 43758.5453123;
return value - Math.floor(value);
}
function smooth(t) {
return t * t * (3 - 2 * t);
}
function valueNoise(x, y) {
const ix = Math.floor(x);
const iy = Math.floor(y);
const fx = smooth(x - ix);
const fy = smooth(y - iy);
const a = hash2(ix, iy);
const b = hash2(ix + 1, iy);
const c = hash2(ix, iy + 1);
const d = hash2(ix + 1, iy + 1);
const ab = THREE.MathUtils.lerp(a, b, fx);
const cd = THREE.MathUtils.lerp(c, d, fx);
return THREE.MathUtils.lerp(ab, cd, fy);
}
function fbm(x, y) {
let value = 0;
let amplitude = 0.55;
let frequency = 1;
for (let octave = 0; octave < 5; octave++) {
value += valueNoise(x * frequency, y * frequency) * amplitude;
frequency *= 2.03;
amplitude *= 0.5;
}
return value;
}
for (let y = 0; y < gridSize; y++) {
for (let x = 0; x < gridSize; x++) {
const nx = x / gridSize;
const ny = y / gridSize;
const terrain = fbm(nx * 4.4 + 7.1, ny * 4.4 + 2.7);
const detail = fbm(nx * 11 + 3.2, ny * 11 + 9.8);
const riverField = Math.abs(
Math.sin((nx * 1.65 + ny * 2.2 + terrain * 1.7) * Math.PI)
);
const cityA = Math.hypot(nx - 0.68, ny - 0.33);
const cityB = Math.hypot(nx - 0.33, ny - 0.72);
const urban = Math.min(cityA, cityB);
let landClass;
if (terrain < 0.43 || riverField < 0.018) {
landClass = 0;
} else if (terrain < 0.585) {
landClass = 1;
} else if (terrain < 0.72) {
landClass = 2;
} else if (urban < 0.095 + detail * 0.035) {
landClass = 3;
} else {
landClass = 4;
}
const index = y * gridSize + x;
classes[index] = landClass;
elevation[index] = THREE.MathUtils.clamp(
terrain * 0.83 + detail * 0.15 + riverField * 0.05,
0,
1
);
}
}
const rawCanvas = document.createElement("canvas");
rawCanvas.width = rawCanvas.height = 256;
const rawContext = rawCanvas.getContext("2d");
const classCanvas = document.createElement("canvas");
classCanvas.width = classCanvas.height = 256;
const classContext = classCanvas.getContext("2d");
for (let y = 0; y < gridSize; y++) {
for (let x = 0; x < gridSize; x++) {
const index = y * gridSize + x;
const px = x * 8;
const py = y * 8;
const signal = Math.floor(elevation[index] * 225 + hash2(x, y) * 18 + 8);
rawContext.fillStyle = `rgb(${Math.floor(signal * 0.79)}, ${signal}, ${Math.floor(signal * 0.95)})`;
rawContext.fillRect(px, py, 8, 8);
const [r, g, b] = classColors[classes[index]];
classContext.fillStyle = `rgb(${r}, ${g}, ${b})`;
classContext.fillRect(px, py, 8, 8);
}
}
rawContext.strokeStyle = "rgba(135, 230, 255, 0.08)";
rawContext.lineWidth = 1;
for (let i = 0; i <= gridSize; i++) {
const p = i * 8 + 0.5;
rawContext.beginPath();
rawContext.moveTo(p, 0);
rawContext.lineTo(p, 256);
rawContext.stroke();
rawContext.beginPath();
rawContext.moveTo(0, p);
rawContext.lineTo(256, p);
rawContext.stroke();
}
const rawTexture = new THREE.CanvasTexture(rawCanvas);
rawTexture.colorSpace = THREE.SRGBColorSpace;
rawTexture.magFilter = THREE.NearestFilter;
rawTexture.minFilter = THREE.NearestFilter;
const classTexture = new THREE.CanvasTexture(classCanvas);
classTexture.colorSpace = THREE.SRGBColorSpace;
classTexture.magFilter = THREE.NearestFilter;
classTexture.minFilter = THREE.NearestFilter;
// ------------------------------------------------------------------
// Raw raster display
// ------------------------------------------------------------------
const rawGroup = new THREE.Group();
rawGroup.position.set(1.55, 0.1, 0);
rawGroup.rotation.y = -0.12;
scene.add(rawGroup);
const panelBaseMaterial = new THREE.MeshStandardMaterial({
color: 0x08131e,
roughness: 0.72,
metalness: 0.44
});
const rawBase = new THREE.Mesh(
new THREE.BoxGeometry(2.68, 2.68, 0.13),
panelBaseMaterial
);
rawGroup.add(rawBase);
const rawImage = new THREE.Mesh(
new THREE.PlaneGeometry(2.48, 2.48),
new THREE.MeshBasicMaterial({ map: rawTexture })
);
rawImage.position.z = 0.072;
rawGroup.add(rawImage);
const rawFrameMaterial = new THREE.MeshStandardMaterial({
color: 0x2b7289,
emissive: 0x123d4a,
emissiveIntensity: 0.35,
roughness: 0.32,
metalness: 0.72
});
for (const y of [-1.34, 1.34]) {
const bar = new THREE.Mesh(
new THREE.BoxGeometry(2.72, 0.045, 0.09),
rawFrameMaterial
);
bar.position.set(0, y, 0.09);
rawGroup.add(bar);
}
for (const x of [-1.34, 1.34]) {
const bar = new THREE.Mesh(
new THREE.BoxGeometry(0.045, 2.72, 0.09),
rawFrameMaterial
);
bar.position.set(x, 0, 0.09);
rawGroup.add(bar);
}
const rawHalo = new THREE.Mesh(
new THREE.TorusGeometry(1.59, 0.012, 8, 100),
new THREE.MeshBasicMaterial({
color: 0x59d9f5,
transparent: true,
opacity: 0.23
})
);
rawHalo.position.z = -0.16;
rawGroup.add(rawHalo);
const scanBar = new THREE.Mesh(
new THREE.BoxGeometry(2.48, 0.017, 0.012),
new THREE.MeshBasicMaterial({
color: 0xa8f6ff,
transparent: true,
opacity: 0.82
})
);
scanBar.position.z = 0.095;
rawGroup.add(scanBar);
const rawLabelSprite = new THREE.Mesh(
new THREE.PlaneGeometry(1.15, 0.018),
new THREE.MeshBasicMaterial({
color: 0x56d9f3,
transparent: true,
opacity: 0.22
})
);
rawLabelSprite.position.set(0, -1.55, 0);
rawGroup.add(rawLabelSprite);
register(rawGroup, 3);
// ------------------------------------------------------------------
// Interpreted land-use display
// ------------------------------------------------------------------
const landGroup = new THREE.Group();
landGroup.position.set(5.85, 0.1, 0);
landGroup.rotation.y = 0.12;
scene.add(landGroup);
const landBase = new THREE.Mesh(
new THREE.BoxGeometry(2.68, 2.68, 0.13),
panelBaseMaterial
);
landGroup.add(landBase);
const landImage = new THREE.Mesh(
new THREE.PlaneGeometry(2.48, 2.48),
new THREE.MeshBasicMaterial({ map: classTexture })
);
landImage.position.z = 0.072;
landGroup.add(landImage);
const landFrameMaterial = new THREE.MeshStandardMaterial({
color: 0x86633f,
emissive: 0x533516,
emissiveIntensity: 0.3,
roughness: 0.32,
metalness: 0.68
});
for (const y of [-1.34, 1.34]) {
const bar = new THREE.Mesh(
new THREE.BoxGeometry(2.72, 0.045, 0.09),
landFrameMaterial
);
bar.position.set(0, y, 0.09);
landGroup.add(bar);
}
for (const x of [-1.34, 1.34]) {
const bar = new THREE.Mesh(
new THREE.BoxGeometry(0.045, 2.72, 0.09),
landFrameMaterial
);
bar.position.set(x, 0, 0.09);
landGroup.add(bar);
}
const landHalo = new THREE.Mesh(
new THREE.TorusGeometry(1.59, 0.012, 8, 100),
new THREE.MeshBasicMaterial({
color: 0xffb454,
transparent: true,
opacity: 0.23
})
);
landHalo.position.z = -0.16;
landGroup.add(landHalo);
const landBlocks = new THREE.InstancedMesh(
new THREE.BoxGeometry(0.073, 0.073, 1),
new THREE.MeshStandardMaterial({
roughness: 0.72,
metalness: 0.05
}),
gridSize * gridSize
);
let blockIndex = 0;
for (let y = 0; y < gridSize; y++) {
for (let x = 0; x < gridSize; x++) {
const landClass = classes[y * gridSize + x];
const [r, g, b] = classColors[landClass];
const height =
landClass === 0 ? 0.018 :
landClass === 1 ? 0.105 :
landClass === 2 ? 0.052 :
landClass === 3 ? 0.255 :
0.07;
dummy.position.set(
(x + 0.5) / gridSize * 2.48 - 1.24,
1.24 - (y + 0.5) / gridSize * 2.48,
0.08 + height / 2
);
dummy.quaternion.identity();
dummy.scale.set(0.93, 0.93, height);
dummy.updateMatrix();
landBlocks.setMatrixAt(blockIndex, dummy.matrix);
voxelColor.setRGB(r / 255, g / 255, b / 255);
landBlocks.setColorAt(blockIndex, voxelColor);
blockIndex++;
}
}
landBlocks.instanceMatrix.needsUpdate = true;
landBlocks.instanceColor.needsUpdate = true;
landGroup.add(landBlocks);
register(landGroup, 4);
// ------------------------------------------------------------------
// Flow curves and moving data packets
// ------------------------------------------------------------------
scene.updateMatrixWorld(true);
const rawLeft = rawGroup.localToWorld(new THREE.Vector3(-1.34, 0.65, 0.1));
const rawRight = rawGroup.localToWorld(new THREE.Vector3(1.34, 0.1, 0.1));
const landLeft = landGroup.localToWorld(new THREE.Vector3(-1.34, 0.1, 0.1));
function createFlow(curve, color, step, particleCount = 7) {
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(curve.getPoints(120)),
new THREE.LineDashedMaterial({
color,
dashSize: 0.13,
gapSize: 0.09,
transparent: true,
opacity: 0.3,
depthWrite: false
})
);
line.computeLineDistances();
scene.add(line);
const particles = [];
const particleGeometry = new THREE.SphereGeometry(0.048, 10, 8);
const particleMaterial = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95
});
for (let i = 0; i < particleCount; i++) {
const particle = new THREE.Mesh(particleGeometry, particleMaterial);
scene.add(particle);
particles.push(particle);
}
flows.push({ curve, line, particles, step });
}
const sensorCurve = new THREE.QuadraticBezierCurve3(
aperturePosition,
aperturePosition.clone().lerp(patchCenter, 0.52).add(new THREE.Vector3(0, 0.1, 0)),
patchCenter
);
const acquisitionCurve = new THREE.CubicBezierCurve3(
patchCenter.clone().addScaledVector(footprintNormal, 0.12),
patchCenter.clone().add(new THREE.Vector3(0.25, 1.45, 0.85)),
new THREE.Vector3(-0.8, 2.05, 1.35),
rawLeft
);
const classificationCurve = new THREE.CubicBezierCurve3(
rawRight,
new THREE.Vector3(3.25, 0.25, 0.55),
new THREE.Vector3(4.05, 0.25, 0.55),
landLeft
);
createFlow(sensorCurve, 0xffb454, 1, 4);
createFlow(acquisitionCurve, 0x70e7ff, 3, 8);
createFlow(classificationCurve, 0xffb454, 4, 8);
// ------------------------------------------------------------------
// UI state
// ------------------------------------------------------------------
const stageData = [
{
title: "Orbital sensor",
description:
"A multispectral instrument records energy reflected from Earth. Each measurement preserves the geometry of the observed scene.",
metricA: "MULTISPECTRAL",
metricLabelB: "ORBIT",
metricB: "LEO · 705 KM"
},
{
title: "Ground footprint",
description:
"The viewing geometry projects the instrument aperture onto Earth. Every returned sample belongs to this illuminated patch.",
metricA: "10 M / PIXEL",
metricLabelB: "INCIDENCE",
metricB: "38 DEGREES"
},
{
title: "Uncalibrated raster",
description:
"The scene becomes a grid of raw digital numbers. Pixel brightness encodes measured radiance, not yet a named land-use category.",
metricA: "BAND · 08",
metricLabelB: "FORMAT",
metricB: "32 × 32 DN"
},
{
title: "Interpreted land use",
description:
"A trained model transforms spectral and spatial patterns into semantic classes, turning measurements into actionable map information.",
metricA: "RANDOM FOREST",
metricLabelB: "ACCURACY",
metricB: "94.2 PERCENT"
}
];
const pipelineButtons = [...document.querySelectorAll(".pipeline-step")];
const nodeLabels = [...document.querySelectorAll(".node-label")];
const detailNumber = document.getElementById("detailNumber");
const detailTitle = document.getElementById("detailTitle");
const detailDescription = document.getElementById("detailDescription");
const metricA = document.getElementById("metricA");
const metricLabelB = document.getElementById("metricLabelB");
const metricB = document.getElementById("metricB");
const tourButton = document.getElementById("tourButton");
let activeStep = 1;
let tourActive = false;
let tourStart = 0;
function setActiveStep(step) {
activeStep = step;
const data = stageData[step - 1];
detailNumber.textContent = `STAGE ${String(step).padStart(2, "0")} / 04`;
detailTitle.textContent = data.title;
detailDescription.textContent = data.description;
metricA.textContent = data.metricA;
metricLabelB.textContent = data.metricLabelB;
metricB.textContent = data.metricB;
for (const button of pipelineButtons) {
button.classList.toggle("active", Number(button.dataset.step) === step);
}
for (const label of nodeLabels) {
label.classList.toggle("active", Number(label.dataset.step) === step);
}
}
for (const button of [...pipelineButtons, ...nodeLabels]) {
button.addEventListener("click", () => {
tourActive = false;
tourButton.classList.remove("playing");
tourButton.querySelector("span").textContent = "Play data flow";
setActiveStep(Number(button.dataset.step));
});
}
tourButton.addEventListener("click", () => {
tourActive = !tourActive;
if (tourActive) {
tourStart = performance.now();
setActiveStep(1);
tourButton.classList.add("playing");
tourButton.querySelector("span").textContent = "Stop data flow";
} else {
tourButton.classList.remove("playing");
tourButton.querySelector("span").textContent = "Play data flow";
}
});
setActiveStep(1);
// ------------------------------------------------------------------
// Direct camera controls
// ------------------------------------------------------------------
let dragging = false;
let pointerX = 0;
let pointerY = 0;
let pointerStartX = 0;
let pointerStartY = 0;
let pointerTravel = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
pointerStartX = event.clientX;
pointerStartY = event.clientY;
pointerTravel = 0;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerTravel += Math.abs(dx) + Math.abs(dy);
controls.desiredTheta -= dx * 0.0052;
controls.desiredPhi = THREE.MathUtils.clamp(
controls.desiredPhi - dy * 0.0045,
0.58,
1.48
);
pointerX = event.clientX;
pointerY = event.clientY;
});
const raycaster = new THREE.Raycaster();
raycaster.params.Line.threshold = 0.12;
renderer.domElement.addEventListener("pointerup", (event) => {
dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
if (pointerTravel < 6) {
const bounds = renderer.domElement.getBoundingClientRect();
const mouse = new THREE.Vector2(
((event.clientX - bounds.left) / bounds.width) * 2 - 1,
-((event.clientY - bounds.top) / bounds.height) * 2 + 1
);
raycaster.setFromCamera(mouse, camera);
const intersections = raycaster.intersectObjects(pickables, false);
if (intersections.length) {
const object = intersections[0].object;
const step = object.userData.step;
if (step) {
tourActive = false;
tourButton.classList.remove("playing");
tourButton.querySelector("span").textContent = "Play data flow";
setActiveStep(step);
}
}
}
});
renderer.domElement.addEventListener("pointercancel", () => {
dragging = false;
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.desiredRadius = THREE.MathUtils.clamp(
controls.desiredRadius * Math.exp(event.deltaY * 0.0008),
10.5,
26
);
},
{ passive: false }
);
document.getElementById("resetView").addEventListener("click", () => {
controls.desiredRadius = 17.2;
controls.desiredTheta = 0.22;
controls.desiredPhi = 1.13;
controls.target.set(0.55, 0.48, 0);
});
// ------------------------------------------------------------------
// Projected HTML labels
// ------------------------------------------------------------------
const labelElements = new Map(
nodeLabels.map((element) => [Number(element.dataset.step), element])
);
const labelAnchors = new Map([
[1, satellitePosition.clone().add(new THREE.Vector3(0, 0.85, 0))],
[2, patchCenter.clone().add(new THREE.Vector3(0.25, 0.2, 0.35))],
[3, rawGroup.localToWorld(new THREE.Vector3(0, -1.66, 0))],
[4, landGroup.localToWorld(new THREE.Vector3(0, -1.66, 0))]
]);
const labelOffsets = new Map([
[1, [0, -32]],
[2, [38, 13]],
[3, [0, 24]],
[4, [0, 24]]
]);
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const [step, element] of labelElements) {
const projected = labelAnchors.get(step).clone().project(camera);
const offset = labelOffsets.get(step);
const x = (projected.x * 0.5 + 0.5) * width + offset[0];
const y = (-projected.y * 0.5 + 0.5) * height + offset[1];
element.style.left = `${x}px`;
element.style.top = `${y}px`;
element.style.opacity = projected.z > 1 ? "0" : "1";
}
}
// ------------------------------------------------------------------
// 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() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
// Smooth camera orbit.
controls.theta = THREE.MathUtils.lerp(
controls.theta,
controls.desiredTheta,
0.08
);
controls.phi = THREE.MathUtils.lerp(
controls.phi,
controls.desiredPhi,
0.08
);
controls.radius = THREE.MathUtils.lerp(
controls.radius,
controls.desiredRadius,
0.08
);
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);
// Animated packets and connection emphasis.
for (const flow of flows) {
const emphasized = flow.step === activeStep;
flow.line.material.opacity = THREE.MathUtils.lerp(
flow.line.material.opacity,
emphasized ? 0.92 : 0.22,
0.07
);
flow.particles.forEach((particle, index) => {
const t = (elapsed * 0.115 + index / flow.particles.length) % 1;
particle.position.copy(flow.curve.getPointAt(t));
const pulse = 1 + Math.sin(elapsed * 6 + index) * 0.18;
particle.scale.setScalar(pulse);
particle.material.opacity = emphasized ? 1 : 0.36;
});
}
// Raw raster scan bar.
const scanPosition = 1.23 - ((elapsed * 0.22) % 1) * 2.46;
scanBar.position.y = scanPosition;
scanBar.material.opacity = activeStep === 3 ? 0.92 : 0.3;
// Footprint pulse.
const ringScale = 0.82 + Math.sin(elapsed * 2.6) * 0.16;
scanRing.scale.setScalar(ringScale);
scanRing.material.opacity =
activeStep === 2 ? 0.95 : 0.38 + Math.sin(elapsed * 2.6) * 0.12;
// Selected object emphasis.
satelliteBodyMaterial.emissiveIntensity = THREE.MathUtils.lerp(
satelliteBodyMaterial.emissiveIntensity,
activeStep === 1 ? 0.48 : 0.15,
0.08
);
footprintMaterial.opacity = THREE.MathUtils.lerp(
footprintMaterial.opacity,
activeStep === 2 ? 0.38 : 0.18,
0.08
);
rawFrameMaterial.emissiveIntensity = THREE.MathUtils.lerp(
rawFrameMaterial.emissiveIntensity,
activeStep === 3 ? 1.25 : 0.35,
0.08
);
landFrameMaterial.emissiveIntensity = THREE.MathUtils.lerp(
landFrameMaterial.emissiveIntensity,
activeStep === 4 ? 1.15 : 0.3,
0.08
);
// Guided exhibit tour.
if (tourActive) {
const tourStep = Math.floor((performance.now() - tourStart) / 2200) + 1;
if (tourStep > 4) {
tourActive = false;
tourButton.classList.remove("playing");
tourButton.querySelector("span").textContent = "Play data flow";
} else if (tourStep !== activeStep) {
setActiveStep(tourStep);
}
}
updateLabels();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```