Prompt specification
Build or customize the Three.js 3D scene "Original Two-Stage Rocket Exploded Sections" 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: Original Two-Stage Rocket Exploded Sections
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/original-two-stage-rocket-exploded-sections-x3813
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts an original low-poly fictional educational rocket in an exploded arrangement. Separate a generic lower stage, upper stage, payload section, and protective nose shell along one central axis. Give each section a clear outer silhouette, a simple interface ring, and a small identity marker so the assembly order is apparent. A compact assembled view beside it shows how the same parts fit together. Use only schematic internal blocks for mass and payload space, with no detailed engine construction.
Working Three.js Starter (original-two-stage-rocket-exploded-sections-x3813):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AXIOM-4 — Exploded Educational Rocket</title>
<style>
:root {
color-scheme: light;
--ink: #172b38;
--muted: #61717a;
--paper: #f3efe6;
--panel: rgba(255, 255, 255, 0.82);
--line: rgba(23, 43, 56, 0.14);
--coral: #ee7653;
--teal: #239a9a;
--blue: #5878e8;
--gold: #dfa938;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.overlay {
position: fixed;
inset: 0;
pointer-events: none;
}
.brand {
position: absolute;
top: 28px;
left: 30px;
max-width: 390px;
}
.eyebrow {
margin-bottom: 7px;
color: var(--muted);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(27px, 3.2vw, 47px);
font-weight: 820;
letter-spacing: -0.045em;
line-height: 0.98;
}
.subtitle {
margin-top: 11px;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.controls {
position: absolute;
top: 28px;
right: 28px;
padding: 11px 14px;
border: 1px solid var(--line);
border-radius: 12px;
background: var(--panel);
color: var(--muted);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
backdrop-filter: blur(12px);
}
.controls strong {
color: var(--ink);
}
.legend {
position: absolute;
left: 30px;
bottom: 26px;
width: min(330px, calc(100vw - 60px));
padding: 15px 16px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--panel);
backdrop-filter: blur(12px);
}
.legend-title {
margin-bottom: 10px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.legend-row {
display: grid;
grid-template-columns: 10px 28px 1fr;
gap: 9px;
align-items: center;
margin-top: 7px;
font-size: 12px;
}
.swatch {
width: 10px;
height: 10px;
border-radius: 3px;
}
.number {
color: var(--muted);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.08em;
}
.note {
position: absolute;
right: 28px;
bottom: 27px;
max-width: 280px;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
text-align: right;
}
@media (max-width: 760px) {
.brand {
top: 18px;
left: 18px;
}
.subtitle {
max-width: 270px;
font-size: 11px;
}
.controls {
top: 18px;
right: 18px;
padding: 8px 10px;
}
.controls span {
display: none;
}
.legend {
left: 18px;
bottom: 18px;
padding: 12px 13px;
}
.note {
display: none;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div class="overlay">
<header class="brand">
<div class="eyebrow">Orbital Systems Training Series</div>
<h1>AXIOM‑4</h1>
<div class="subtitle">
Exploded educational vehicle with schematic mass blocks and a
protected payload volume.
</div>
</header>
<div class="controls">
<strong>Drag</strong> to orbit
<span> · </span>
<strong>Scroll</strong> to zoom
<span> · </span>
<strong>Double-click</strong> to reset
</div>
<aside class="legend">
<div class="legend-title">Assembly order</div>
<div class="legend-row">
<span class="swatch" style="background:var(--coral)"></span>
<span class="number">01</span>
<span>Generic lower stage</span>
</div>
<div class="legend-row">
<span class="swatch" style="background:var(--teal)"></span>
<span class="number">02</span>
<span>Generic upper stage</span>
</div>
<div class="legend-row">
<span class="swatch" style="background:var(--blue)"></span>
<span class="number">03</span>
<span>Payload section</span>
</div>
<div class="legend-row">
<span class="swatch" style="background:var(--gold)"></span>
<span class="number">04</span>
<span>Protective nose shell</span>
</div>
</aside>
<div class="note">
Interior components are intentionally represented only as simple
schematic blocks. The lower stage contains no detailed engine model.
</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.querySelector("#scene");
const COLORS = {
paper: 0xf3efe6,
ground: 0xe8e1d5,
ink: 0x172b38,
body: 0xeeeae1,
payloadBody: 0xdde7e6,
dark: 0x263640,
muted: 0x87949a,
coral: 0xee7653,
teal: 0x239a9a,
blue: 0x5878e8,
gold: 0xdfa938,
mass: 0x77838a,
massWarm: 0xb9a47b,
payload: 0x45c3d0
};
const renderer = new THREE.WebGLRenderer({
antialias: 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.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive exploded view of the AXIOM-4 educational rocket"
);
sceneHost.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(COLORS.paper);
scene.fog = new THREE.Fog(COLORS.paper, 19, 37);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(1.2, 4.2, 0);
const controls = {
azimuth: 0.42,
polar: 1.16,
distance: 16.8
};
function updateCamera() {
const sinPolar = Math.sin(controls.polar);
camera.position.set(
target.x + controls.distance * sinPolar * Math.sin(controls.azimuth),
target.y + controls.distance * Math.cos(controls.polar),
target.z + controls.distance * sinPolar * Math.cos(controls.azimuth)
);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xffffff, 0x9d927f, 2.3);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff5df, 4.0);
keyLight.position.set(-5, 12, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -9;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 12;
keyLight.shadow.camera.bottom = -4;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb9d8ee, 1.25);
fillLight.position.set(8, 5, -7);
scene.add(fillLight);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(80, 80),
new THREE.MeshStandardMaterial({
color: COLORS.ground,
roughness: 1,
metalness: 0
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.08;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(20, 40, 0x9ca6a7, 0xb9b8af);
grid.position.set(1.1, -0.065, 0);
grid.material.transparent = true;
grid.material.opacity = 0.17;
scene.add(grid);
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.72,
metalness: options.metalness ?? 0.05,
flatShading: options.flatShading ?? true,
side: options.side ?? THREE.FrontSide,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1,
depthWrite: options.depthWrite ?? true
});
}
function roundedRectPath(ctx, x, y, w, h, r) {
const radius = Math.min(r, w * 0.5, h * 0.5);
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.arcTo(x + w, y, x + w, y + h, radius);
ctx.arcTo(x + w, y + h, x, y + h, radius);
ctx.arcTo(x, y + h, x, y, radius);
ctx.arcTo(x, y, x + w, y, radius);
ctx.closePath();
}
function makeLabelTexture(text, accent, dark = false) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 128;
const ctx = canvas.getContext("2d");
const hex = `#${new THREE.Color(accent).getHexString()}`;
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRectPath(ctx, 3, 3, 762, 122, 22);
ctx.fillStyle = dark
? "rgba(23,43,56,0.92)"
: "rgba(255,255,255,0.94)";
ctx.fill();
ctx.lineWidth = 5;
ctx.strokeStyle = dark
? "rgba(255,255,255,0.25)"
: "rgba(23,43,56,0.18)";
ctx.stroke();
ctx.fillStyle = hex;
roundedRectPath(ctx, 19, 19, 15, 90, 7);
ctx.fill();
ctx.fillStyle = dark ? "#ffffff" : "#172b38";
ctx.font = "800 40px system-ui, sans-serif";
ctx.textAlign = "left";
ctx.textBaseline = "middle";
ctx.fillText(text, 59, 65);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
function makeBadgeTexture(number, accent) {
const canvas = document.createElement("canvas");
canvas.width = 128;
canvas.height = 128;
const ctx = canvas.getContext("2d");
const hex = `#${new THREE.Color(accent).getHexString()}`;
roundedRectPath(ctx, 4, 4, 120, 120, 24);
ctx.fillStyle = hex;
ctx.fill();
ctx.lineWidth = 8;
ctx.strokeStyle = "#ffffff";
ctx.stroke();
ctx.fillStyle = "#ffffff";
ctx.font = "900 60px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(number, 64, 67);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
function makeLabelSprite(text, accent, width = 2.5, dark = false) {
const material = new THREE.SpriteMaterial({
map: makeLabelTexture(text, accent, dark),
transparent: true,
depthTest: false,
depthWrite: false,
toneMapped: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, width * (128 / 768), 1);
sprite.renderOrder = 30;
return sprite;
}
function addBadge(group, number, accent, y, z) {
const material = new THREE.MeshBasicMaterial({
map: makeBadgeTexture(number, accent),
transparent: true,
toneMapped: false,
side: THREE.DoubleSide
});
const badge = new THREE.Mesh(
new THREE.PlaneGeometry(0.34, 0.34),
material
);
badge.position.set(0, y, z);
badge.renderOrder = 12;
group.add(badge);
return badge;
}
function addInterfaceRing(group, radius, y, accent) {
const darkRing = new THREE.Mesh(
new THREE.TorusGeometry(radius * 0.94, 0.058, 6, 18),
standardMaterial(COLORS.dark, { roughness: 0.55 })
);
darkRing.rotation.x = Math.PI / 2;
darkRing.position.y = y;
darkRing.castShadow = true;
group.add(darkRing);
const accentRing = new THREE.Mesh(
new THREE.TorusGeometry(radius * 0.985, 0.025, 5, 18),
standardMaterial(accent, { roughness: 0.6 })
);
accentRing.rotation.x = Math.PI / 2;
accentRing.position.y = y;
accentRing.castShadow = true;
group.add(accentRing);
}
function addAccentBand(group, radius, y, accent) {
const band = new THREE.Mesh(
new THREE.TorusGeometry(radius * 1.008, 0.067, 6, 18),
standardMaterial(accent, { roughness: 0.68 })
);
band.rotation.x = Math.PI / 2;
band.position.y = y;
band.castShadow = true;
group.add(band);
}
function addShell(
group,
radius,
height,
centerY,
material,
cutaway,
sides = 12
) {
const thetaStart = cutaway ? 0.97 : 0;
const thetaLength = cutaway ? Math.PI * 2 - 0.86 : Math.PI * 2;
const shell = new THREE.Mesh(
new THREE.CylinderGeometry(
radius,
radius,
height,
sides,
1,
true,
thetaStart,
thetaLength
),
material
);
shell.position.y = centerY;
shell.castShadow = true;
shell.receiveShadow = true;
group.add(shell);
if (!cutaway) {
const lowerCap = new THREE.Mesh(
new THREE.CylinderGeometry(radius * 0.98, radius * 0.98, 0.055, sides),
material
);
lowerCap.position.y = 0.028;
lowerCap.castShadow = true;
group.add(lowerCap);
const upperCap = lowerCap.clone();
upperCap.position.y = height - 0.028;
group.add(upperCap);
} else {
const edgeAngles = [0.97, Math.PI * 2 - 0.86];
for (const angle of edgeAngles) {
const edge = new THREE.Mesh(
new THREE.CylinderGeometry(0.018, 0.018, height, 6),
standardMaterial(COLORS.dark)
);
edge.position.set(
Math.sin(angle) * radius,
centerY,
Math.cos(angle) * radius
);
edge.castShadow = true;
group.add(edge);
}
}
return shell;
}
function addSchematicBlock(group, size, position, color, label) {
const block = new THREE.Mesh(
new THREE.BoxGeometry(size.x, size.y, size.z),
standardMaterial(color, { roughness: 0.82 })
);
block.position.copy(position);
block.castShadow = true;
block.receiveShadow = true;
group.add(block);
if (label) {
const tag = makeLabelSprite(label, color, 0.92, true);
tag.position.copy(position);
tag.position.x += 0.22;
tag.position.y += size.y * 0.62;
tag.position.z += 0.17;
group.add(tag);
}
}
function addFin(group, angle, radius) {
const shape = new THREE.Shape();
shape.moveTo(0, -0.43);
shape.lineTo(0.72, -0.26);
shape.lineTo(0.61, 0.44);
shape.lineTo(0, 0.44);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.1,
bevelEnabled: false,
steps: 1
});
geometry.translate(0, 0, -0.05);
const fin = new THREE.Mesh(
geometry,
standardMaterial(COLORS.coral, { roughness: 0.76 })
);
fin.position.set(
Math.sin(angle) * radius,
0.56,
Math.cos(angle) * radius
);
fin.rotation.y = Math.PI / 2 - angle;
fin.castShadow = true;
group.add(fin);
}
function createLowerStage(cutaway) {
const group = new THREE.Group();
const radius = 0.94;
const height = 2.4;
addShell(
group,
radius,
height,
height / 2,
standardMaterial(COLORS.body, {
side: THREE.DoubleSide,
roughness: 0.78
}),
cutaway
);
addInterfaceRing(group, radius, 0.045, COLORS.coral);
addInterfaceRing(group, radius, height - 0.045, COLORS.coral);
addAccentBand(group, radius, 1.83, COLORS.coral);
const skirt = new THREE.Mesh(
new THREE.CylinderGeometry(0.64, 0.72, 0.28, 8),
standardMaterial(COLORS.dark, { roughness: 0.68 })
);
skirt.position.y = 0.035;
skirt.castShadow = true;
group.add(skirt);
for (let i = 0; i < 4; i++) {
addFin(group, (i * Math.PI) / 2, radius * 0.84);
}
addBadge(group, "01", COLORS.coral, 1.02, radius + 0.055);
if (cutaway) {
addSchematicBlock(
group,
new THREE.Vector3(0.68, 0.64, 0.62),
new THREE.Vector3(0.08, 0.68, 0.12),
COLORS.mass,
"MASS"
);
addSchematicBlock(
group,
new THREE.Vector3(0.48, 0.43, 0.52),
new THREE.Vector3(-0.08, 1.33, 0.05),
COLORS.massWarm
);
}
return group;
}
function createUpperStage(cutaway) {
const group = new THREE.Group();
const radius = 0.77;
const height = 1.75;
addShell(
group,
radius,
height,
height / 2,
standardMaterial(COLORS.body, {
side: THREE.DoubleSide,
roughness: 0.78
}),
cutaway
);
addInterfaceRing(group, radius, 0.045, COLORS.teal);
addInterfaceRing(group, radius, height - 0.045, COLORS.teal);
addAccentBand(group, radius, 1.18, COLORS.teal);
addBadge(group, "02", COLORS.teal, 0.77, radius + 0.055);
if (cutaway) {
addSchematicBlock(
group,
new THREE.Vector3(0.52, 0.62, 0.5),
new THREE.Vector3(0.08, 0.68, 0.1),
COLORS.massWarm,
"MASS"
);
addSchematicBlock(
group,
new THREE.Vector3(0.37, 0.33, 0.42),
new THREE.Vector3(-0.03, 1.23, 0.03),
COLORS.teal
);
}
return group;
}
function createPayloadSection(cutaway) {
const group = new THREE.Group();
const radius = 0.72;
const height = 1.05;
addShell(
group,
radius,
height,
height / 2,
standardMaterial(COLORS.payloadBody, {
side: THREE.DoubleSide,
roughness: 0.8
}),
cutaway,
8
);
addInterfaceRing(group, radius, 0.045, COLORS.blue);
addInterfaceRing(group, radius, height - 0.045, COLORS.blue);
addAccentBand(group, radius, 0.79, COLORS.blue);
addBadge(group, "03", COLORS.blue, 0.47, radius + 0.055);
if (cutaway) {
const adapter = new THREE.Mesh(
new THREE.BoxGeometry(0.36, 0.17, 0.36),
standardMaterial(COLORS.dark)
);
adapter.position.y = 0.14;
adapter.castShadow = true;
group.add(adapter);
addSchematicBlock(
group,
new THREE.Vector3(0.58, 0.58, 0.58),
new THREE.Vector3(0.08, 0.61, 0.08),
COLORS.payload,
"PAYLOAD"
);
}
return group;
}
function createNoseShell(cutaway) {
const group = new THREE.Group();
const profile = [
new THREE.Vector2(0.73, 0),
new THREE.Vector2(0.70, 0.35),
new THREE.Vector2(0.58, 0.80),
new THREE.Vector2(0.38, 1.22),
new THREE.Vector2(0.16, 1.55),
new THREE.Vector2(0.06, 1.67)
];
const phiStart = cutaway ? 0.97 : 0;
const phiLength = cutaway ? Math.PI * 2 - 0.86 : Math.PI * 2;
const shell = new THREE.Mesh(
new THREE.LatheGeometry(profile, 8, phiStart, phiLength),
standardMaterial(0xeadfc7, {
side: THREE.DoubleSide,
roughness: 0.84
})
);
shell.castShadow = true;
shell.receiveShadow = true;
group.add(shell);
addInterfaceRing(group, 0.73, 0.045, COLORS.gold);
addAccentBand(group, 0.73, 0.32, COLORS.gold);
const tip = new THREE.Mesh(
new THREE.OctahedronGeometry(0.09, 0),
standardMaterial(COLORS.gold, { roughness: 0.58 })
);
tip.position.y = 1.69;
tip.castShadow = true;
group.add(tip);
addBadge(group, "04", COLORS.gold, 0.87, 0.735);
// Fine seam lines emphasize the low-poly shell without depicting machinery.
const seamAngles = cutaway
? [0.97, Math.PI * 2 - 0.86]
: [0, Math.PI / 2, Math.PI, Math.PI * 1.5];
for (const angle of seamAngles) {
const points = profile.map((point) =>
new THREE.Vector3(
Math.sin(angle) * point.x,
point.y,
Math.cos(angle) * point.x
)
);
const seam = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(points),
new THREE.LineBasicMaterial({
color: 0x9b8f79,
transparent: true,
opacity: 0.65
})
);
group.add(seam);
}
if (cutaway) {
const clearance = new THREE.Mesh(
new THREE.BoxGeometry(0.56, 0.56, 0.56),
new THREE.MeshBasicMaterial({
color: COLORS.gold,
wireframe: true,
transparent: true,
opacity: 0.42
})
);
clearance.position.set(0.04, 0.42, 0.05);
group.add(clearance);
const tag = makeLabelSprite("CLEARANCE", COLORS.gold, 1.02, true);
tag.position.set(0.18, 0.79, 0.12);
group.add(tag);
}
return group;
}
// ---------------------------------------------------------------------
// Exploded arrangement
// ---------------------------------------------------------------------
const exploded = new THREE.Group();
exploded.position.x = -1.4;
scene.add(exploded);
const lower = createLowerStage(true);
lower.position.y = 0.18;
exploded.add(lower);
const upper = createUpperStage(true);
upper.position.y = 3.1;
exploded.add(upper);
const payload = createPayloadSection(true);
payload.position.y = 5.42;
exploded.add(payload);
const nose = createNoseShell(true);
nose.position.y = 7.03;
exploded.add(nose);
const axisGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(0, 0.0, 0),
new THREE.Vector3(0, 9.08, 0)
]);
const axis = new THREE.Line(
axisGeometry,
new THREE.LineDashedMaterial({
color: COLORS.muted,
dashSize: 0.12,
gapSize: 0.1,
transparent: true,
opacity: 0.5
})
);
axis.computeLineDistances();
exploded.add(axis);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.085, 0.28, 6),
standardMaterial(COLORS.muted)
);
arrow.position.y = 9.12;
exploded.add(arrow);
const explodedTitle = makeLabelSprite(
"EXPLODED VIEW",
COLORS.ink,
2.45
);
explodedTitle.position.set(0, 9.52, 0);
exploded.add(explodedTitle);
const labels = [
{
text: "01 LOWER STAGE",
color: COLORS.coral,
position: new THREE.Vector3(1.78, 1.25, 0)
},
{
text: "02 UPPER STAGE",
color: COLORS.teal,
position: new THREE.Vector3(1.78, 3.95, 0)
},
{
text: "03 PAYLOAD SECTION",
color: COLORS.blue,
position: new THREE.Vector3(1.78, 5.96, 0)
},
{
text: "04 NOSE SHELL",
color: COLORS.gold,
position: new THREE.Vector3(1.78, 7.92, 0)
}
];
for (const item of labels) {
const label = makeLabelSprite(item.text, item.color, 2.65);
label.position.copy(item.position);
exploded.add(label);
}
// ---------------------------------------------------------------------
// Compact assembled reference using the same four parts
// ---------------------------------------------------------------------
const assembled = new THREE.Group();
assembled.position.set(4.15, 0.1, 0);
assembled.scale.setScalar(0.7);
scene.add(assembled);
const assembledLower = createLowerStage(false);
assembled.add(assembledLower);
const assembledUpper = createUpperStage(false);
assembledUpper.position.y = 2.4;
assembled.add(assembledUpper);
const assembledPayload = createPayloadSection(false);
assembledPayload.position.y = 4.15;
assembled.add(assembledPayload);
const assembledNose = createNoseShell(false);
assembledNose.position.y = 5.2;
assembled.add(assembledNose);
const pedestal = new THREE.Mesh(
new THREE.CylinderGeometry(1.48, 1.56, 0.12, 32),
standardMaterial(0xd6dfdd, { roughness: 0.86 })
);
pedestal.position.set(4.15, 0.0, 0);
pedestal.receiveShadow = true;
pedestal.castShadow = true;
scene.add(pedestal);
const assembledTitle = makeLabelSprite(
"ASSEMBLED REFERENCE",
COLORS.ink,
2.65
);
assembledTitle.position.set(4.15, 5.48, 0);
scene.add(assembledTitle);
const assemblyNote = makeLabelSprite(
"SAME FOUR PARTS",
COLORS.teal,
1.72
);
assemblyNote.position.set(4.15, 5.08, 0);
scene.add(assemblyNote);
// ---------------------------------------------------------------------
// Direct camera controls: no addons or example modules are used.
// ---------------------------------------------------------------------
let dragging = false;
let lastX = 0;
let lastY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
lastX = event.clientX;
lastY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
controls.azimuth -= dx * 0.006;
controls.polar = THREE.MathUtils.clamp(
controls.polar - dy * 0.005,
0.48,
1.46
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined &&
canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.distance = THREE.MathUtils.clamp(
controls.distance + event.deltaY * 0.012,
10.5,
25
);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
controls.azimuth = 0.42;
controls.polar = 1.16;
controls.distance = 16.8;
target.set(1.2, 4.2, 0);
updateCamera();
});
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
camera.aspect = width / height;
camera.fov = camera.aspect < 0.85 ? 52 : 38;
camera.updateProjectionMatrix();
updateCamera();
}
window.addEventListener("resize", resize);
resize();
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
</script>
</body>
</html>
```