Prompt specification
Build or customize the Three.js 3D scene "Space Museum Launch Sequence 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 Museum Launch Sequence Exhibit
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/space-museum-launch-sequence-exhibit-x3815
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts rocket stages, separation, and mass accounting. Build a museum diorama comparing payload, discarded structure, and mission stages. Use source-checked general principles while keeping engine internals and real performance claims outside the model. Voxel style.
Working Three.js Starter (space-museum-launch-sequence-exhibit-x3815):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#09111d" />
<title>Mass, Staged — Voxel Rocket Museum</title>
<style>
:root {
--bg: #09111d;
--panel: rgba(10, 18, 31, 0.88);
--panel-edge: rgba(255, 255, 255, 0.12);
--text: #f1f3ed;
--muted: #9ba8b8;
--payload: #53c8ff;
--mission: #ffc857;
--discard: #ff7068;
--paper: #e8ece8;
--shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input,
summary,
a {
font: inherit;
}
button,
summary {
-webkit-tap-highlight-color: transparent;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
cursor: grab;
touch-action: none;
}
#scene canvas:active {
cursor: grabbing;
}
.topbar {
position: fixed;
z-index: 10;
top: 22px;
left: 24px;
right: 24px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
pointer-events: none;
}
.title-block {
max-width: 720px;
text-shadow: 0 3px 18px rgba(0, 0, 0, 0.6);
}
.eyebrow {
margin-bottom: 7px;
color: var(--payload);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(34px, 5vw, 68px);
font-weight: 850;
letter-spacing: -0.055em;
line-height: 0.94;
}
.subtitle {
max-width: 610px;
margin: 13px 0 0;
color: #bdc7d2;
font-size: 14px;
line-height: 1.55;
}
.top-actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
pointer-events: auto;
}
.button {
border: 1px solid var(--panel-edge);
border-radius: 2px;
padding: 10px 13px;
color: var(--text);
background: rgba(10, 18, 31, 0.84);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
cursor: pointer;
transition:
border-color 160ms ease,
background 160ms ease,
transform 160ms ease;
}
.button:hover,
.button:focus-visible {
border-color: rgba(255, 255, 255, 0.38);
background: rgba(24, 37, 56, 0.96);
transform: translateY(-1px);
outline: none;
}
.button.primary {
border-color: rgba(83, 200, 255, 0.55);
color: #07111b;
background: var(--payload);
font-weight: 800;
}
.button.primary:hover,
.button.primary:focus-visible {
background: #83d8ff;
}
.panel {
position: fixed;
z-index: 12;
border: 1px solid var(--panel-edge);
border-radius: 3px;
background: var(--panel);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.ledger {
top: 194px;
left: 24px;
width: 302px;
overflow: hidden;
}
.ledger summary {
list-style: none;
padding: 15px 16px 13px;
border-bottom: 1px solid var(--panel-edge);
color: #dfe7ee;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
cursor: pointer;
}
.ledger summary::-webkit-details-marker {
display: none;
}
.ledger summary::after {
content: "−";
float: right;
color: var(--muted);
font-size: 17px;
line-height: 12px;
}
.ledger:not([open]) summary::after {
content: "+";
}
.ledger-body {
padding: 15px 16px 16px;
}
.ledger-note {
margin: 0 0 15px;
color: var(--muted);
font-size: 11px;
line-height: 1.5;
}
.mass-row {
margin: 0 0 13px;
}
.mass-heading {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 6px;
font-size: 12px;
}
.mass-heading strong {
font-weight: 750;
}
.mass-heading span {
color: #d6dce3;
font-variant-numeric: tabular-nums;
}
.bar-track {
position: relative;
height: 7px;
overflow: hidden;
background: rgba(255, 255, 255, 0.08);
}
.bar {
width: 0;
height: 100%;
transition: width 120ms linear;
}
.bar.payload {
background: var(--payload);
}
.bar.mission {
background: var(--mission);
}
.bar.discard {
background: var(--discard);
}
.total-rule {
height: 1px;
margin: 17px 0 13px;
background: var(--panel-edge);
}
.mini-ledger {
display: grid;
grid-template-columns: 1fr auto;
gap: 8px 14px;
color: var(--muted);
font-size: 11px;
}
.mini-ledger output {
color: var(--text);
font-variant-numeric: tabular-nums;
text-align: right;
}
.boundary-note {
margin: 14px 0 0;
padding-top: 12px;
border-top: 1px solid var(--panel-edge);
color: #8997a8;
font-size: 10px;
line-height: 1.5;
}
.sequence {
right: 24px;
bottom: 24px;
width: 346px;
padding: 16px;
}
.sequence-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.sequence-head strong {
font-size: 12px;
letter-spacing: 0.13em;
text-transform: uppercase;
}
#status {
color: var(--payload);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
text-align: right;
text-transform: uppercase;
}
.timeline {
width: 100%;
height: 20px;
margin: 0;
accent-color: var(--payload);
cursor: pointer;
}
.timeline-marks {
display: flex;
justify-content: space-between;
margin-top: 4px;
color: #7f8c9d;
font-size: 9px;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.sequence-actions {
display: flex;
gap: 7px;
margin-top: 14px;
}
.sequence-actions .button {
flex: 1;
padding: 9px 8px;
font-size: 11px;
font-weight: 750;
}
.legend {
position: fixed;
z-index: 9;
left: 24px;
bottom: 24px;
display: flex;
flex-wrap: wrap;
gap: 15px;
padding: 10px 13px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(9, 17, 29, 0.72);
color: #b8c3cf;
font-size: 10px;
pointer-events: none;
backdrop-filter: blur(9px);
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
}
.swatch {
width: 9px;
height: 9px;
background: var(--c);
box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent);
}
.camera-hint {
position: fixed;
z-index: 9;
left: 50%;
bottom: 27px;
transform: translateX(-50%);
color: rgba(219, 227, 235, 0.55);
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
.source-button {
position: fixed;
z-index: 11;
right: 24px;
top: 88px;
}
dialog {
width: min(680px, calc(100vw - 32px));
max-height: min(780px, calc(100vh - 40px));
padding: 0;
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 4px;
color: var(--text);
background: #0c1624;
box-shadow: 0 28px 100px rgba(0, 0, 0, 0.6);
}
dialog::backdrop {
background: rgba(2, 7, 13, 0.72);
backdrop-filter: blur(6px);
}
.dialog-inner {
padding: 26px;
}
.dialog-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
margin-bottom: 20px;
}
.dialog-head h2 {
margin: 0 0 7px;
font-size: 27px;
letter-spacing: -0.03em;
}
.dialog-head p {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.55;
}
.dialog-close {
border: 0;
padding: 4px 8px;
color: var(--text);
background: transparent;
font-size: 24px;
cursor: pointer;
}
.dialog-section {
margin-top: 22px;
padding-top: 18px;
border-top: 1px solid var(--panel-edge);
}
.dialog-section h3 {
margin: 0 0 10px;
color: var(--payload);
font-size: 11px;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.dialog-section ul {
margin: 0;
padding-left: 19px;
color: #bec8d4;
font-size: 13px;
line-height: 1.65;
}
.dialog-section li + li {
margin-top: 9px;
}
.dialog-section a {
color: #82d8ff;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
}
.source-id {
color: #e4eaf0;
font-weight: 750;
}
#loading {
position: fixed;
z-index: 50;
inset: 0;
display: grid;
place-items: center;
color: #cbd5df;
background: var(--bg);
font-size: 12px;
letter-spacing: 0.15em;
text-transform: uppercase;
transition: opacity 250ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 900px) {
.topbar {
top: 15px;
left: 15px;
right: 15px;
}
.subtitle {
max-width: 520px;
font-size: 12px;
}
.ledger {
top: 150px;
left: 15px;
width: 270px;
}
.sequence {
right: 15px;
bottom: 15px;
width: 316px;
}
.legend,
.camera-hint {
display: none;
}
.source-button {
right: 15px;
top: 70px;
}
}
@media (max-width: 650px) {
.title-block {
max-width: calc(100vw - 30px);
}
h1 {
font-size: 37px;
}
.subtitle {
display: none;
}
.top-actions {
position: fixed;
top: 96px;
right: 12px;
}
.top-actions .button {
padding: 8px 10px;
font-size: 10px;
}
.source-button {
top: 135px;
}
.ledger {
top: 141px;
left: 12px;
width: min(245px, calc(100vw - 24px));
}
.ledger-body {
padding: 12px;
}
.ledger-note,
.boundary-note {
display: none;
}
.sequence {
right: 12px;
bottom: 12px;
width: min(310px, calc(100vw - 24px));
padding: 12px;
}
.sequence-head {
margin-bottom: 7px;
}
.sequence-actions {
margin-top: 9px;
}
}
@media (prefers-reduced-motion: reduce) {
* {
scroll-behavior: auto !important;
}
.button,
.bar {
transition: none;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive voxel museum diorama of a multistage rocket"></div>
<header class="topbar">
<div class="title-block">
<div class="eyebrow">Orbital Museum / Engineering Gallery</div>
<h1>MASS, STAGED</h1>
<p class="subtitle">
A schematic voxel diorama of payload release, stage separation, and a
museum-style mass ledger. All dimensions and tonnages are fictional.
</p>
</div>
<div class="top-actions">
<button class="button" id="assembledButton" type="button">Assembled</button>
<button class="button" id="explodedButton" type="button">Museum view</button>
<button class="button" id="resetCamera" type="button">Reset camera</button>
</div>
</header>
<button class="button source-button" id="openSources" type="button">
Sources & model boundary
</button>
<details class="panel ledger" open>
<summary>Schematic mass ledger</summary>
<div class="ledger-body">
<p class="ledger-note">
Fictional MRV-3 display stack. Percentages use a total display mass of
7.2 t. One voxel tile on a plinth represents 0.4 t.
</p>
<div class="mass-row">
<div class="mass-heading">
<strong>Payload</strong>
<span>1.2 t</span>
</div>
<div class="bar-track">
<div class="bar payload" id="payloadBar"></div>
</div>
</div>
<div class="mass-row">
<div class="mass-heading">
<strong>Mission-stage hardware</strong>
<span>2.4 t</span>
</div>
<div class="bar-track">
<div class="bar mission" id="missionBar"></div>
</div>
</div>
<div class="mass-row">
<div class="mass-heading">
<strong>Discarded structure</strong>
<span>3.6 t</span>
</div>
<div class="bar-track">
<div class="bar discard" id="discardBar"></div>
</div>
</div>
<div class="total-rule"></div>
<div class="mini-ledger">
<span>Total schematic mass</span>
<output>7.2 t</output>
<span>Separated so far</span>
<output id="separatedValue">0.0 t</output>
<span>Remaining mass</span>
<output id="remainingValue">7.2 t</output>
</div>
<div class="bar-track" style="margin-top: 10px">
<div class="bar discard" id="separatedBar"></div>
</div>
<p class="boundary-note">
This is a conservation-of-display-mass model, not a flight estimate.
It does not simulate propulsion, propellant, thrust, delta-v,
trajectories, structural loads, or mission performance.
</p>
</div>
</details>
<section class="panel sequence" aria-label="Separation sequence controls">
<div class="sequence-head">
<strong>Separation sequence</strong>
<span id="status" aria-live="polite">Assembled display</span>
</div>
<input
class="timeline"
id="timeline"
type="range"
min="0"
max="1000"
value="0"
step="1"
aria-label="Rocket separation timeline"
/>
<div class="timeline-marks" aria-hidden="true">
<span>Launch stack</span>
<span>Release</span>
<span>Separate</span>
<span>Sort</span>
</div>
<div class="sequence-actions">
<button class="button primary" id="playButton" type="button" aria-pressed="false">
Play sequence
</button>
<button class="button" id="assembledButtonSmall" type="button">Stack</button>
<button class="button" id="explodedButtonSmall" type="button">Explode</button>
</div>
</section>
<div class="legend" aria-hidden="true">
<span class="legend-item">
<i class="swatch" style="--c: var(--payload)"></i>Payload
</span>
<span class="legend-item">
<i class="swatch" style="--c: var(--mission)"></i>Mission-stage hardware
</span>
<span class="legend-item">
<i class="swatch" style="--c: var(--discard)"></i>Discarded structure
</span>
</div>
<div class="camera-hint">Drag to orbit · Wheel or pinch to zoom</div>
<dialog id="sourcesDialog">
<div class="dialog-inner">
<div class="dialog-head">
<div>
<h2>Sources & model boundary</h2>
<p>
The exhibit follows broad, publicly documented museum conventions
for multistage rockets. It is intentionally not a flight simulator.
</p>
</div>
<button class="dialog-close" id="closeSources" type="button" aria-label="Close">
×
</button>
</div>
<div class="dialog-section">
<h3>General principles consulted</h3>
<ul>
<li>
<span class="source-id">NASA Glenn Research Center — Rocket Principles.</span>
Multistage rockets can jettison empty stages, reducing the mass that
later stages must carry. The exhibit represents this as a clear
separation and museum sorting event.<br />
<a
href="https://www.grc.nasa.gov/www/k-12/airplane/rocket.html"
target="_blank"
rel="noopener noreferrer"
>grc.nasa.gov/www/k-12/airplane/rocket.html</a>
</li>
<li>
<span class="source-id">NASA Learning Resources — What Is a Rocket?</span>
Used only for general rocket and propulsion context. No engine
internals or performance quantities are represented.<br />
<a
href="https://www.nasa.gov/learning-resources/for-kids-and-students/what-is-a-rocket-english/"
target="_blank"
rel="noopener noreferrer"
>nasa.gov/learning-resources</a>
</li>
<li>
<span class="source-id">Smithsonian National Air and Space Museum — How Rockets Work.</span>
Used for the general idea of multistage separation and payload
protection by an outer fairing.<br />
<a
href="https://airandspace.si.edu/stories/editorial/how-rockets-work"
target="_blank"
rel="noopener noreferrer"
>airandspace.si.edu/stories/editorial/how-rockets-work</a>
</li>
</ul>
</div>
<div class="dialog-section">
<h3>What is original to this exhibit</h3>
<ul>
<li>
The vehicle name, voxel geometry, color system, plinths, mass
values, tile scale, and animated arrangement are fictional.
</li>
<li>
The 7.2 t total is conserved among payload, mission-stage hardware,
and discarded structure. It is not presented as a real launch
vehicle estimate.
</li>
<li>
The animation is an explanatory exploded view. Object movement is
diagrammatic and does not represent a real separation trajectory.
</li>
<li>
No claims are made about engines, propellants, thrust, delta-v,
payload capacity, reusability, reliability, or any other real-world
performance characteristic.
</li>
</ul>
</div>
</div>
</dialog>
<div id="loading">Building the museum diorama…</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.querySelector("#scene");
const loading = document.querySelector("#loading");
const COLORS = {
background: 0x09111d,
floor: 0x101a28,
floorEdge: 0x172536,
white: 0xe4e9e7,
whiteDark: 0xb8c4c8,
payload: 0x53c8ff,
payloadDark: 0x1b6d94,
mission: 0xffc857,
missionDark: 0x9d6f1f,
discard: 0xff7068,
discardDark: 0x873a3d,
dark: 0x111c2a,
ink: 0x263546,
light: 0xf4f7f5
};
const MASS = {
total: 7.2,
payload: 1.2,
mission: 2.4,
discard: 3.6,
tileMass: 0.4
};
const scene = new THREE.Scene();
scene.background = new THREE.Color(COLORS.background);
scene.fog = new THREE.Fog(COLORS.background, 21, 42);
const camera = new THREE.PerspectiveCamera(
40,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Voxel rocket museum scene. Drag to orbit and use the mouse wheel to zoom."
);
sceneHost.appendChild(renderer.domElement);
const clock = new THREE.Clock();
// Lighting: broad museum illumination with warm and cool accents.
scene.add(new THREE.HemisphereLight(0xc9e8ff, 0x18202b, 1.8));
const keyLight = new THREE.DirectionalLight(0xffffff, 3.1);
keyLight.position.set(7, 13, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -13;
keyLight.shadow.camera.right = 13;
keyLight.shadow.camera.top = 15;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.bias = -0.00035;
scene.add(keyLight);
const coolLight = new THREE.PointLight(COLORS.payload, 28, 15, 2);
coolLight.position.set(-7, 7, 4);
scene.add(coolLight);
const warmLight = new THREE.PointLight(COLORS.mission, 22, 14, 2);
warmLight.position.set(7, 6, 2);
scene.add(warmLight);
const redLight = new THREE.PointLight(COLORS.discard, 14, 12, 2);
redLight.position.set(0, 4, 7);
scene.add(redLight);
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.78,
metalness: options.metalness ?? 0.04,
emissive: options.emissive ?? 0x000000,
emissiveIntensity: options.emissiveIntensity ?? 0,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
});
}
function addBox(
parent,
size,
position,
color,
options = {}
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
standardMaterial(color, options)
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
if (options.rotation) {
mesh.rotation.set(...options.rotation);
}
parent.add(mesh);
return mesh;
}
function seededRandom(seed) {
let state = seed >>> 0;
return function random() {
state += 0x6d2b79f5;
let value = state;
value = Math.imul(value ^ (value >>> 15), value | 1);
value ^= value + Math.imul(value ^ (value >>> 7), value | 61);
return ((value ^ (value >>> 14)) >>> 0) / 4294967296;
};
}
function addVoxelVolume(
parent,
{
nx,
ny,
nz,
cell,
color,
origin = [0, 0, 0],
seed = 1,
chamfer = true
}
) {
const positions = [];
for (let y = 0; y < ny; y += 1) {
for (let z = 0; z < nz; z += 1) {
for (let x = 0; x < nx; x += 1) {
const corner =
chamfer &&
(x === 0 || x === nx - 1) &&
(z === 0 || z === nz - 1);
if (!corner) {
positions.push([x, y, z]);
}
}
}
}
const geometry = new THREE.BoxGeometry(cell * 0.91, cell * 0.91, cell * 0.91);
const material = standardMaterial(0xffffff, {
roughness: 0.8,
metalness: 0.035
});
const mesh = new THREE.InstancedMesh(geometry, material, positions.length);
const dummy = new THREE.Object3D();
const random = seededRandom(seed);
const base = new THREE.Color(color);
positions.forEach((position, index) => {
dummy.position.set(
origin[0] + (position[0] - (nx - 1) / 2) * cell,
origin[1] + position[1] * cell,
origin[2] + (position[2] - (nz - 1) / 2) * cell
);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
const instanceColor = base.clone();
instanceColor.offsetHSL(
(random() - 0.5) * 0.018,
(random() - 0.5) * 0.055,
(random() - 0.5) * 0.085
);
mesh.setColorAt(index, instanceColor);
});
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeSign(title, subtitle, accent, width = 3) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 200;
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "rgba(8, 16, 28, 0.92)";
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = accent;
context.fillRect(0, 0, 12, canvas.height);
context.strokeStyle = "rgba(255,255,255,0.22)";
context.lineWidth = 4;
context.strokeRect(2, 2, canvas.width - 4, canvas.height - 4);
context.textAlign = "center";
context.fillStyle = "#eef4f2";
context.font = "800 52px system-ui, sans-serif";
context.fillText(title, canvas.width / 2, 82);
context.fillStyle = accent;
context.font = "700 34px system-ui, sans-serif";
context.fillText(subtitle, canvas.width / 2, 139);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthWrite: false,
depthTest: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, width * (200 / 768), 1);
sprite.renderOrder = 20;
return sprite;
}
// Museum architecture, built from rectangular blocks.
addBox(scene, [31, 0.4, 27], [0, -0.25, 1], COLORS.floor);
addBox(scene, [26, 8, 0.45], [0, 3.75, -8.3], 0x111d2b);
addBox(scene, [0.45, 8, 20], [-11.5, 3.75, 1], 0x0e1927);
addBox(scene, [0.45, 8, 20], [11.5, 3.75, 1], 0x0e1927);
const grid = new THREE.GridHelper(26, 26, 0x36506b, 0x24384d);
grid.position.set(0, -0.035, 1);
grid.material.transparent = true;
grid.material.opacity = 0.42;
scene.add(grid);
// Wall blocks and light bars give the gallery a quiet architectural frame.
for (let i = -3; i <= 3; i += 1) {
addBox(
scene,
[2.5, 0.16, 0.55],
[i * 3.35, 7.25, -7.95],
0xd8efff,
{
emissive: 0xb9ddff,
emissiveIntensity: 1.2,
castShadow: false
}
);
addBox(
scene,
[2.55, 3.7, 0.15],
[i * 3.35, 3.2, -8.0],
0x172638
);
}
function makePedestal(x, z, accent, width = 3.4, depth = 3.4) {
const group = new THREE.Group();
group.position.set(x, 0, z);
addBox(
group,
[width, 0.38, depth],
[0, 0.19, 0],
0x1a2736
);
addBox(
group,
[width - 0.22, 0.14, depth - 0.22],
[0, 0.45, 0],
accent,
{
roughness: 0.66,
metalness: 0.08
}
);
// Four corner blocks reinforce the voxel/plinth language.
for (const sx of [-1, 1]) {
for (const sz of [-1, 1]) {
addBox(
group,
[0.24, 0.22, 0.24],
[
sx * (width / 2 - 0.2),
0.24,
sz * (depth / 2 - 0.2)
],
0x34465a
);
}
}
scene.add(group);
return group;
}
const payloadPedestal = makePedestal(-4.2, -0.55, 0x173e52, 3.4, 3.4);
const missionPedestal = makePedestal(4.05, -0.55, 0x4c3a18, 3.4, 3.4);
const discardPedestal = makePedestal(0, 4.15, 0x4a272c, 6.5, 3.4);
const centralPedestal = makePedestal(0, 0, 0x243244, 3.2, 3.2);
// Display mounts.
addBox(centralPedestal, [1.9, 0.48, 1.9], [0, 0.76, 0], COLORS.dark);
addBox(centralPedestal, [1.35, 0.18, 1.35], [0, 1.08, 0], 0x4b5d6f);
function addMassTiles(parent, count, color, width, depth) {
const tile = 0.25;
const spacing = 0.29;
const x = width / 2 - 0.48;
const z = depth / 2 - 0.45;
for (let index = 0; index < count; index += 1) {
addBox(
parent,
[tile, tile, tile],
[x, 0.67 + index * spacing, z],
color,
{
roughness: 0.62,
metalness: 0.08
}
);
}
}
addMassTiles(
payloadPedestal,
MASS.payload / MASS.tileMass,
COLORS.payload,
3.4,
3.4
);
addMassTiles(
missionPedestal,
MASS.mission / MASS.tileMass,
COLORS.mission,
3.4,
3.4
);
addMassTiles(
discardPedestal,
MASS.discard / MASS.tileMass,
COLORS.discard,
6.5,
3.4
);
const payloadSign = makeSign(
"PAYLOAD",
"1.2 t / 3 MASS TILES",
"#53c8ff",
3.15
);
payloadSign.position.set(-4.2, 1.04, 1.48);
scene.add(payloadSign);
const missionSign = makeSign(
"MISSION STAGE",
"2.4 t / 6 MASS TILES",
"#ffc857",
3.35
);
missionSign.position.set(4.05, 1.02, 1.45);
scene.add(missionSign);
const discardSign = makeSign(
"DISCARDED STRUCTURE",
"3.6 t / 9 MASS TILES",
"#ff7068",
4.45
);
discardSign.position.set(0, 1.02, 6.18);
scene.add(discardSign);
const launchSign = makeSign(
"MRV-3",
"SCHEMATIC STACK / 7.2 t",
"#dfe7eb",
3.1
);
launchSign.position.set(0, 1.15, 1.75);
scene.add(launchSign);
// Rocket components.
const stage1 = new THREE.Group();
scene.add(stage1);
addVoxelVolume(stage1, {
nx: 4,
ny: 10,
nz: 4,
cell: 0.38,
color: COLORS.white,
origin: [0, 0.35, 0],
seed: 14
});
addBox(stage1, [1.48, 0.35, 1.48], [0, 0.17, 0], COLORS.ink);
addBox(stage1, [0.09, 3.5, 0.1], [0.56, 2.05, 0.73], COLORS.mission);
addBox(stage1, [0.72, 0.13, 0.11], [0, 1.25, 0.73], COLORS.discard);
addBox(stage1, [0.72, 0.13, 0.11], [0, 3.55, 0.73], COLORS.discard);
// Stepped voxel fins; no aerodynamic or performance claims are implied.
for (const side of [-1, 1]) {
for (let index = 0; index < 3; index += 1) {
addBox(
stage1,
[0.28, 0.23, 1.08 - index * 0.12],
[
side * (0.87 + index * 0.15),
0.25 + index * 0.24,
0
],
COLORS.whiteDark
);
}
}
const stage1Label = makeSign("STAGE 01", "LOWER DISPLAY GROUP", "#ff7068", 2.0);
stage1Label.position.set(1.45, 2.4, 0);
stage1.add(stage1Label);
const interstage = new THREE.Group();
scene.add(interstage);
addBox(interstage, [1.5, 0.44, 1.5], [0, 0.22, 0], COLORS.discard);
addBox(interstage, [1.58, 0.08, 1.58], [0, 0.06, 0], COLORS.discardDark);
addBox(interstage, [1.58, 0.08, 1.58], [0, 0.39, 0], COLORS.discardDark);
addBox(interstage, [0.12, 0.42, 0.08], [0, 0.22, 0.78], COLORS.white);
const stage2 = new THREE.Group();
scene.add(stage2);
addVoxelVolume(stage2, {
nx: 4,
ny: 6,
nz: 4,
cell: 0.38,
color: COLORS.white,
origin: [0, 0.15, 0],
seed: 88
});
addBox(stage2, [1.45, 0.14, 1.45], [0, 0.07, 0], COLORS.ink);
addBox(stage2, [1.54, 0.27, 1.54], [0, 0.72, 0], COLORS.mission);
addBox(stage2, [0.12, 1.65, 0.08], [-0.54, 1.72, 0.72], COLORS.payload);
addBox(stage2, [0.85, 0.12, 0.1], [0, 2.12, 0.72], COLORS.mission);
addBox(stage2, [0.95, 0.24, 0.95], [0, 2.52, 0], COLORS.missionDark);
const stage2Label = makeSign("STAGE 02", "MISSION-STAGE GROUP", "#ffc857", 2.2);
stage2Label.position.set(1.45, 1.62, 0);
stage2.add(stage2Label);
const payload = new THREE.Group();
scene.add(payload);
addVoxelVolume(payload, {
nx: 3,
ny: 3,
nz: 3,
cell: 0.36,
color: COLORS.payload,
origin: [0, 0, 0],
seed: 31,
chamfer: true
});
addBox(payload, [0.72, 0.72, 0.08], [0, 0.54, 0.55], COLORS.mission);
addBox(payload, [0.46, 0.46, 0.1], [0, 0.54, 0.61], COLORS.payloadDark);
addBox(payload, [1.08, 0.08, 1.08], [0, 1.13, 0], COLORS.payloadDark);
const payloadLabel = makeSign("PAYLOAD", "DELIVERED DISPLAY GROUP", "#53c8ff", 2.05);
payloadLabel.position.set(1.35, 0.66, 0);
payload.add(payloadLabel);
function makeFairingHalf(side) {
const group = new THREE.Group();
scene.add(group);
for (let row = 0; row < 6; row += 1) {
const depth = row < 2 ? 1.58 : row < 4 ? 1.28 : 0.92;
const y = 0.18 + row * 0.36;
addBox(
group,
[0.19, 0.35, depth],
[0, y, 0],
COLORS.white
);
// The coral inset reads as the inner structural surface.
addBox(
group,
[0.07, 0.33, depth - 0.08],
[-side * 0.12, y, 0],
COLORS.discard
);
if (row === 3 || row === 4) {
addBox(
group,
[0.24, 0.07, 0.22],
[0, y + 0.18, depth / 2 - 0.16],
COLORS.mission
);
}
}
return group;
}
const fairingLeft = makeFairingHalf(-1);
const fairingRight = makeFairingHalf(1);
// Assembly and museum-view transforms.
const transforms = {
stage1: {
from: new THREE.Vector3(0, 1.15, 0),
to: new THREE.Vector3(-1.62, 0.53, 4.15)
},
interstage: {
from: new THREE.Vector3(0, 5.35, 0),
to: new THREE.Vector3(0.48, 0.53, 4.15)
},
stage2: {
from: new THREE.Vector3(0, 5.8, 0),
to: new THREE.Vector3(4.05, 0.53, -0.55)
},
payload: {
from: new THREE.Vector3(0, 8.31, 0),
to: new THREE.Vector3(-4.2, 0.53, -0.55)
},
fairingLeft: {
from: new THREE.Vector3(-0.78, 8.04, 0),
to: new THREE.Vector3(-2.52, 1.08, 4.15)
},
fairingRight: {
from: new THREE.Vector3(0.78, 8.04, 0),
to: new THREE.Vector3(2.52, 1.08, 4.15)
}
};
const payloadBar = document.querySelector("#payloadBar");
const missionBar = document.querySelector("#missionBar");
const discardBar = document.querySelector("#discardBar");
const separatedBar = document.querySelector("#separatedBar");
const separatedValue = document.querySelector("#separatedValue");
const remainingValue = document.querySelector("#remainingValue");
const status = document.querySelector("#status");
const timeline = document.querySelector("#timeline");
const playButton = document.querySelector("#playButton");
let progress = 0;
let playing = false;
const clamp01 = value => Math.max(0, Math.min(1, value));
const smooth = (value, start, end) =>
THREE.MathUtils.smoothstep(value, start, end);
const mix = THREE.MathUtils.lerp;
function setSpriteOpacity(sprite, opacity) {
sprite.material.opacity = opacity;
sprite.visible = opacity > 0.01;
}
function updateScene(value) {
progress = clamp01(value);
const payloadTravel = smooth(progress, 0.17, 0.51);
const stage1Travel = smooth(progress, 0.3, 0.65);
const interstageTravel = smooth(progress, 0.27, 0.62);
const stage2Travel = smooth(progress, 0.49, 0.83);
const fairingOpen = smooth(progress, 0.03, 0.24);
const fairingTravel = smooth(progress, 0.34, 0.73);
stage1.position.lerpVectors(
transforms.stage1.from,
transforms.stage1.to,
stage1Travel
);
stage1.rotation.y = -0.08 * stage1Travel;
interstage.position.lerpVectors(
transforms.interstage.from,
transforms.interstage.to,
interstageTravel
);
interstage.rotation.y = 0.12 * interstageTravel;
stage2.position.lerpVectors(
transforms.stage2.from,
transforms.stage2.to,
stage2Travel
);
stage2.rotation.y = -0.13 * stage2Travel;
payload.position.lerpVectors(
transforms.payload.from,
transforms.payload.to,
payloadTravel
);
payload.rotation.y = 0.22 * payloadTravel;
const fairingData = [
{
group: fairingLeft,
transform: transforms.fairingLeft,
side: -1
},
{
group: fairingRight,
transform: transforms.fairingRight,
side: 1
}
];
fairingData.forEach(({ group, transform, side }) => {
const openX = transform.from.x + side * fairingOpen * 0.78;
const openY = transform.from.y + fairingOpen * 0.08;
const openZ = transform.from.z;
group.position.set(
mix(openX, transform.to.x, fairingTravel),
mix(openY, transform.to.y, fairingTravel),
mix(openZ, transform.to.z, fairingTravel)
);
group.rotation.z = -side * (0.34 + fairingTravel * 0.15);
group.rotation.y = side * fairingTravel * 0.16;
});
setSpriteOpacity(
stage1Label,
0.95 * (1 - smooth(progress, 0.55, 0.72))
);
setSpriteOpacity(
stage2Label,
0.95 * (1 - smooth(progress, 0.75, 0.9))
);
setSpriteOpacity(
payloadLabel,
0.95 * (1 - smooth(progress, 0.42, 0.6))
);
launchSign.material.opacity = 1 - progress * 0.52;
payloadSign.material.opacity = 0.35 + payloadTravel * 0.65;
missionSign.material.opacity = 0.35 + stage2Travel * 0.65;
discardSign.material.opacity = 0.3 + fairingTravel * 0.7;
// Static category bars show the complete museum ledger.
payloadBar.style.width = `${(MASS.payload / MASS.total) * 100}%`;
missionBar.style.width = `${(MASS.mission / MASS.total) * 100}%`;
discardBar.style.width = `${(MASS.discard / MASS.total) * 100}%`;
// Dynamic separation accounting:
// fairing 1.2 t + interstage 0.4 t, then lower stage 2.0 t.
const separated =
1.6 * smooth(progress, 0.28, 0.56) +
2.0 * smooth(progress, 0.34, 0.65);
const remaining = MASS.total - separated;
separatedBar.style.width = `${(separated / MASS.total) * 100}%`;
separatedValue.textContent = `${separated.toFixed(1)} t`;
remainingValue.textContent = `${remaining.toFixed(1)} t`;
if (progress < 0.08) {
status.textContent = "Assembled display";
} else if (progress < 0.28) {
status.textContent = "Fairing release";
} else if (progress < 0.67) {
status.textContent = "Stage separation";
} else {
status.textContent = "Museum sorting";
}
timeline.value = String(Math.round(progress * 1000));
timeline.setAttribute(
"aria-valuetext",
`${Math.round(progress * 100)} percent, ${status.textContent}`
);
}
function setPlaying(value) {
playing = value;
playButton.setAttribute("aria-pressed", String(playing));
playButton.textContent = playing
? "Pause sequence"
: progress >= 0.999
? "Replay sequence"
: "Play sequence";
}
function jumpTo(value) {
setPlaying(false);
updateScene(value);
}
timeline.addEventListener("input", event => {
jumpTo(Number(event.target.value) / 1000);
});
playButton.addEventListener("click", () => {
if (!playing && progress >= 0.999) {
updateScene(0);
}
setPlaying(!playing);
});
document
.querySelector("#assembledButton")
.addEventListener("click", () => jumpTo(0));
document
.querySelector("#explodedButton")
.addEventListener("click", () => jumpTo(1));
document
.querySelector("#assembledButtonSmall")
.addEventListener("click", () => jumpTo(0));
document
.querySelector("#explodedButtonSmall")
.addEventListener("click", () => jumpTo(1));
const sourcesDialog = document.querySelector("#sourcesDialog");
document.querySelector("#openSources").addEventListener("click", () => {
sourcesDialog.showModal();
});
document.querySelector("#closeSources").addEventListener("click", () => {
sourcesDialog.close();
});
sourcesDialog.addEventListener("click", event => {
const rect = sourcesDialog.getBoundingClientRect();
const outside =
event.clientX < rect.left ||
event.clientX > rect.right ||
event.clientY < rect.top ||
event.clientY > rect.bottom;
if (outside) sourcesDialog.close();
});
// Direct camera controls: orbit, pitch and zoom without addons.
const cameraState = {
yaw: 0.48,
pitch: 0.38,
distance: innerWidth < 700 ? 22 : 18,
target: new THREE.Vector3(0, 3.4, 0.8),
desiredYaw: 0.48,
desiredPitch: 0.38,
desiredDistance: innerWidth < 700 ? 22 : 18,
desiredTarget: new THREE.Vector3(0, 3.4, 0.8)
};
let dragging = false;
let previousPointerX = 0;
let previousPointerY = 0;
function resetCamera() {
cameraState.desiredYaw = 0.48;
cameraState.desiredPitch = 0.38;
cameraState.desiredDistance = innerWidth < 700 ? 22 : 18;
cameraState.desiredTarget.set(0, 3.4, 0.8);
}
document.querySelector("#resetCamera").addEventListener("click", resetCamera);
renderer.domElement.addEventListener("dblclick", resetCamera);
renderer.domElement.addEventListener("pointerdown", event => {
dragging = true;
previousPointerX = event.clientX;
previousPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", event => {
if (!dragging) return;
const deltaX = event.clientX - previousPointerX;
const deltaY = event.clientY - previousPointerY;
previousPointerX = event.clientX;
previousPointerY = event.clientY;
cameraState.desiredYaw -= deltaX * 0.006;
cameraState.desiredPitch = THREE.MathUtils.clamp(
cameraState.desiredPitch + deltaY * 0.004,
0.12,
0.78
);
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined) {
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
event => {
event.preventDefault();
cameraState.desiredDistance = THREE.MathUtils.clamp(
cameraState.desiredDistance + event.deltaY * 0.012,
10,
30
);
},
{ passive: false }
);
// Pinch zoom is implemented directly with pointer events.
const activePointers = new Map();
let pinchStartDistance = 0;
let pinchStartCameraDistance = 0;
renderer.domElement.addEventListener("pointerdown", event => {
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2) {
const points = [...activePointers.values()];
pinchStartDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
pinchStartCameraDistance = cameraState.desiredDistance;
}
});
renderer.domElement.addEventListener("pointermove", event => {
if (!activePointers.has(event.pointerId)) return;
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2 && pinchStartDistance > 0) {
const points = [...activePointers.values()];
const currentDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
cameraState.desiredDistance = THREE.MathUtils.clamp(
pinchStartCameraDistance *
(pinchStartDistance / Math.max(currentDistance, 1)),
10,
30
);
}
});
function removePointer(event) {
activePointers.delete(event.pointerId);
if (activePointers.size < 2) pinchStartDistance = 0;
}
renderer.domElement.addEventListener("pointerup", removePointer);
renderer.domElement.addEventListener("pointercancel", removePointer);
renderer.domElement.addEventListener("keydown", event => {
if (event.key === "ArrowLeft") {
jumpTo(progress - 0.03);
event.preventDefault();
}
if (event.key === "ArrowRight") {
jumpTo(progress + 0.03);
event.preventDefault();
}
if (event.key === "Home") {
jumpTo(0);
event.preventDefault();
}
if (event.key === "End") {
jumpTo(1);
event.preventDefault();
}
});
function updateCamera(delta) {
const damping = 1 - Math.exp(-delta * 9);
cameraState.yaw = mix(
cameraState.yaw,
cameraState.desiredYaw,
damping
);
cameraState.pitch = mix(
cameraState.pitch,
cameraState.desiredPitch,
damping
);
cameraState.distance = mix(
cameraState.distance,
cameraState.desiredDistance,
damping
);
cameraState.target.lerp(
cameraState.desiredTarget,
damping
);
const horizontalDistance =
cameraState.distance * Math.cos(cameraState.pitch);
camera.position.set(
cameraState.target.x +
horizontalDistance * Math.sin(cameraState.yaw),
cameraState.target.y +
cameraState.distance * Math.sin(cameraState.pitch),
cameraState.target.z +
horizontalDistance * Math.cos(cameraState.yaw)
);
camera.lookAt(cameraState.target);
}
function resize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
}
addEventListener("resize", resize);
updateScene(0);
updateCamera(1);
renderer.render(scene, camera);
loading.classList.add("hidden");
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
if (playing) {
const nextProgress = progress + delta / 12;
if (nextProgress >= 1) {
updateScene(1);
setPlaying(false);
} else {
updateScene(nextProgress);
}
}
updateCamera(delta);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```