Prompt specification
Build or customize the Three.js 3D scene "Space Communication Delay Exhibit" 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: Space Communication Delay Exhibit
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/space-communication-delay-exhibit-x3787
Scene Description Prompt:
Space communication delay exhibit. Build a museum display connecting a ground station and fictional spacecraft at adjustable separation. Show one-way and round-trip delay with source-checked units and explicit scale compression. Please build this with Three.js from cdnjs in one self-contained HTML file, using visible voxel blocks.
Working Three.js Starter (space-communication-delay-exhibit-x3787):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Deep Space Latency Lab</title>
<style>
:root {
--bg: #06101a;
--panel: #0b1722;
--panel-2: #101f2c;
--line: rgba(163, 198, 211, 0.17);
--text: #edf7f7;
--muted: #8fa9b4;
--cyan: #63ead8;
--cyan-dark: #123f47;
--amber: #ffc36b;
--red: #ff8c7b;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
width: 100%;
min-height: 100%;
background: var(--bg);
color: var(--text);
font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
}
body {
overflow: hidden;
}
button,
input {
font: inherit;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
outline: 2px solid var(--cyan);
outline-offset: 3px;
}
.topbar {
height: 72px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
padding: 0 24px;
border-bottom: 1px solid var(--line);
background: #08131e;
position: relative;
z-index: 10;
}
.identity {
display: flex;
align-items: center;
gap: 16px;
min-width: 0;
}
.exhibit-number {
width: 52px;
height: 52px;
display: grid;
place-items: center;
border: 1px solid rgba(99, 234, 216, 0.5);
color: var(--cyan);
font: 700 14px/1 var(--mono);
background: rgba(99, 234, 216, 0.05);
flex: 0 0 auto;
}
.eyebrow {
margin: 0 0 5px;
color: var(--cyan);
font: 700 10px/1 var(--mono);
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(19px, 2vw, 27px);
line-height: 1;
letter-spacing: -0.025em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-meta {
display: flex;
align-items: center;
gap: 10px;
color: var(--muted);
font: 700 10px/1 var(--mono);
letter-spacing: 0.13em;
text-transform: uppercase;
white-space: nowrap;
}
.header-meta span {
padding: 9px 11px;
border: 1px solid var(--line);
border-radius: 3px;
}
.header-meta .live {
color: var(--cyan);
border-color: rgba(99, 234, 216, 0.32);
}
main {
height: calc(100vh - 72px);
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
}
.stage {
position: relative;
overflow: hidden;
min-width: 0;
background:
radial-gradient(circle at 50% 38%, rgba(25, 67, 82, 0.33), transparent 46%),
linear-gradient(180deg, #07131e 0%, #050d16 100%);
}
.stage::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.4);
}
#scene {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
cursor: grab;
touch-action: none;
}
#scene.dragging {
cursor: grabbing;
}
.stage-top {
position: absolute;
z-index: 4;
top: 18px;
left: 18px;
right: 18px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
pointer-events: none;
}
.status {
display: flex;
align-items: center;
gap: 9px;
max-width: calc(100% - 160px);
padding: 10px 12px;
border: 1px solid var(--line);
background: rgba(7, 18, 28, 0.78);
backdrop-filter: blur(8px);
color: #cce0e3;
font: 700 10px/1.2 var(--mono);
letter-spacing: 0.09em;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--cyan);
box-shadow: 0 0 12px rgba(99, 234, 216, 0.8);
flex: 0 0 auto;
}
.status[data-state="outbound"] .status-dot {
background: var(--cyan);
}
.status[data-state="returning"] .status-dot {
background: var(--amber);
box-shadow: 0 0 12px rgba(255, 195, 107, 0.8);
}
.status[data-state="complete"] .status-dot {
background: #a7ff9a;
box-shadow: 0 0 12px rgba(167, 255, 154, 0.8);
}
.view-hint {
padding: 9px 11px;
border: 1px solid var(--line);
background: rgba(7, 18, 28, 0.68);
color: var(--muted);
font: 600 9px/1.3 var(--mono);
letter-spacing: 0.06em;
text-align: right;
}
.world-label {
position: absolute;
z-index: 3;
pointer-events: none;
min-width: 130px;
padding: 9px 11px;
border-left: 2px solid var(--cyan);
background: rgba(5, 15, 24, 0.82);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
transform: translate(-50%, -100%);
backdrop-filter: blur(6px);
}
.world-label .label-kicker {
display: block;
margin-bottom: 4px;
color: var(--cyan);
font: 700 9px/1 var(--mono);
letter-spacing: 0.12em;
}
.world-label strong {
display: block;
font-size: 12px;
line-height: 1.2;
letter-spacing: 0.05em;
}
.world-label small {
display: block;
margin-top: 4px;
color: var(--muted);
font: 500 9px/1.3 var(--mono);
}
#shipLabel {
border-left-color: var(--amber);
}
#shipLabel .label-kicker {
color: var(--amber);
}
.stage-bottom {
position: absolute;
z-index: 4;
left: 18px;
right: 18px;
bottom: 16px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 18px;
pointer-events: none;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 8px 14px;
max-width: 440px;
padding: 10px 12px;
border: 1px solid var(--line);
background: rgba(7, 18, 28, 0.76);
backdrop-filter: blur(8px);
color: var(--muted);
font: 600 9px/1.3 var(--mono);
letter-spacing: 0.05em;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 6px;
}
.swatch {
width: 8px;
height: 8px;
display: inline-block;
background: var(--cyan);
}
.swatch.amber {
background: var(--amber);
}
.compression-banner {
max-width: 480px;
padding: 11px 13px;
border: 1px solid rgba(255, 195, 107, 0.3);
border-left: 3px solid var(--amber);
background: rgba(24, 23, 19, 0.84);
backdrop-filter: blur(8px);
color: #d9c7a9;
font: 600 9px/1.5 var(--mono);
letter-spacing: 0.035em;
}
.compression-banner strong {
color: var(--amber);
}
.panel {
overflow-y: auto;
border-left: 1px solid var(--line);
background:
linear-gradient(180deg, rgba(18, 38, 51, 0.55), transparent 180px),
var(--panel);
scrollbar-width: thin;
scrollbar-color: #274253 transparent;
}
.panel-section {
padding: 21px 22px;
border-bottom: 1px solid var(--line);
}
.section-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 15px;
}
.section-heading h2 {
margin: 0;
font: 700 11px/1.2 var(--mono);
letter-spacing: 0.13em;
text-transform: uppercase;
}
.section-number {
color: var(--cyan);
font: 700 10px/1 var(--mono);
}
.distance-display {
margin-bottom: 18px;
}
.distance-display output {
display: block;
color: var(--text);
font-size: clamp(27px, 3vw, 38px);
font-weight: 700;
line-height: 1;
letter-spacing: -0.045em;
}
.distance-display small {
display: block;
margin-top: 8px;
color: var(--muted);
font: 500 10px/1.5 var(--mono);
}
.range-labels {
display: flex;
justify-content: space-between;
margin-top: 7px;
color: #708995;
font: 600 9px/1 var(--mono);
}
input[type="range"] {
width: 100%;
height: 22px;
margin: 0;
accent-color: var(--cyan);
cursor: ew-resize;
}
.presets {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 7px;
margin-top: 16px;
}
.preset {
min-height: 36px;
border: 1px solid var(--line);
background: var(--panel-2);
color: #a9c0c9;
cursor: pointer;
font: 600 9px/1 var(--mono);
transition: 120ms ease;
}
.preset:hover {
border-color: rgba(99, 234, 216, 0.55);
color: var(--cyan);
}
.preset[aria-pressed="true"] {
border-color: var(--cyan);
color: #06131a;
background: var(--cyan);
}
.delay-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 9px;
}
.delay-card {
min-height: 132px;
padding: 14px;
border: 1px solid var(--line);
background: linear-gradient(145deg, #122735, #0c1b27);
}
.delay-card.roundtrip {
border-color: rgba(255, 195, 107, 0.25);
background: linear-gradient(145deg, #28251e, #171b20);
}
.delay-label {
display: block;
color: var(--muted);
font: 700 9px/1.2 var(--mono);
letter-spacing: 0.1em;
text-transform: uppercase;
}
.delay-value {
display: block;
margin: 13px 0 8px;
color: var(--cyan);
font: 700 clamp(20px, 2.3vw, 29px)/1 var(--mono);
letter-spacing: -0.055em;
white-space: nowrap;
}
.roundtrip .delay-value {
color: var(--amber);
}
.delay-raw {
display: block;
color: #7f98a2;
font: 500 9px/1.5 var(--mono);
}
.equation {
margin-top: 12px;
padding: 11px 12px;
border: 1px solid var(--line);
background: #07131d;
color: #b9cdd2;
font: 500 10px/1.7 var(--mono);
overflow-wrap: anywhere;
}
.equation strong {
color: var(--text);
}
.send-button {
width: 100%;
margin-top: 13px;
min-height: 46px;
border: 0;
background: var(--cyan);
color: #06131a;
cursor: pointer;
font: 800 11px/1 var(--mono);
letter-spacing: 0.09em;
text-transform: uppercase;
transition: 120ms ease;
}
.send-button:hover {
background: #a0fff0;
}
.send-button:disabled {
cursor: wait;
opacity: 0.55;
}
.button-note {
margin: 9px 0 0;
color: var(--muted);
font: 500 9px/1.5 var(--mono);
text-align: center;
}
.disclosure {
padding: 13px;
border: 1px solid rgba(255, 195, 107, 0.35);
border-left: 3px solid var(--amber);
background: rgba(255, 195, 107, 0.055);
color: #d8c8aa;
font-size: 11px;
line-height: 1.55;
}
.disclosure strong {
color: var(--amber);
}
.disclosure p {
margin: 0 0 10px;
}
.disclosure p:last-child {
margin-bottom: 0;
}
.mapping {
margin-top: 10px;
padding: 9px 10px;
border: 1px solid rgba(255, 195, 107, 0.18);
background: rgba(0, 0, 0, 0.18);
color: #aa9270;
font: 500 9px/1.55 var(--mono);
overflow-wrap: anywhere;
}
.fine-print {
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
.fine-print strong {
color: #d0e0e3;
}
.fine-print ul {
margin: 10px 0 0;
padding-left: 18px;
}
.fine-print li {
margin: 6px 0;
}
details summary {
color: #d7e7e8;
cursor: pointer;
font: 700 10px/1.4 var(--mono);
letter-spacing: 0.08em;
text-transform: uppercase;
}
details p,
details li {
color: var(--muted);
font-size: 10px;
line-height: 1.6;
}
details a {
color: var(--cyan);
text-decoration: none;
border-bottom: 1px solid rgba(99, 234, 216, 0.3);
}
.source-list {
margin: 13px 0 0;
padding-left: 17px;
}
.source-list li {
margin: 8px 0;
}
.constant {
margin-top: 12px;
padding: 10px;
border: 1px solid var(--line);
background: #07131d;
color: #b8d1d6;
font: 500 10px/1.65 var(--mono);
}
.panel-footer {
padding: 16px 22px 25px;
color: #647f8b;
font: 500 9px/1.6 var(--mono);
}
@media (max-width: 900px) {
body {
overflow: auto;
}
.topbar {
height: 64px;
padding: 0 15px;
}
.exhibit-number {
width: 43px;
height: 43px;
}
.header-meta span:first-child {
display: none;
}
main {
height: auto;
grid-template-columns: 1fr;
}
.stage {
height: 58vh;
min-height: 430px;
}
.panel {
overflow: visible;
border-left: 0;
border-top: 1px solid var(--line);
}
.stage-bottom {
align-items: stretch;
flex-direction: column-reverse;
}
.compression-banner {
max-width: none;
}
.legend {
max-width: none;
}
}
@media (max-width: 560px) {
.header-meta {
display: none;
}
.identity {
gap: 10px;
}
.stage {
min-height: 470px;
}
.stage-top {
top: 12px;
left: 12px;
right: 12px;
}
.view-hint {
display: none;
}
.status {
max-width: 100%;
}
.stage-bottom {
left: 12px;
right: 12px;
bottom: 12px;
}
.delay-grid {
grid-template-columns: 1fr;
}
.delay-card {
min-height: 112px;
}
.panel-section {
padding: 19px 17px;
}
}
</style>
</head>
<body>
<header class="topbar">
<div class="identity">
<div class="exhibit-number">04</div>
<div>
<p class="eyebrow">Deep Space Communications</p>
<h1>Latency Lab</h1>
</div>
</div>
<div class="header-meta">
<span>Vacuum propagation</span>
<span>SI units</span>
<span class="live">Interactive exhibit</span>
</div>
</header>
<main>
<section class="stage" id="stage" aria-label="Interactive three-dimensional spacecraft communication exhibit">
<canvas
id="scene"
aria-label="Voxel ground station and fictional spacecraft connected by a radio signal path"
></canvas>
<div class="stage-top">
<div class="status" id="status" data-state="ready" aria-live="polite">
<span class="status-dot"></span>
<span id="statusText">SYSTEM READY · SELECT SEPARATION</span>
</div>
<div class="view-hint">
DRAG TO ORBIT<br />
SCROLL TO ZOOM
</div>
</div>
<div class="world-label" id="groundLabel">
<span class="label-kicker">EARTH</span>
<strong>GROUND STATION</strong>
<small>VOXEL ARRAY / SURFACE</small>
</div>
<div class="world-label" id="shipLabel">
<span class="label-kicker">FICTIONAL PROBE</span>
<strong>AURORA–7</strong>
<small id="shipLabelDistance">250 MILLION KM</small>
</div>
<div class="stage-bottom">
<div class="legend" aria-label="Signal color legend">
<span class="legend-item"><i class="swatch"></i> OUTBOUND REQUEST</span>
<span class="legend-item"><i class="swatch amber"></i> RETURN ACKNOWLEDGEMENT</span>
<span class="legend-item">CUBES = VOXEL MODEL</span>
</div>
<div class="compression-banner">
<strong>DISPLAY COMPRESSION:</strong>
3D distance is logarithmic, objects are enlarged, and the moving cubes are
an illustrative cue—not real-time light travel.
</div>
</div>
</section>
<aside class="panel">
<section class="panel-section">
<div class="section-heading">
<h2>Set separation</h2>
<span class="section-number">01</span>
</div>
<div class="distance-display">
<output id="distanceHeadline" for="distance">250 million km</output>
<small id="distanceFull">250,000,000 km · 250,000,000,000 m</small>
</div>
<label for="distance" class="eyebrow">Logarithmic separation control</label>
<input
id="distance"
type="range"
min="0"
max="1000"
step="0.001"
value="879.5879"
aria-describedby="distanceHelp"
/>
<div class="range-labels" aria-hidden="true">
<span>10,000 KM</span>
<span>1 BILLION KM</span>
</div>
<div class="presets" aria-label="Distance presets">
<button class="preset" type="button" data-distance="100000">100,000 km</button>
<button class="preset" type="button" data-distance="1000000">1 million km</button>
<button class="preset" type="button" data-distance="100000000">100 million km</button>
<button class="preset" type="button" data-distance="1000000000">1 billion km</button>
</div>
<p id="distanceHelp" class="fine-print" style="margin: 12px 0 0">
A fictional probe and a stationary planetary ground station. The delay assumes
a straight path through vacuum.
</p>
</section>
<section class="panel-section">
<div class="section-heading">
<h2>Propagation delay</h2>
<span class="section-number">02</span>
</div>
<div class="delay-grid">
<article class="delay-card">
<span class="delay-label">One-way</span>
<strong class="delay-value" id="oneWayValue" aria-live="polite">0.834 s</strong>
<span class="delay-raw" id="oneWayRaw">raw: 0.833950 s</span>
</article>
<article class="delay-card roundtrip">
<span class="delay-label">Round-trip</span>
<strong class="delay-value" id="roundTripValue" aria-live="polite">1.668 s</strong>
<span class="delay-raw" id="roundTripRaw">raw: 1.667901 s</span>
</article>
</div>
<div class="equation" id="equation">
<strong>t<sub>one-way</sub> = D ÷ c</strong><br />
<strong>t<sub>round-trip</sub> = 2D ÷ c</strong><br />
D = 250,000 km; c = 299,792.458 km/s
</div>
<button class="send-button" id="sendButton" type="button">Send signal</button>
<p class="button-note">Illustrative traversal: 2.4 seconds each way</p>
</section>
<section class="panel-section">
<div class="section-heading">
<h2>Scale disclosure</h2>
<span class="section-number">03</span>
</div>
<div class="disclosure">
<p>
<strong>This is not a scale model.</strong> The station and spacecraft are
independently enlarged voxel constructions, not objects drawn at one common scale.
</p>
<p>
The 3D track uses a logarithmic mapping from 10,000 km to 1 billion km.
Each equal screen interval represents a <strong>10× distance ratio</strong>,
rather than an equal number of kilometres.
</p>
<p>
The moving packet always crosses the display in 2.4 seconds per direction.
Its visual speed does <strong>not</strong> represent the actual signal speed.
Only the delay numbers use physical distance.
</p>
</div>
<div class="mapping">
x₃D = 0.25 + 6.5 × log₁₀(D / 10,000 km) / 5<br />
5 equal track intervals · 10,000 km → 1,000,000,000 km
</div>
</section>
<section class="panel-section">
<div class="section-heading">
<h2>Interpretation</h2>
<span class="section-number">04</span>
</div>
<div class="fine-print">
<strong>Round-trip delay is idealized.</strong>
<ul>
<li>Target turnaround time is set to zero seconds.</li>
<li>Ground-station processing and spacecraft processing are excluded.</li>
<li>Path length equals the stated one-way separation.</li>
<li>Propagation uses the vacuum speed of light.</li>
</ul>
</div>
</section>
<section class="panel-section">
<details open>
<summary>Sources & unit check</summary>
<div class="constant">
c = 299,792,458 m/s exactly<br />
= 299,792.458 km/s exactly<br />
1 km = 1,000 m exactly<br />
1 min = 60 s exactly
</div>
<ul class="source-list">
<li>
<a href="https://www.bipm.org/en/publications/si-brochure" target="_blank" rel="noopener">
BIPM, SI Brochure, 9th edition
</a>
— SI base units and the exact value of the speed of light in vacuum.
</li>
<li>
<a href="https://www.nist.gov/pml/owm/si-units" target="_blank" rel="noopener">
NIST, SI Units
</a>
— SI unit conventions.
</li>
<li>
<a href="https://www.nist.gov/pml/owm/si-units-information" target="_blank" rel="noopener">
NIST, SI Units Information
</a>
— exact decimal prefixes and accepted SI usage.
</li>
</ul>
<p>
The delay is calculated directly from metres and metres per second. Values in
the cards are rounded for display; the raw seconds value is shown beneath each card.
</p>
</details>
</section>
<div class="panel-footer">
MUSEUM COMMUNICATION SYSTEMS GALLERY<br />
FICTIONAL SPACECRAFT · VACUUM MODEL · THREE.JS CORE
</div>
</aside>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Constants and exhibit state
// -------------------------------------------------------------------------
const C_METRES_PER_SECOND = 299792458; // Exact SI value.
const C_KM_PER_SECOND = C_METRES_PER_SECOND / 1000;
const MIN_DISTANCE_KM = 10000;
const MAX_DISTANCE_KM = 1000000000;
const stage = document.getElementById("stage");
const canvas = document.getElementById("scene");
const distanceInput = document.getElementById("distance");
const distanceHeadline = document.getElementById("distanceHeadline");
const distanceFull = document.getElementById("distanceFull");
const shipLabelDistance = document.getElementById("shipLabelDistance");
const oneWayValue = document.getElementById("oneWayValue");
const roundTripValue = document.getElementById("roundTripValue");
const oneWayRaw = document.getElementById("oneWayRaw");
const roundTripRaw = document.getElementById("roundTripRaw");
const equation = document.getElementById("equation");
const status = document.getElementById("status");
const statusText = document.getElementById("statusText");
const sendButton = document.getElementById("sendButton");
const numberFormat = new Intl.NumberFormat("en-US", {
maximumFractionDigits: 0
});
let currentDistanceKm = 250000000;
let shipX = 0.25;
let signalPhase = "ready";
let signalProgress = 0;
let autoTimer = null;
const VISUAL_TRAVERSAL_SECONDS = 2.4;
function distanceToSlider(distanceKm) {
return (
(Math.log10(distanceKm / MIN_DISTANCE_KM) /
Math.log10(MAX_DISTANCE_KM / MIN_DISTANCE_KM)) *
1000
);
}
function trimNumber(value, decimals = 3) {
return Number(value.toFixed(decimals)).toLocaleString("en-US", {
maximumFractionDigits: decimals
});
}
function formatDistanceHeadline(distanceKm) {
if (distanceKm >= 1e9) {
return `${trimNumber(distanceKm / 1e9)} billion km`;
}
if (distanceKm >= 1e6) {
return `${trimNumber(distanceKm / 1e6)} million km`;
}
return `${numberFormat.format(distanceKm)} km`;
}
function formatDuration(seconds) {
if (seconds < 0.001) {
return `${(seconds * 1e6).toFixed(2)} µs`;
}
if (seconds < 1) {
return `${(seconds * 1000).toFixed(3)} ms`;
}
if (seconds < 60) {
return `${seconds.toFixed(3)} s`;
}
if (seconds < 3600) {
const minutes = Math.floor(seconds / 60);
const remainder = seconds - minutes * 60;
return `${minutes} min ${remainder.toFixed(1)} s`;
}
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainder = seconds % 60;
return `${hours} h ${minutes} min ${remainder.toFixed(1)} s`;
}
// -------------------------------------------------------------------------
// Three.js scene
// -------------------------------------------------------------------------
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor(0x07131e, 0);
const scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0x07131e, 0.022);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 120);
const cameraState = {
azimuth: 0,
elevation: 0.29,
radius: 17,
target: new THREE.Vector3(0.75, 1.45, 0)
};
const ambient = new THREE.HemisphereLight(0xbce8f2, 0x17202a, 2.1);
scene.add(ambient);
const keyLight = new THREE.DirectionalLight(0xffffff, 3.0);
keyLight.position.set(-5, 10, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -12;
keyLight.shadow.camera.right = 12;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.bias = -0.0008;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x4bd7d0, 2.3);
rimLight.position.set(8, 5, -7);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffb55f, 18, 18, 2);
warmLight.position.set(4, 4, 4);
scene.add(warmLight);
const materials = {
floor: new THREE.MeshStandardMaterial({
color: 0x09151f,
roughness: 0.92,
metalness: 0.08
}),
grid: new THREE.MeshBasicMaterial({
color: 0x183444,
transparent: true,
opacity: 0.42
}),
stationDark: new THREE.MeshStandardMaterial({
color: 0x253947,
roughness: 0.7,
metalness: 0.28
}),
stationLight: new THREE.MeshStandardMaterial({
color: 0x91a8ad,
roughness: 0.62,
metalness: 0.18
}),
stationTrim: new THREE.MeshStandardMaterial({
color: 0xe5aa50,
roughness: 0.42,
metalness: 0.5,
emissive: 0x271300,
emissiveIntensity: 0.4
}),
dish: new THREE.MeshStandardMaterial({
color: 0xdbe8e5,
roughness: 0.54,
metalness: 0.2
}),
dishEdge: new THREE.MeshStandardMaterial({
color: 0x5d7d87,
roughness: 0.48,
metalness: 0.42
}),
gold: new THREE.MeshStandardMaterial({
color: 0xd39b35,
roughness: 0.38,
metalness: 0.65
}),
goldDark: new THREE.MeshStandardMaterial({
color: 0x8b5c20,
roughness: 0.48,
metalness: 0.58
}),
solar: new THREE.MeshStandardMaterial({
color: 0x164f8e,
roughness: 0.32,
metalness: 0.55,
emissive: 0x071d48,
emissiveIntensity: 0.45
}),
solarLight: new THREE.MeshStandardMaterial({
color: 0x3b91c5,
roughness: 0.28,
metalness: 0.45,
emissive: 0x082c52,
emissiveIntensity: 0.45
}),
path: new THREE.MeshStandardMaterial({
color: 0x4ce1d2,
roughness: 0.3,
metalness: 0.1,
emissive: 0x0a756d,
emissiveIntensity: 1.35,
transparent: true,
opacity: 0.78
}),
marker: new THREE.MeshStandardMaterial({
color: 0xffbd63,
emissive: 0x5f2e00,
emissiveIntensity: 0.7,
roughness: 0.5
}),
star: new THREE.MeshBasicMaterial({
color: 0xb7e4eb,
transparent: true,
opacity: 0.45
})
};
function addBlock(parent, size, position, material, castShadow = true) {
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 = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Museum floor, assembled from block geometry.
addBlock(scene, [30, 0.3, 18], [0, -0.38, 0], materials.floor, false);
const gridMesh = new THREE.InstancedMesh(
new THREE.BoxGeometry(0.035, 0.025, 0.18),
materials.grid,
231
);
const gridDummy = new THREE.Object3D();
let gridIndex = 0;
for (let x = -10; x <= 10; x += 1) {
for (let z = -5; z <= 5; z += 1) {
gridDummy.position.set(x, -0.215, z);
gridDummy.updateMatrix();
gridMesh.setMatrixAt(gridIndex++, gridDummy.matrix);
}
}
gridMesh.instanceMatrix.needsUpdate = true;
scene.add(gridMesh);
// Decorative voxel stars.
const starGroup = new THREE.Group();
scene.add(starGroup);
for (let i = 0; i < 64; i++) {
const size = 0.025 + Math.random() * 0.035;
const star = addBlock(
starGroup,
[size, size, size],
[
-10 + Math.random() * 20,
3.2 + Math.random() * 6.5,
-5.5 + Math.random() * 11
],
materials.star,
false
);
star.rotation.set(
Math.random() * Math.PI,
Math.random() * Math.PI,
Math.random() * Math.PI
);
}
// A voxel parabolic dish facing local +X.
function createDish(parent, position, radius, cellSize, facingPositiveX = true) {
const group = new THREE.Group();
group.position.set(position[0], position[1], position[2]);
if (!facingPositiveX) {
group.rotation.y = Math.PI;
}
const extent = Math.ceil(radius / cellSize);
for (let iy = -extent; iy <= extent; iy++) {
for (let iz = -extent; iz <= extent; iz++) {
const y = iy * cellSize;
const z = iz * cellSize;
const r = Math.hypot(y, z);
if (r > radius) continue;
const normalized = r / radius;
const x = 0.5 * normalized * normalized;
const isRim = normalized > 0.62;
addBlock(
group,
[cellSize * 0.92, cellSize * 0.92, cellSize * 0.92],
[x, y, z],
isRim ? materials.dishEdge : materials.dish
);
}
}
// Block-built feed horn and receiver.
addBlock(group, [0.13, 0.13, 0.13], [0.52, 0, 0], materials.stationTrim);
addBlock(group, [0.16, 0.16, 0.16], [0.72, 0, 0], materials.stationLight);
addBlock(group, [0.08, 0.08, 0.08], [0.86, 0, 0], materials.stationTrim);
parent.add(group);
return group;
}
// -------------------------------------------------------------------------
// Ground station
// -------------------------------------------------------------------------
const groundStation = new THREE.Group();
scene.add(groundStation);
// Block-tiled landing platform.
for (let ix = -2; ix <= 2; ix++) {
for (let iz = -1; iz <= 1; iz++) {
addBlock(
groundStation,
[0.67, 0.24, 0.67],
[-4.2 + ix * 0.71, 0.04, iz * 0.71],
(ix + iz) % 2 === 0
? materials.stationDark
: materials.stationLight
);
}
}
// Stacked control tower.
for (let level = 0; level < 4; level++) {
addBlock(
groundStation,
[0.62 - level * 0.04, 0.37, 0.62 - level * 0.04],
[-4.2, 0.35 + level * 0.37, 0],
level === 3 ? materials.stationLight : materials.stationDark
);
}
// Service blocks.
addBlock(
groundStation,
[0.88, 0.55, 0.82],
[-4.88, 0.51, 0.15],
materials.stationDark
);
addBlock(
groundStation,
[0.64, 0.42, 0.64],
[-3.55, 0.43, -0.05],
materials.stationLight
);
addBlock(
groundStation,
[0.12, 0.12, 0.72],
[-3.18, 0.48, 0],
materials.stationTrim
);
// Dish support and voxel dish.
addBlock(
groundStation,
[0.34, 0.42, 0.34],
[-4.02, 1.62, 0],
materials.stationDark
);
createDish(groundStation, [-4.0, 2.05, 0], 0.72, 0.22, true);
// Antenna beacon.
addBlock(
groundStation,
[0.16, 0.16, 0.16],
[-4.2, 2.02, 0],
materials.stationTrim
);
// -------------------------------------------------------------------------
// Fictional spacecraft
// -------------------------------------------------------------------------
const spacecraft = new THREE.Group();
scene.add(spacecraft);
// Gold bus made from discrete visible blocks.
for (let ix = 0; ix < 3; ix++) {
for (let iy = 0; iy < 2; iy++) {
for (let iz = 0; iz < 2; iz++) {
addBlock(
spacecraft,
[0.35, 0.35, 0.35],
[
-0.15 + ix * 0.37,
0.93 + iy * 0.37,
-0.19 + iz * 0.38
],
(ix + iy + iz) % 3 === 0
? materials.goldDark
: materials.gold
);
}
}
}
// Voxel solar panels.
for (const direction of [-1, 1]) {
for (let i = 0; i < 7; i++) {
const z = direction * (0.78 + i * 0.42);
const bright = i % 3 === 0;
addBlock(
spacecraft,
[0.78, 0.10, 0.34],
[0.04, 1.45, z],
bright ? materials.solarLight : materials.solar
);
}
addBlock(
spacecraft,
[0.12, 0.12, 3.0],
[0.04, 1.43, direction * 1.9],
materials.goldDark
);
}
// Antenna boom and dish facing local -X.
addBlock(
spacecraft,
[0.46, 0.12, 0.12],
[-0.48, 1.85, 0],
materials.stationLight
);
createDish(spacecraft, [-0.65, 2.03, 0], 0.42, 0.14, false);
// Instrument and thruster blocks.
addBlock(
spacecraft,
[0.45, 0.34, 0.45],
[0.74, 1.17, 0],
materials.stationLight
);
addBlock(
spacecraft,
[0.22, 0.28, 0.28],
[1.04, 1.17, 0],
materials.stationTrim
);
addBlock(
spacecraft,
[0.14, 0.14, 0.14],
[0.25, 2.02, 0],
materials.stationTrim
);
// -------------------------------------------------------------------------
// Signal path and visible voxel packet
// -------------------------------------------------------------------------
const PATH_START_X = -3.14;
const PATH_Y = 2.03;
const pathGeometry = new THREE.BoxGeometry(0.065, 0.065, 0.065);
const pathMesh = new THREE.InstancedMesh(pathGeometry, materials.path, 72);
pathMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
scene.add(pathMesh);
const pathDummy = new THREE.Object3D();
let pathEndX = shipX - 1.2;
function updatePath() {
pathEndX = shipX - 1.2;
const length = pathEndX - PATH_START_X;
const count = Math.max(12, Math.min(72, Math.floor(length / 0.15)));
pathMesh.count = count;
for (let i = 0; i < count; i++) {
const t = count === 1 ? 0.5 : i / (count - 1);
pathDummy.position.set(
THREE.MathUtils.lerp(PATH_START_X, pathEndX, t),
PATH_Y,
0
);
pathDummy.updateMatrix();
pathMesh.setMatrixAt(i, pathDummy.matrix);
}
pathMesh.instanceMatrix.needsUpdate = true;
}
const pulseGroup = new THREE.Group();
pulseGroup.position.y = PATH_Y;
scene.add(pulseGroup);
const pulseMaterial = new THREE.MeshStandardMaterial({
color: 0xa3fff1,
emissive: 0x3ce9d7,
emissiveIntensity: 2.6,
roughness: 0.25,
metalness: 0.05
});
const pulseBlocks = [];
for (let i = 0; i < 7; i++) {
const pulse = addBlock(
pulseGroup,
[0.14, 0.14, 0.14],
[PATH_START_X - i * 0.17, 0, 0],
pulseMaterial,
false
);
pulseBlocks.push(pulse);
}
// Decade markers along the log-compressed track.
const decadeMarkers = new THREE.Group();
scene.add(decadeMarkers);
for (let i = 0; i <= 5; i++) {
const t = i / 5;
const markerX = (0.25 + 6.5 * t) - 1.2;
addBlock(
decadeMarkers,
[0.10, 0.18, 0.10],
[markerX, 0.18, 1.55],
materials.marker,
false
);
}
// -------------------------------------------------------------------------
// Labels and projection
// -------------------------------------------------------------------------
const groundLabel = document.getElementById("groundLabel");
const shipLabel = document.getElementById("shipLabel");
const groundAnchor = new THREE.Vector3(-4.0, 3.12, 0);
const shipAnchor = new THREE.Vector3();
const projected = new THREE.Vector3();
function placeLabel(element, worldPosition) {
projected.copy(worldPosition).project(camera);
const visible = projected.z > -1 && projected.z < 1;
element.style.display = visible ? "block" : "none";
element.style.left = `${(projected.x * 0.5 + 0.5) * stage.clientWidth}px`;
element.style.top = `${(-projected.y * 0.5 + 0.5) * stage.clientHeight}px`;
}
// -------------------------------------------------------------------------
// Direct camera controls: no Three.js addons
// -------------------------------------------------------------------------
const pointer = {
active: false,
id: null,
x: 0,
y: 0
};
canvas.addEventListener("pointerdown", (event) => {
pointer.active = true;
pointer.id = event.pointerId;
pointer.x = event.clientX;
pointer.y = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.classList.add("dragging");
});
canvas.addEventListener("pointermove", (event) => {
if (!pointer.active || event.pointerId !== pointer.id) return;
const dx = event.clientX - pointer.x;
const dy = event.clientY - pointer.y;
pointer.x = event.clientX;
pointer.y = event.clientY;
cameraState.azimuth -= dx * 0.005;
cameraState.elevation = THREE.MathUtils.clamp(
cameraState.elevation + dy * 0.004,
0.12,
0.72
);
});
function endPointer(event) {
if (!pointer.active || event.pointerId !== pointer.id) return;
pointer.active = false;
canvas.classList.remove("dragging");
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.012,
11,
24
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
cameraState.azimuth = 0;
cameraState.elevation = 0.29;
cameraState.radius = 17;
});
function updateCamera() {
const responsiveScale =
camera.aspect < 1.25
? 1 + (1.25 - camera.aspect) * 0.72
: 1;
const radius = cameraState.radius * responsiveScale;
const horizontal = radius * Math.cos(cameraState.elevation);
const target = cameraState.target;
camera.position.set(
target.x + horizontal * Math.sin(cameraState.azimuth),
target.y + radius * Math.sin(cameraState.elevation),
target.z + horizontal * Math.cos(cameraState.azimuth)
);
camera.lookAt(target);
}
function resize() {
const width = stage.clientWidth;
const height = stage.clientHeight;
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
updateCamera();
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(stage);
// -------------------------------------------------------------------------
// Data display and interaction
// -------------------------------------------------------------------------
function updatePresetState() {
const presetButtons = document.querySelectorAll(".preset");
presetButtons.forEach((button) => {
const presetDistance = Number(button.dataset.distance);
const active =
Math.abs(Math.log10(currentDistanceKm / presetDistance)) < 0.00005;
button.setAttribute("aria-pressed", active ? "true" : "false");
});
}
function updateReadouts() {
const distanceKm = currentDistanceKm;
const distanceMetres = distanceKm * 1000;
const oneWaySeconds = distanceMetres / C_METRES_PER_SECOND;
const roundTripSeconds = 2 * oneWaySeconds;
distanceHeadline.textContent = formatDistanceHeadline(distanceKm);
distanceFull.textContent =
`${numberFormat.format(distanceKm)} km · ` +
`${numberFormat.format(distanceMetres)} m`;
shipLabelDistance.textContent =
`${formatDistanceHeadline(distanceKm).toUpperCase()} SEPARATION`;
oneWayValue.textContent = formatDuration(oneWaySeconds);
roundTripValue.textContent = formatDuration(roundTripSeconds);
oneWayRaw.textContent = `raw: ${oneWaySeconds.toFixed(6)} s`;
roundTripRaw.textContent = `raw: ${roundTripSeconds.toFixed(6)} s`;
equation.innerHTML =
`<strong>t<sub>one-way</sub> = D ÷ c</strong><br />` +
`<strong>t<sub>round-trip</sub> = 2D ÷ c</strong><br />` +
`D = ${numberFormat.format(distanceKm)} km; ` +
`c = ${C_KM_PER_SECOND.toLocaleString("en-US", {
minimumFractionDigits: 3,
maximumFractionDigits: 3
})} km/s`;
updatePresetState();
}
function resetSignal() {
if (autoTimer !== null) {
clearTimeout(autoTimer);
autoTimer = null;
}
signalPhase = "ready";
signalProgress = 0;
pulseGroup.visible = true;
pulseMaterial.color.setHex(0xa3fff1);
pulseMaterial.emissive.setHex(0x3ce9d7);
pulseBlocks.forEach((block, index) => {
block.position.x = PATH_START_X - index * 0.17;
});
status.dataset.state = "ready";
statusText.textContent = "SYSTEM READY · SELECT SEPARATION";
sendButton.disabled = false;
sendButton.textContent = "Send signal";
}
function syncDistanceFromSlider() {
const sliderValue = Number(distanceInput.value);
const logarithmicPosition = sliderValue / 1000;
currentDistanceKm = Math.pow(10, 4 + 5 * logarithmicPosition);
shipX = 0.25 + 6.5 * logarithmicPosition;
spacecraft.position.x = shipX;
updatePath();
updateReadouts();
resetSignal();
}
distanceInput.addEventListener("input", syncDistanceFromSlider);
document.querySelectorAll(".preset").forEach((button) => {
button.addEventListener("click", () => {
const requestedDistance = Number(button.dataset.distance);
distanceInput.value = distanceToSlider(requestedDistance).toFixed(6);
syncDistanceFromSlider();
});
});
function startSignalDemo() {
if (autoTimer !== null) {
clearTimeout(autoTimer);
autoTimer = null;
}
signalPhase = "outbound";
signalProgress = 0;
sendButton.disabled = true;
sendButton.textContent = "Signal in flight";
status.dataset.state = "outbound";
statusText.textContent = "ILLUSTRATIVE PACKET · OUTBOUND REQUEST";
pulseMaterial.color.setHex(0xa3fff1);
pulseMaterial.emissive.setHex(0x3ce9d7);
}
sendButton.addEventListener("click", startSignalDemo);
// -------------------------------------------------------------------------
// Animation
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
updateCamera();
if (signalPhase === "outbound") {
signalProgress += delta / VISUAL_TRAVERSAL_SECONDS;
if (signalProgress >= 1) {
signalProgress = 1;
signalPhase = "returning";
status.dataset.state = "returning";
statusText.textContent = "ILLUSTRATIVE PACKET · RETURN ACKNOWLEDGEMENT";
pulseMaterial.color.setHex(0xffd18a);
pulseMaterial.emissive.setHex(0xff9f38);
}
} else if (signalPhase === "returning") {
signalProgress += delta / VISUAL_TRAVERSAL_SECONDS;
if (signalProgress >= 1) {
signalProgress = 1;
signalPhase = "complete";
status.dataset.state = "complete";
statusText.textContent = "ROUND TRIP COMPLETE · NUMERICAL DELAYS SHOWN ABOVE";
sendButton.disabled = false;
sendButton.textContent = "Send again";
}
}
const outgoing = signalPhase === "ready" || signalPhase === "outbound";
const headX = outgoing
? THREE.MathUtils.lerp(PATH_START_X, pathEndX, signalProgress)
: THREE.MathUtils.lerp(pathEndX, PATH_START_X, signalProgress);
pulseBlocks.forEach((block, index) => {
block.position.x = outgoing
? headX - index * 0.17
: headX + index * 0.17;
});
shipAnchor.set(shipX + 0.05, 3.75, 0);
placeLabel(groundLabel, groundAnchor);
placeLabel(shipLabel, shipAnchor);
renderer.render(scene, camera);
}
// Initialize the model with the nominal 250-million-km separation.
distanceInput.value = distanceToSlider(250000000).toFixed(6);
syncDistanceFromSlider();
resize();
// Start a quiet automatic demonstration after the exhibit has rendered.
autoTimer = window.setTimeout(startSignalDemo, 900);
animate();
</script>
</body>
</html>
```