Prompt specification
Build or customize the Three.js 3D scene "Electronics manufacturing and assembly 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: Electronics manufacturing and assembly exhibit
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/electronics-manufacturing-and-assembly-exhibit-x2495
Scene Description Prompt:
A voxel technology exhibit connects schematic wafer patterns, packaged chips, circuit boards, and devices. Build one HTML file using Three.js from cdnjs.
Working Three.js Starter (electronics-manufacturing-and-assembly-exhibit-x2495):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#050814" />
<title>Connected Intelligence — Voxel Technology Exhibit</title>
<style>
:root {
--bg: #050814;
--panel: rgba(10, 17, 34, 0.78);
--line: rgba(148, 180, 220, 0.18);
--text: #edf6ff;
--muted: #8da2bd;
--cyan: #55e7ff;
--amber: #ffbd59;
--lime: #a7f36b;
--magenta: #e982ff;
}
* { 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;
}
body::before {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
z-index: 2;
opacity: 0.025;
background-image:
linear-gradient(rgba(255,255,255,.7) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,.7) 1px, transparent 1px);
background-size: 3px 3px;
}
#app {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active { cursor: grabbing; }
.hud {
position: fixed;
inset: 0;
z-index: 5;
pointer-events: none;
}
.brand {
position: absolute;
top: 30px;
left: 34px;
width: min(410px, calc(100vw - 68px));
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--cyan);
font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 28px;
height: 1px;
background: currentColor;
box-shadow: 0 0 12px currentColor;
}
h1 {
margin: 0;
max-width: 390px;
font-size: clamp(32px, 4.4vw, 66px);
font-weight: 580;
line-height: .96;
letter-spacing: -.055em;
}
.brand p {
max-width: 365px;
margin: 17px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.65;
}
.status {
position: absolute;
top: 31px;
right: 32px;
display: flex;
align-items: center;
gap: 10px;
padding: 10px 13px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(7, 13, 26, .66);
backdrop-filter: blur(12px);
color: #b8c9dc;
font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .13em;
text-transform: uppercase;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--lime);
box-shadow: 0 0 13px var(--lime);
animation: statusPulse 1.8s ease-in-out infinite;
}
@keyframes statusPulse {
50% { opacity: .35; transform: scale(.7); }
}
.rail {
position: absolute;
top: 50%;
right: 29px;
display: grid;
gap: 9px;
transform: translateY(-50%);
pointer-events: auto;
}
.rail button {
position: relative;
width: 42px;
height: 42px;
border: 1px solid var(--line);
border-radius: 4px;
color: #778da8;
background: rgba(8, 15, 29, .65);
font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
cursor: pointer;
transition: .2s ease;
backdrop-filter: blur(10px);
}
.rail button:hover,
.rail button.active {
color: var(--accent, var(--cyan));
border-color: var(--accent, var(--cyan));
background: rgba(20, 35, 53, .86);
box-shadow: 0 0 22px color-mix(in srgb, var(--accent, var(--cyan)) 14%, transparent);
}
.rail button span {
position: absolute;
right: 51px;
top: 50%;
width: max-content;
padding: 7px 9px;
border: 1px solid var(--line);
border-radius: 3px;
background: rgba(7, 13, 25, .92);
color: #b9c9da;
opacity: 0;
transform: translate(7px, -50%);
transition: .2s ease;
pointer-events: none;
}
.rail button:hover span {
opacity: 1;
transform: translate(0, -50%);
}
.toolbar-wrap {
position: absolute;
left: 50%;
bottom: 28px;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 9px;
pointer-events: auto;
}
.toolbar {
display: flex;
gap: 5px;
padding: 6px;
border: 1px solid var(--line);
border-radius: 7px;
background: rgba(8, 15, 29, .78);
box-shadow: 0 16px 50px rgba(0, 0, 0, .28);
backdrop-filter: blur(18px);
}
.toolbar button {
min-width: 40px;
height: 35px;
padding: 0 12px;
border: 1px solid transparent;
border-radius: 4px;
background: transparent;
color: #8298b4;
font: 650 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .08em;
text-transform: uppercase;
cursor: pointer;
transition: .2s ease;
}
.toolbar button:hover,
.toolbar button.active {
border-color: rgba(85, 231, 255, .35);
background: rgba(85, 231, 255, .08);
color: var(--cyan);
}
.toolbar button.tour.active {
color: var(--lime);
border-color: rgba(167, 243, 107, .35);
background: rgba(167, 243, 107, .08);
}
.hint {
color: #667b95;
font: 500 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .13em;
text-transform: uppercase;
text-shadow: 0 2px 10px #000;
}
.legend {
position: absolute;
left: 33px;
bottom: 29px;
display: grid;
gap: 8px;
color: #758aa4;
font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .13em;
text-transform: uppercase;
}
.legend div {
display: flex;
align-items: center;
gap: 9px;
}
.legend i {
display: inline-block;
width: 16px;
height: 2px;
background: var(--c);
box-shadow: 0 0 9px var(--c);
}
.world-label {
position: absolute;
left: 0;
top: 0;
min-width: 146px;
padding: 10px 12px 9px;
border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
border-left: 3px solid var(--accent);
border-radius: 3px;
background: rgba(6, 12, 25, .84);
color: #dce9f7;
box-shadow: 0 10px 35px rgba(0, 0, 0, .25);
backdrop-filter: blur(12px);
opacity: 0;
transition: opacity .2s ease, border-color .2s ease, background .2s ease;
pointer-events: auto;
cursor: pointer;
will-change: transform;
}
.world-label:hover {
background: rgba(14, 25, 42, .94);
border-color: var(--accent);
}
.world-label .number {
display: block;
margin-bottom: 4px;
color: var(--accent);
font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .15em;
}
.world-label strong {
display: block;
font-size: 11px;
font-weight: 700;
letter-spacing: .08em;
text-transform: uppercase;
}
.world-label small {
display: block;
margin-top: 4px;
color: #8297b0;
font: 500 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #050814;
transition: opacity .7s ease, visibility .7s ease;
}
.loading.hidden {
opacity: 0;
visibility: hidden;
}
.loader {
width: 180px;
text-align: center;
color: var(--cyan);
font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: .2em;
text-transform: uppercase;
}
.loader-track {
height: 2px;
margin-top: 14px;
overflow: hidden;
background: rgba(85, 231, 255, .14);
}
.loader-track::after {
content: "";
display: block;
width: 45%;
height: 100%;
background: var(--cyan);
box-shadow: 0 0 12px var(--cyan);
animation: load 1s ease-in-out infinite alternate;
}
@keyframes load {
from { transform: translateX(-100%); }
to { transform: translateX(225%); }
}
@media (max-width: 760px) {
.brand { top: 20px; left: 20px; }
.brand p { display: none; }
h1 { font-size: 38px; max-width: 280px; }
.status { display: none; }
.rail { right: 14px; }
.rail button { width: 36px; height: 36px; }
.legend { display: none; }
.toolbar-wrap { bottom: 15px; width: calc(100% - 20px); }
.toolbar { width: 100%; justify-content: center; overflow-x: auto; }
.toolbar button { min-width: 36px; padding: 0 8px; }
.hint { display: none; }
.world-label { min-width: 115px; padding: 8px; }
.world-label small { display: none; }
}
</style>
</head>
<body>
<div id="app"></div>
<div class="hud">
<header class="brand">
<div class="eyebrow">Voxel Systems / Exhibit 04</div>
<h1>Connected<br />Intelligence</h1>
<p>
A spatial story tracing data from silicon patterns to the devices
that bring them to life.
</p>
</header>
<div class="status">
<span class="status-dot"></span>
Live system map
</div>
<nav class="rail" aria-label="Exhibit stations">
<button data-station="0" style="--accent: var(--cyan)" aria-label="View wafer">
01<span>Wafer patterns</span>
</button>
<button data-station="1" style="--accent: var(--amber)" aria-label="View package">
02<span>Chip package</span>
</button>
<button data-station="2" style="--accent: var(--lime)" aria-label="View circuit board">
03<span>Circuit board</span>
</button>
<button data-station="3" style="--accent: var(--magenta)" aria-label="View device">
04<span>Device</span>
</button>
</nav>
<div class="legend">
<div><i style="--c: var(--cyan)"></i> Pattern layer</div>
<div><i style="--c: var(--amber)"></i> Package layer</div>
<div><i style="--c: var(--lime)"></i> Logic layer</div>
<div><i style="--c: var(--magenta)"></i> Product layer</div>
</div>
<div class="toolbar-wrap">
<div class="toolbar">
<button id="overview" class="active">Overview</button>
<button data-station="0">01</button>
<button data-station="1">02</button>
<button data-station="2">03</button>
<button data-station="3">04</button>
<button id="tour" class="tour">Auto tour</button>
</div>
<div class="hint">Drag to orbit · Shift-drag to pan · Scroll to zoom · Select a station</div>
</div>
</div>
<div class="loading" id="loading">
<div class="loader">
Building voxel exhibit
<div class="loader-track"></div>
</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer and scene
// -------------------------------------------------------------------------
const app = document.getElementById("app");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x050814);
scene.fog = new THREE.FogExp2(0x050814, 0.025);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
120
);
const renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: "high-performance" });
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
app.appendChild(renderer.domElement);
const world = new THREE.Group();
scene.add(world);
const hemi = new THREE.HemisphereLight(0x91c9ff, 0x101020, 1.55);
scene.add(hemi);
const key = new THREE.DirectionalLight(0xffffff, 2.4);
key.position.set(6, 15, 9);
key.castShadow = true;
key.shadow.mapSize.set(2048, 2048);
key.shadow.camera.left = -20;
key.shadow.camera.right = 20;
key.shadow.camera.top = 12;
key.shadow.camera.bottom = -12;
key.shadow.camera.far = 45;
key.shadow.bias = -0.0004;
scene.add(key);
const rim = new THREE.DirectionalLight(0x4ccfff, 1.3);
rim.position.set(-11, 7, -9);
scene.add(rim);
const warm = new THREE.PointLight(0xff9c45, 20, 18, 2);
warm.position.set(0, 5, 6);
scene.add(warm);
// -------------------------------------------------------------------------
// Materials and geometry helpers
// -------------------------------------------------------------------------
const C = {
cyan: 0x55e7ff,
amber: 0xffbd59,
lime: 0xa7f36b,
magenta: 0xe982ff,
white: 0xeaf5ff,
black: 0x080d16,
navy: 0x111b2b,
steel: 0x8ea4b9,
gold: 0xdba85a,
green: 0x174e3b,
screen: 0x061827
};
function standard(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.58,
metalness: 0.12,
...options
});
}
function emissive(color, intensity = 1.2, options = {}) {
return new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: intensity,
roughness: 0.4,
metalness: 0.05,
...options
});
}
function box(parent, size, position, material, outline = false) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(...size), material);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
if (outline) {
const edges = new THREE.EdgesGeometry(mesh.geometry);
const line = new THREE.LineSegments(
edges,
new THREE.LineBasicMaterial({
color: 0x9bb8d5,
transparent: true,
opacity: 0.25
})
);
mesh.add(line);
}
return mesh;
}
function cylinder(parent, radius, height, position, material, segments = 32) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, height, segments),
material
);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function groupAt(x, z = 0) {
const group = new THREE.Group();
group.position.set(x, 0, z);
world.add(group);
return group;
}
const darkBase = standard(0x0a1020, { roughness: 0.78, metalness: 0.28 });
const black = standard(C.black, { roughness: 0.45, metalness: 0.32 });
const steel = standard(C.steel, { roughness: 0.32, metalness: 0.82 });
const gold = standard(C.gold, { roughness: 0.26, metalness: 0.9 });
const cyanGlow = emissive(C.cyan, 1.8);
const amberGlow = emissive(C.amber, 1.5);
const limeGlow = emissive(C.lime, 1.4);
const magentaGlow = emissive(C.magenta, 1.6);
function stationBase(parent, width, depth, accentMaterial) {
box(parent, [width, 0.36, depth], [0, 0, 0], darkBase, true);
box(parent, [width - 0.16, 0.035, depth - 0.16], [0, 0.2, 0], standard(0x111c2c));
const corner = 0.32;
for (const sx of [-1, 1]) {
for (const sz of [-1, 1]) {
box(
parent,
[corner, 0.08, corner],
[sx * (width / 2 - 0.25), 0.26, sz * (depth / 2 - 0.25)],
accentMaterial
);
}
}
}
// -------------------------------------------------------------------------
// Floor
// -------------------------------------------------------------------------
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(70, 50),
standard(0x070b14, { roughness: 0.92, metalness: 0.08 })
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.39;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(60, 60, 0x173149, 0x102033);
grid.position.y = -0.365;
grid.material.transparent = true;
grid.material.opacity = 0.34;
scene.add(grid);
const tileGeo = new THREE.BoxGeometry(1.88, 0.07, 1.88);
const tileMat = standard(0xffffff, { roughness: 0.9, metalness: 0.12 });
const tileCountX = 23;
const tileCountZ = 17;
const tiles = new THREE.InstancedMesh(tileGeo, tileMat, tileCountX * tileCountZ);
const tileMatrix = new THREE.Matrix4();
const tileColor = new THREE.Color();
let tileIndex = 0;
for (let x = 0; x < tileCountX; x++) {
for (let z = 0; z < tileCountZ; z++) {
const px = (x - (tileCountX - 1) / 2) * 2;
const pz = (z - (tileCountZ - 1) / 2) * 2;
tileMatrix.makeTranslation(px, -0.34, pz);
tiles.setMatrixAt(tileIndex, tileMatrix);
const v = 0.018 + ((x * 7 + z * 3) % 5) * 0.004;
tileColor.setRGB(v * 0.55, v * 0.9, v * 1.25);
tiles.setColorAt(tileIndex, tileColor);
tileIndex++;
}
}
tiles.receiveShadow = true;
scene.add(tiles);
box(world, [25.5, 0.16, 6.6], [0, -0.18, 0], standard(0x0a1220, {
roughness: 0.72,
metalness: 0.25
}), true);
// -------------------------------------------------------------------------
// Exhibit stations
// -------------------------------------------------------------------------
const stations = [];
const labels = [];
const animated = [];
function addLabel(group, index, title, subtitle, color, anchor) {
const element = document.createElement("div");
element.className = "world-label";
element.style.setProperty("--accent", `#${color.toString(16).padStart(6, "0")}`);
element.innerHTML = `
<span class="number">STATION / 0${index + 1}</span>
<strong>${title}</strong>
<small>${subtitle}</small>
`;
element.addEventListener("click", () => focusStation(index));
document.querySelector(".hud").appendChild(element);
labels.push({
element,
anchor: new THREE.Vector3(...anchor),
group,
visible: true
});
}
// 01 — Wafer
const wafer = groupAt(-9, 0.3);
stations.push(wafer);
wafer.userData.station = 0;
stationBase(wafer, 5.2, 4.5, cyanGlow);
const waferGroup = new THREE.Group();
waferGroup.position.y = 1.35;
wafer.add(waferGroup);
const silicon = standard(0x152942, {
roughness: 0.24,
metalness: 0.83,
emissive: 0x071526,
emissiveIntensity: 0.4
});
cylinder(waferGroup, 2.15, 0.19, [0, 0, 0], silicon, 64);
cylinder(waferGroup, 0.24, 0.83, [0, -0.51, 0], steel, 24);
cylinder(waferGroup, 0.85, 0.12, [0, -0.93, 0], black, 32);
const dieMat = standard(0x193954, {
roughness: 0.4,
metalness: 0.65,
emissive: 0x082236,
emissiveIntensity: 0.5
});
const dieEdgeMat = standard(0x245578, {
roughness: 0.38,
metalness: 0.7
});
for (let ix = -5; ix <= 5; ix++) {
for (let iz = -5; iz <= 5; iz++) {
const x = ix * 0.37;
const z = iz * 0.37;
if (x * x + z * z > 3.78) continue;
const mat = (ix + iz) % 3 === 0 ? dieEdgeMat : dieMat;
box(waferGroup, [0.335, 0.018, 0.335], [x, 0.108, z], mat);
}
}
// Voxelized etched schematic paths across selected dies.
const traceMat = emissive(C.cyan, 1.25);
for (let ix = -4; ix <= 4; ix += 2) {
for (let iz = -4; iz <= 4; iz += 2) {
const x = ix * 0.37;
const z = iz * 0.37;
if (x * x + z * z > 3.3) continue;
box(waferGroup, [0.37, 0.025, 0.025], [x, 0.136, z], traceMat);
box(waferGroup, [0.025, 0.025, 0.37], [x + 0.17, 0.136, z], traceMat);
if ((ix + iz) % 3 === 0) {
box(waferGroup, [0.025, 0.025, 0.48], [x - 0.17, 0.136, z + 0.22], traceMat);
}
}
}
const scanBar = box(waferGroup, [4.05, 0.03, 0.07], [0, 0.18, 0], emissive(0xbaf7ff, 3.2));
animated.push((t) => {
scanBar.position.x = Math.sin(t * 1.25) * 1.85;
scanBar.material.emissiveIntensity = 2.4 + Math.sin(t * 7) * 0.7;
});
addLabel(wafer, 0, "Wafer Patterns", "Schematic silicon map", C.cyan, [0, 4.1, 0]);
// 02 — Chip package
const chip = groupAt(-3, -0.25);
stations.push(chip);
chip.userData.station = 1;
stationBase(chip, 4.8, 4.4, amberGlow);
box(chip, [2.5, 0.48, 2.5], [0, 0.67, 0], black, true);
box(chip, [2.66, 0.12, 2.66], [0, 0.44, 0], standard(0x192233, {
roughness: 0.5,
metalness: 0.55
}));
for (const side of [-1, 1]) {
for (let i = 0; i < 9; i++) {
const p = -1.0 + i * 0.25;
box(chip, [0.13, 0.08, 0.48], [p, 0.51, side * 1.42], gold);
box(chip, [0.48, 0.08, 0.13], [side * 1.42, 0.51, p], gold);
}
}
box(chip, [1.9, 0.13, 1.9], [0, 1.08, 0], standard(0x27364a, {
roughness: 0.32,
metalness: 0.68
}));
box(chip, [0.88, 0.12, 0.88], [0, 1.22, 0], emissive(C.amber, 1.55), true);
// Floating package lid and supports.
box(chip, [2.52, 0.18, 2.52], [0, 2.35, 0], steel, true);
box(chip, [2.3, 0.035, 2.3], [0, 2.24, 0], standard(0xb7c8d8, {
roughness: 0.18,
metalness: 0.95
}));
for (const sx of [-1, 1]) {
for (const sz of [-1, 1]) {
box(chip, [0.08, 1.0, 0.08], [sx * 1.02, 1.7, sz * 1.02], steel);
}
}
// Bond wires as stepped voxel traces.
for (const sx of [-1, 1]) {
for (const sz of [-1, 1]) {
box(chip, [0.42, 0.035, 0.035], [sx * 0.64, 1.34, sz * 0.45], gold);
box(chip, [0.035, 0.035, 0.42], [sx * 0.45, 1.34, sz * 0.64], gold);
}
}
const packageLight = box(chip, [0.12, 0.18, 0.12], [1.17, 1.55, 1.17], amberGlow);
animated.push((t) => {
packageLight.material.emissiveIntensity = 1.1 + Math.sin(t * 4.2) * 0.65;
packageLight.scale.y = 1 + Math.sin(t * 4.2) * 0.2;
});
addLabel(chip, 1, "Chip Package", "Bonded die and lid", C.amber, [0, 3.55, 0]);
// 03 — Circuit board
const board = groupAt(3, 0.4);
stations.push(board);
board.userData.station = 2;
stationBase(board, 5.1, 4.5, limeGlow);
const pcbMat = standard(C.green, {
roughness: 0.62,
metalness: 0.16,
emissive: 0x071b12,
emissiveIntensity: 0.35
});
box(board, [4.25, 0.2, 3.05], [0, 0.64, 0], pcbMat, true);
const boardGold = standard(0xbfa35c, {
roughness: 0.3,
metalness: 0.82,
emissive: 0x39250a,
emissiveIntensity: 0.28
});
const tracePaths = [
[[-1.85, .76, -1.1], [-.8, .76, -1.1], [-.8, .76, -.25], [.05, .76, -.25]],
[[-1.85, .76, 1.08], [-1.25, .76, 1.08], [-1.25, .76, .32], [-.3, .76, .32]],
[[.35, .76, -1.15], [1.05, .76, -1.15], [1.05, .76, -.65], [1.8, .76, -.65]],
[[.65, .76, 1.15], [1.65, .76, 1.15], [1.65, .76, .42], [1.95, .76, .42]],
[[-1.75, .76, .02], [-1.25, .76, .02], [-1.25, .76, -.72]],
[[.2, .76, .72], [.65, .76, .72], [.65, .76, 1.2], [1.25, .76, 1.2]]
];
for (const path of tracePaths) {
for (let i = 0; i < path.length - 1; i++) {
const a = path[i];
const b = path[i + 1];
const dx = b[0] - a[0];
const dz = b[2] - a[2];
box(
board,
[Math.abs(dx) || 0.035, 0.026, Math.abs(dz) || 0.035],
[(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2],
boardGold
);
}
}
box(board, [1.22, 0.3, 0.88], [-0.22, 0.9, -0.06], black, true);
box(board, [0.96, 0.035, 0.64], [-0.22, 1.07, -0.06], limeGlow);
box(board, [0.76, 0.52, 0.62], [1.2, 0.98, 0.42], standard(0x1a2635), true);
box(board, [0.56, 0.22, 0.44], [1.17, 1.35, 0.41], steel);
box(board, [0.55, 0.34, 0.72], [-1.35, 0.91, 0.83], standard(0x111925), true);
for (let i = 0; i < 7; i++) {
const x = -1.65 + i * 0.52;
box(board, [0.2, 0.13, 0.27], [x, 0.81, -1.05], i % 2 ? steel : black);
}
for (const p of [[-1.85, 1.25], [1.85, -1.25], [1.85, 1.25], [-1.85, -1.25]]) {
cylinder(board, 0.13, 0.07, [p[0], 0.79, p[1]], gold, 16);
}
const boardLEDs = [];
for (let i = 0; i < 6; i++) {
const led = box(board, [0.09, 0.08, 0.09], [-1.55 + i * 0.6, 0.84, 1.25], limeGlow.clone());
boardLEDs.push(led);
}
animated.push((t) => {
boardLEDs.forEach((led, i) => {
led.material.emissiveIntensity = 0.65 + Math.max(0, Math.sin(t * 3 - i * 0.72)) * 2.1;
});
});
addLabel(board, 2, "Circuit Board", "Logic and signal routing", C.lime, [0, 3.0, 0]);
// 04 — Device, shown as an exploded voxel phone
const device = groupAt(9, -0.35);
stations.push(device);
device.userData.station = 3;
stationBase(device, 5.8, 4.6, magentaGlow);
// Phone chassis and display.
box(device, [2.0, 4.15, 0.48], [-0.75, 2.55, 0], standard(0x151d2c, {
roughness: 0.32,
metalness: 0.72
}), true);
box(device, [1.78, 3.72, 0.07], [-0.75, 2.65, 0.275], standard(C.screen, {
roughness: 0.18,
metalness: 0.24,
emissive: 0x061826,
emissiveIntensity: 0.7
}), true);
// Pixel-style interface.
box(device, [1.2, 0.12, 0.035], [-0.88, 3.95, 0.325], magentaGlow);
box(device, [0.74, 0.08, 0.035], [-0.98, 3.62, 0.325], cyanGlow);
box(device, [0.46, 0.08, 0.035], [-0.77, 3.38, 0.325], cyanGlow);
box(device, [0.64, 0.68, 0.035], [-1.08, 2.58, 0.325], emissive(0x24627e, 0.7));
box(device, [0.42, 0.42, 0.035], [-0.46, 2.5, 0.325], emissive(C.amber, 0.6));
box(device, [1.18, 0.08, 0.035], [-0.82, 1.48, 0.325], limeGlow);
box(device, [0.08, 0.85, 0.035], [-1.58, 2.52, 0.325], magentaGlow);
// Exploded internal layers.
box(device, [1.02, 2.72, 0.2], [0.78, 1.78, -0.03], standard(0x30533a, {
roughness: 0.6,
metalness: 0.24
}), true);
box(device, [0.76, 2.36, 0.24], [1.9, 1.78, -0.08], standard(0x163a30, {
roughness: 0.55,
metalness: 0.2
}), true);
box(device, [0.5, 0.55, 0.18], [1.9, 2.35, -0.08], black, true);
box(device, [0.29, 0.34, 0.18], [1.9, 1.64, -0.08], limeGlow);
box(device, [0.7, 0.12, 0.18], [1.9, 1.08, -0.08], steel);
// Bright voxel connections between exploded layers.
for (const y of [1.08, 2.42, 3.48]) {
box(device, [0.25, 0.035, 0.035], [0.3, y, 0.08], magentaGlow);
box(device, [0.25, 0.035, 0.035], [1.32, y, 0.08], magentaGlow);
}
box(device, [0.4, 0.08, 0.12], [-0.75, 4.47, 0.28], black);
box(device, [0.1, 0.08, 0.1], [0.15, 2.55, 0.29], magentaGlow);
box(device, [0.1, 0.08, 0.1], [0.15, 2.15, 0.29], amberGlow);
const devicePixel = box(device, [0.22, 0.1, 0.04], [-1.33, 1.85, 0.33], magentaGlow.clone());
animated.push((t) => {
devicePixel.position.x = -1.32 + Math.sin(t * 1.8) * 0.12;
devicePixel.material.emissiveIntensity = 1.2 + Math.sin(t * 5) * 0.7;
});
addLabel(device, 3, "Connected Device", "Exploded product stack", C.magenta, [0.2, 4.9, 0]);
// -------------------------------------------------------------------------
// Data conduits between stations
// -------------------------------------------------------------------------
const connections = [];
function conduitSegment(parent, a, b, glowMaterial) {
const dx = b.x - a.x;
const dz = b.z - a.z;
const len = Math.hypot(dx, dz);
const center = a.clone().add(b).multiplyScalar(0.5);
const shell = box(
parent,
[Math.abs(dx) || 0.18, 0.13, Math.abs(dz) || 0.18],
[center.x, 0.08, center.z],
standard(0x111c2b, { metalness: 0.58, roughness: 0.48 })
);
shell.castShadow = false;
box(
parent,
[Math.abs(dx) || 0.055, 0.035, Math.abs(dz) || 0.055],
[center.x, 0.17, center.z],
glowMaterial
);
}
const stationMeta = [
{ x: -9, z: 0.3, half: 2.6, color: C.cyan },
{ x: -3, z: -0.25, half: 2.4, color: C.amber },
{ x: 3, z: 0.4, half: 2.55, color: C.lime },
{ x: 9, z: -0.35, half: 2.9, color: C.magenta }
];
for (let i = 0; i < stationMeta.length - 1; i++) {
const aMeta = stationMeta[i];
const bMeta = stationMeta[i + 1];
const a = new THREE.Vector3(aMeta.x + aMeta.half, 0.18, aMeta.z);
const b = new THREE.Vector3(bMeta.x - bMeta.half, 0.18, bMeta.z);
const midX = (a.x + b.x) / 2;
const points = [
a,
new THREE.Vector3(midX, 0.18, a.z),
new THREE.Vector3(midX, 0.18, b.z),
b
];
const color = new THREE.Color(aMeta.color).lerp(new THREE.Color(bMeta.color), 0.5);
const glow = emissive(color.getHex(), 1.7);
for (let j = 0; j < points.length - 1; j++) {
conduitSegment(world, points[j], points[j + 1], glow);
}
const packets = [];
for (let p = 0; p < 3; p++) {
const packet = box(world, [0.17, 0.17, 0.17], [0, 0.32, 0], emissive(bMeta.color, 3));
packets.push(packet);
}
connections.push({ points, packets });
}
// Central data spine.
box(world, [17.6, 0.035, 0.07], [0, 0.24, 3.35], emissive(0x235873, 0.65));
// -------------------------------------------------------------------------
// Atmospheric particles
// -------------------------------------------------------------------------
const particleCount = 320;
const positions = new Float32Array(particleCount * 3);
for (let i = 0; i < particleCount; i++) {
positions[i * 3] = (Math.random() - 0.5) * 38;
positions[i * 3 + 1] = Math.random() * 11;
positions[i * 3 + 2] = (Math.random() - 0.5) * 26;
}
const particleGeometry = new THREE.BufferGeometry();
particleGeometry.setAttribute("position", new THREE.BufferAttribute(positions, 3));
const particles = new THREE.Points(
particleGeometry,
new THREE.PointsMaterial({
color: 0x8ecfff,
size: 0.035,
transparent: true,
opacity: 0.48,
depthWrite: false
})
);
scene.add(particles);
// Floating voxel glyphs around the hall.
const floaters = [];
for (let i = 0; i < 18; i++) {
const color = [C.cyan, C.amber, C.lime, C.magenta][i % 4];
const floater = box(
world,
[0.12, 0.12, 0.12],
[
-14 + Math.random() * 28,
1.2 + Math.random() * 7,
-5 + Math.random() * 10
],
emissive(color, 1.25)
);
floaters.push({
mesh: floater,
baseY: floater.position.y,
phase: Math.random() * Math.PI * 2,
speed: 0.5 + Math.random() * 0.7
});
}
// -------------------------------------------------------------------------
// Manual camera controls
// -------------------------------------------------------------------------
const orbit = {
theta: 0.47,
phi: 1.03,
radius: 22,
target: new THREE.Vector3(0, 1.05, 0)
};
const desired = {
theta: orbit.theta,
phi: orbit.phi,
radius: orbit.radius,
target: orbit.target.clone()
};
let dragging = false;
let panning = false;
let lastX = 0;
let lastY = 0;
let pointerTravel = 0;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function setPointer(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
panning = event.button === 2 || event.shiftKey;
pointerTravel = 0;
lastX = event.clientX;
lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
stopTour();
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
pointerTravel += Math.abs(dx) + Math.abs(dy);
lastX = event.clientX;
lastY = event.clientY;
if (panning) {
const right = new THREE.Vector3();
const up = new THREE.Vector3();
camera.matrixWorld.extractBasis(right, up, new THREE.Vector3());
const scale = desired.radius * 0.00125;
desired.target.addScaledVector(right, -dx * scale);
desired.target.addScaledVector(up, dy * scale);
desired.target.x = THREE.MathUtils.clamp(desired.target.x, -14, 14);
desired.target.z = THREE.MathUtils.clamp(desired.target.z, -9, 9);
} else {
desired.theta -= dx * 0.0055;
desired.phi = THREE.MathUtils.clamp(desired.phi - dy * 0.0045, 0.32, 1.43);
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
dragging = false;
panning = false;
renderer.domElement.releasePointerCapture(event.pointerId);
if (pointerTravel < 6) {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(stations, true);
if (hits.length) {
let object = hits[0].object;
while (object && object.userData.station === undefined) object = object.parent;
if (object) focusStation(object.userData.station);
}
}
});
renderer.domElement.addEventListener("pointercancel", () => {
dragging = false;
panning = false;
});
renderer.domElement.addEventListener("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius * Math.exp(event.deltaY * 0.001),
6.5,
29
);
stopTour();
}, { passive: false });
// -------------------------------------------------------------------------
// UI navigation and focus transitions
// -------------------------------------------------------------------------
const stationButtons = [...document.querySelectorAll("[data-station]")];
const overviewButton = document.getElementById("overview");
const tourButton = document.getElementById("tour");
function setActiveStation(index) {
stationButtons.forEach((button) => {
button.classList.toggle(
"active",
button.dataset.station !== undefined &&
Number(button.dataset.station) === index
);
});
overviewButton.classList.toggle("active", index === null);
}
function focusStation(index) {
const group = stations[index];
desired.target.set(group.position.x, 1.5, group.position.z);
desired.radius = index === 3 ? 8.2 : 7.1;
desired.theta = [0.26, 0.52, 0.73, 0.92][index];
desired.phi = 1.02;
setActiveStation(index);
stopTour();
}
function overview() {
desired.target.set(0, 1.05, 0);
desired.radius = 22;
desired.theta = 0.47;
desired.phi = 1.03;
setActiveStation(null);
stopTour();
}
stationButtons.forEach((button) => {
button.addEventListener("click", () => focusStation(Number(button.dataset.station)));
});
overviewButton.addEventListener("click", overview);
let tourActive = false;
let tourIndex = 0;
let tourClock = 0;
function stopTour() {
tourActive = false;
tourButton.classList.remove("active");
}
tourButton.addEventListener("click", () => {
tourActive = !tourActive;
tourButton.classList.toggle("active", tourActive);
tourClock = 0;
if (tourActive) focusStation(tourIndex);
});
window.addEventListener("keydown", (event) => {
if (event.key >= "1" && event.key <= "4") {
focusStation(Number(event.key) - 1);
} else if (event.key === "0" || event.key.toLowerCase() === "o") {
overview();
} else if (event.code === "Space") {
event.preventDefault();
tourButton.click();
}
});
// -------------------------------------------------------------------------
// Path packet animation
// -------------------------------------------------------------------------
function samplePath(points, t) {
const lengths = [];
let total = 0;
for (let i = 0; i < points.length - 1; i++) {
const length = points[i].distanceTo(points[i + 1]);
lengths.push(length);
total += length;
}
let distance = ((t % 1) + 1) % 1 * total;
for (let i = 0; i < lengths.length; i++) {
if (distance <= lengths[i]) {
const alpha = lengths[i] === 0 ? 0 : distance / lengths[i];
return points[i].clone().lerp(points[i + 1], alpha);
}
distance -= lengths[i];
}
return points[points.length - 1].clone();
}
// -------------------------------------------------------------------------
// Resize and animation loop
// -------------------------------------------------------------------------
function resize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
const projected = new THREE.Vector3();
function updateLabels() {
for (const label of labels) {
projected.copy(label.anchor);
label.group.localToWorld(projected);
projected.project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
projected.x > -1.15 &&
projected.x < 1.15 &&
projected.y > -1.15 &&
projected.y < 1.15;
if (!visible) {
label.element.style.opacity = "0";
label.element.style.pointerEvents = "none";
continue;
}
const x = (projected.x * 0.5 + 0.5) * innerWidth;
const y = (-projected.y * 0.5 + 0.5) * innerHeight;
label.element.style.transform =
`translate3d(${x}px, ${y}px, 0) translate(-50%, -50%)`;
label.element.style.opacity = "1";
label.element.style.pointerEvents = "auto";
}
}
function animate() {
requestAnimationFrame(animate);
const t = clock.getElapsedTime();
const dt = Math.min(clock.getDelta(), 0.05);
// Smooth camera interpolation.
const ease = 1 - Math.pow(0.001, dt);
orbit.theta += (desired.theta - orbit.theta) * ease;
orbit.phi += (desired.phi - orbit.phi) * ease;
orbit.radius += (desired.radius - orbit.radius) * ease;
orbit.target.lerp(desired.target, ease);
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
// Traveling data packets.
connections.forEach((connection, connectionIndex) => {
connection.packets.forEach((packet, packetIndex) => {
const pathT = (t * (0.1 + packetIndex * 0.012) + packetIndex / 3 + connectionIndex * 0.08) % 1;
const point = samplePath(connection.points, pathT);
packet.position.copy(point);
packet.position.y = 0.31;
packet.rotation.y = t * 1.8 + packetIndex;
packet.rotation.x = t * 1.1;
});
});
animated.forEach((callback) => callback(t));
floaters.forEach((floater) => {
floater.mesh.position.y =
floater.baseY + Math.sin(t * floater.speed + floater.phase) * 0.22;
floater.mesh.rotation.x = t * 0.22 + floater.phase;
floater.mesh.rotation.y = t * 0.36;
});
particles.rotation.y = t * 0.012;
particles.position.y = Math.sin(t * 0.12) * 0.15;
if (tourActive) {
tourClock += dt;
if (tourClock > 4.8) {
tourClock = 0;
tourIndex = (tourIndex + 1) % stations.length;
focusStation(tourIndex);
tourActive = true;
tourButton.classList.add("active");
}
}
updateLabels();
renderer.render(scene, camera);
}
updateLabels();
animate();
requestAnimationFrame(() => {
document.getElementById("loading").classList.add("hidden");
});
</script>
</body>
</html>
```