Prompt specification
Build or customize the Three.js 3D scene "Observed Track and Two Possible Movers" 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: Observed Track and Two Possible Movers
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/observed-track-and-two-possible-movers-x3377
Scene Description Prompt:
Make a stylized Three.js scene in a self-contained HTML file using cdnjs: observed track and two possible movers. Place a visible track beside two objects capable of making similar marks. Separate the observed evidence from unconfirmed claims about which object caused it.
Working Three.js Starter (observed-track-and-two-possible-movers-x3377):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Track Evidence — Unresolved Attribution</title>
<style>
:root {
color-scheme: light;
--ink: #17252b;
--muted: #61727a;
--paper: rgba(249, 252, 252, 0.93);
--evidence: #157a9c;
--evidence-soft: #e5f4f8;
--hypothesis: #b56b00;
--hypothesis-soft: #fff2d8;
--candidate-a: #ec7437;
--candidate-b: #178e91;
--line: rgba(23, 37, 43, 0.13);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dbe5e8;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button { font: inherit; }
#app, #app canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
#app canvas {
touch-action: none;
cursor: grab;
}
#app canvas:active { cursor: grabbing; }
.overlay {
position: absolute;
inset: 0;
pointer-events: none;
}
.masthead {
position: absolute;
top: 22px;
left: 24px;
max-width: min(560px, calc(100vw - 48px));
display: flex;
align-items: flex-start;
gap: 14px;
padding: 15px 18px 16px;
border: 1px solid rgba(255,255,255,.72);
border-radius: 16px;
background: rgba(249, 252, 252, .88);
box-shadow: 0 12px 35px rgba(38, 57, 65, .13);
backdrop-filter: blur(12px);
}
.case-number {
flex: 0 0 auto;
display: grid;
place-items: center;
width: 48px;
height: 48px;
border-radius: 12px;
background: var(--ink);
color: white;
font-size: 13px;
font-weight: 800;
letter-spacing: .08em;
}
.eyebrow {
margin: 0 0 4px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: .16em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(19px, 2.3vw, 29px);
line-height: 1.08;
letter-spacing: -.035em;
}
.status {
display: inline-flex;
align-items: center;
gap: 7px;
margin-top: 9px;
padding: 5px 8px;
border-radius: 999px;
background: #f4eee3;
color: #765322;
font-size: 10px;
font-weight: 800;
letter-spacing: .07em;
text-transform: uppercase;
}
.status::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: #d59631;
box-shadow: 0 0 0 3px rgba(213,150,49,.15);
}
.controls {
position: absolute;
top: 22px;
right: 24px;
display: flex;
align-items: center;
gap: 8px;
pointer-events: auto;
}
.control-button {
border: 1px solid rgba(255,255,255,.8);
border-radius: 11px;
padding: 10px 13px;
color: var(--ink);
background: rgba(249,252,252,.9);
box-shadow: 0 8px 24px rgba(38,57,65,.1);
cursor: pointer;
backdrop-filter: blur(10px);
font-size: 12px;
font-weight: 750;
}
.control-button:hover {
background: white;
transform: translateY(-1px);
}
.help {
position: absolute;
top: 76px;
right: 24px;
max-width: 260px;
padding: 9px 12px;
border-radius: 10px;
background: rgba(249,252,252,.74);
color: #53666e;
font-size: 11px;
line-height: 1.45;
text-align: right;
backdrop-filter: blur(8px);
}
.panel {
position: absolute;
bottom: 22px;
width: min(365px, calc(50vw - 36px));
padding: 18px;
border: 1px solid rgba(255,255,255,.88);
border-radius: 17px;
background: var(--paper);
box-shadow: 0 16px 45px rgba(38,57,65,.15);
backdrop-filter: blur(14px);
pointer-events: auto;
overflow: auto;
}
.evidence-panel {
left: 24px;
border-top: 4px solid var(--evidence);
}
.hypothesis-panel {
right: 24px;
border-top: 4px solid var(--hypothesis);
}
.panel-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.panel-heading h2 {
margin: 0;
font-size: 16px;
letter-spacing: -.02em;
}
.panel-heading .tag {
flex: 0 0 auto;
border-radius: 999px;
padding: 5px 8px;
font-size: 9px;
font-weight: 850;
letter-spacing: .11em;
text-transform: uppercase;
}
.evidence-panel .tag {
color: var(--evidence);
background: var(--evidence-soft);
}
.hypothesis-panel .tag {
color: var(--hypothesis);
background: var(--hypothesis-soft);
}
.panel ul {
margin: 0;
padding: 0;
list-style: none;
}
.panel li {
position: relative;
margin: 0 0 9px;
padding-left: 17px;
color: #40545c;
font-size: 12px;
line-height: 1.45;
}
.panel li::before {
position: absolute;
top: .55em;
left: 1px;
width: 6px;
height: 6px;
border-radius: 50%;
content: "";
}
.evidence-panel li::before {
background: var(--evidence);
}
.hypothesis-panel li::before {
background: var(--hypothesis);
}
.boundary-note {
margin-top: 12px;
padding-top: 11px;
border-top: 1px solid var(--line);
color: #687980;
font-size: 10px;
line-height: 1.5;
}
.candidate {
width: 100%;
display: grid;
grid-template-columns: 31px 1fr auto;
align-items: center;
gap: 10px;
margin: 0 0 9px;
padding: 10px;
border: 1px solid rgba(181,107,0,.2);
border-radius: 11px;
background: rgba(255,255,255,.67);
color: var(--ink);
text-align: left;
cursor: pointer;
transition: border-color .16s, background .16s, transform .16s;
}
.candidate:hover {
transform: translateY(-1px);
border-color: rgba(181,107,0,.5);
background: white;
}
.candidate.active {
border-color: var(--candidate-color);
background: var(--hypothesis-soft);
box-shadow: inset 0 0 0 1px var(--candidate-color);
}
.candidate[data-candidate="a"] { --candidate-color: var(--candidate-a); }
.candidate[data-candidate="b"] { --candidate-color: var(--candidate-b); }
.candidate-swatch {
display: grid;
place-items: center;
width: 31px;
height: 31px;
border-radius: 8px;
background: var(--candidate-color);
color: white;
font-size: 12px;
font-weight: 900;
}
.candidate strong {
display: block;
margin-bottom: 2px;
font-size: 12px;
}
.candidate small {
display: block;
color: #6c777c;
font-size: 10px;
line-height: 1.35;
}
.candidate .inspect {
color: #96631b;
font-size: 9px;
font-weight: 850;
letter-spacing: .08em;
text-transform: uppercase;
}
#hypothesis-status {
min-height: 32px;
margin: 2px 0 10px;
color: #6d5a3b;
font-size: 10px;
line-height: 1.45;
}
.clear-button {
border: 0;
padding: 6px 0;
background: transparent;
color: #7a6748;
font-size: 10px;
font-weight: 800;
cursor: pointer;
}
.clear-button:hover { color: #3f2d12; }
#labels {
position: absolute;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.scene-label {
position: absolute;
display: none;
white-space: nowrap;
transform: translate(-50%, -112%);
padding: 8px 10px;
border-radius: 9px;
box-shadow: 0 7px 20px rgba(30,45,52,.14);
font-size: 9px;
font-weight: 850;
letter-spacing: .08em;
text-transform: uppercase;
}
.scene-label::after {
position: absolute;
top: 100%;
left: 50%;
width: 1px;
height: 17px;
background: currentColor;
content: "";
opacity: .55;
}
.scene-label.observed {
border: 1px solid rgba(21,122,156,.35);
background: rgba(235,248,251,.95);
color: var(--evidence);
}
.scene-label.candidate-a {
border: 1px solid rgba(236,116,55,.38);
background: rgba(255,244,232,.96);
color: #a34e1d;
}
.scene-label.candidate-b {
border: 1px solid rgba(23,142,145,.38);
background: rgba(232,249,248,.96);
color: #087477;
}
#loading {
position: absolute;
inset: 0;
display: grid;
place-items: center;
background: #dbe5e8;
color: #435860;
font-size: 13px;
font-weight: 700;
transition: opacity .35s;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.masthead {
top: 12px;
left: 12px;
right: 12px;
max-width: none;
padding: 12px;
}
.case-number {
width: 40px;
height: 40px;
}
.controls {
top: 102px;
right: 12px;
}
.help { display: none; }
.panel {
bottom: 12px;
width: calc(50vw - 18px);
max-height: 42vh;
padding: 13px;
}
.evidence-panel { left: 12px; }
.hypothesis-panel { right: 12px; }
.panel-heading {
align-items: flex-start;
flex-direction: column;
gap: 6px;
}
.panel li { font-size: 11px; }
.boundary-note { display: none; }
}
@media (max-width: 520px) {
.panel {
position: absolute;
width: calc(100vw - 24px);
max-height: 29vh;
}
.evidence-panel {
left: 12px;
bottom: calc(29vh + 22px);
}
.hypothesis-panel {
right: 12px;
bottom: 12px;
}
.panel-heading {
flex-direction: row;
}
.panel li:nth-of-type(n+3) { display: none; }
.scene-label { font-size: 8px; }
}
</style>
</head>
<body>
<main id="app" aria-label="Interactive Three.js evidence scene"></main>
<div class="overlay">
<header class="masthead">
<div class="case-number">07</div>
<div>
<p class="eyebrow">Observation bay / track review</p>
<h1>Evidence is visible. Attribution is unresolved.</h1>
<div class="status">No confirmed source</div>
</div>
</header>
<div class="controls">
<button id="reset-view" class="control-button" type="button">Reset view</button>
</div>
<div class="help">
Drag to orbit · Shift-drag or right-drag to pan · Scroll to zoom
</div>
<section class="panel evidence-panel" aria-labelledby="evidence-heading">
<div class="panel-heading">
<h2 id="evidence-heading">Observed evidence</h2>
<span class="tag">Recorded</span>
</div>
<ul>
<li>A paired scuff track is visible between markers E1 and E2.</li>
<li>Short transverse impressions occur at intervals along the track.</li>
<li>Both nearby movers have comparable broad twin wheels; wheel width is not diagnostic.</li>
</ul>
<div class="boundary-note">
These observations describe the visible track and nearby objects only. They do not identify the object that made the track.
</div>
</section>
<section class="panel hypothesis-panel" aria-labelledby="hypothesis-heading">
<div class="panel-heading">
<h2 id="hypothesis-heading">Unconfirmed claims</h2>
<span class="tag">Hypotheses</span>
</div>
<button class="candidate" data-candidate="a" type="button">
<span class="candidate-swatch">A</span>
<span>
<strong>Orange twin-wheel dolly</strong>
<small>Could make a similarly sized paired track.</small>
</span>
<span class="inspect">Inspect</span>
</button>
<button class="candidate" data-candidate="b" type="button">
<span class="candidate-swatch">B</span>
<span>
<strong>Teal twin-wheel dolly</strong>
<small>Could make a similarly sized paired track.</small>
</span>
<span class="inspect">Inspect</span>
</button>
<p id="hypothesis-status" aria-live="polite">
Neither mover is linked to the observed track by a unique feature.
</p>
<button id="clear-selection" class="clear-button" type="button">Clear inspection highlight</button>
<div class="boundary-note">
“Could have made” is a possibility, not a finding. Highlighting an object does not establish causation.
</div>
</section>
<div id="labels" aria-hidden="true">
<div id="label-evidence" class="scene-label observed">Observed · paired scuff track</div>
<div id="label-a" class="scene-label candidate-a">Unconfirmed · mover A</div>
<div id="label-b" class="scene-label candidate-b">Unconfirmed · mover B</div>
</div>
</div>
<div id="loading">Loading observation scene…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, scene, and camera
// -------------------------------------------------------------------------
const app = document.getElementById("app");
const loading = document.getElementById("loading");
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
app.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdbe5e8);
scene.fog = new THREE.Fog(0xdbe5e8, 18, 34);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
60
);
const controls = {
target: new THREE.Vector3(-0.25, 0.45, -0.15),
radius: 14.2,
theta: 0.68,
phi: 0.88
};
const defaultControls = {
target: controls.target.clone(),
radius: 14.2,
theta: 0.68,
phi: 0.88
};
function updateCamera() {
const sinPhi = Math.sin(controls.phi);
camera.position.set(
controls.target.x + controls.radius * sinPhi * Math.sin(controls.theta),
controls.target.y + controls.radius * Math.cos(controls.phi),
controls.target.z + controls.radius * sinPhi * Math.cos(controls.theta)
);
camera.lookAt(controls.target);
}
updateCamera();
// -------------------------------------------------------------------------
// Lighting
// -------------------------------------------------------------------------
scene.add(new THREE.HemisphereLight(0xf5fbff, 0x7c878e, 1.8));
const keyLight = new THREE.DirectionalLight(0xfff4df, 2.8);
keyLight.position.set(6, 10, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xc7e7ff, 1.05);
fillLight.position.set(-8, 5, 1);
scene.add(fillLight);
// -------------------------------------------------------------------------
// Materials and helper functions
// -------------------------------------------------------------------------
function standard(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.02,
...options
});
}
function addBox(parent, size, position, material, rotationY = 0) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
material
);
mesh.position.set(position[0], position[1], position[2]);
mesh.rotation.y = rotationY;
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addCylinder(
parent,
radiusTop,
radiusBottom,
height,
segments,
position,
material,
rotation = [0, 0, 0]
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
material
);
mesh.position.set(position[0], position[1], position[2]);
mesh.rotation.set(rotation[0], rotation[1], rotation[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addPlane(parent, size, position, material, rotationX = -Math.PI / 2) {
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(size[0], size[1]),
material
);
mesh.position.set(position[0], position[1], position[2]);
mesh.rotation.x = rotationX;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeCanvasTexture(width, height, draw) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const context = canvas.getContext("2d");
draw(context, width, height);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function roundRect(context, x, y, width, height, radius) {
const r = Math.min(radius, width / 2, height / 2);
context.beginPath();
context.moveTo(x + r, y);
context.arcTo(x + width, y, x + width, y + height, r);
context.arcTo(x + width, y + height, x, y + height, r);
context.arcTo(x, y + height, x, y, r);
context.arcTo(x, y, x + width, y, r);
context.closePath();
}
// -------------------------------------------------------------------------
// Observation bay
// -------------------------------------------------------------------------
const bay = new THREE.Group();
scene.add(bay);
const groundMaterial = standard(0xc9d1d2, { roughness: 0.96 });
addPlane(
bay,
[40, 40],
[0, -0.28, 0],
groundMaterial
);
const platformMaterial = standard(0xe6e1d7, { roughness: 0.92 });
addBox(
bay,
[15.4, 0.26, 12.2],
[0, -0.14, -0.15],
platformMaterial
);
const grid = new THREE.GridHelper(15, 30, 0x9da9ab, 0xb9c0bf);
grid.position.set(0, 0.005, -0.15);
grid.material.transparent = true;
grid.material.opacity = 0.19;
bay.add(grid);
const wallMaterial = standard(0xd2dcdf, { roughness: 0.9 });
addBox(bay, [15.4, 3.8, 0.22], [0, 1.78, -6.22], wallMaterial);
const wallInsetMaterial = standard(0xc5d0d3);
for (let x = -6; x <= 6; x += 2) {
addBox(
bay,
[0.06, 3.5, 0.08],
[x, 1.8, -6.07],
wallInsetMaterial
);
}
const safetyMaterial = standard(0xe6b949, { roughness: 0.82 });
addBox(bay, [15.1, 0.12, 0.06], [0, 0.06, -5.95], safetyMaterial);
addBox(bay, [15.1, 0.04, 0.07], [0, 0.22, -5.95], safetyMaterial);
const signTexture = makeCanvasTexture(1024, 384, (ctx, w, h) => {
ctx.fillStyle = "#20343b";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#e9bd4d";
ctx.fillRect(0, 0, 18, h);
ctx.fillRect(w - 18, 0, 18, h);
ctx.fillStyle = "#ffffff";
ctx.font = "800 84px system-ui, sans-serif";
ctx.fillText("TRACK 07", 90, 150);
ctx.fillStyle = "#b9c8cd";
ctx.font = "600 31px system-ui, sans-serif";
ctx.fillText("OBSERVATION BAY / ATTRIBUTION UNRESOLVED", 92, 225);
ctx.strokeStyle = "#50656d";
ctx.lineWidth = 3;
ctx.beginPath();
ctx.moveTo(92, 270);
ctx.lineTo(900, 270);
ctx.stroke();
});
const sign = new THREE.Mesh(
new THREE.PlaneGeometry(5.2, 1.95),
new THREE.MeshBasicMaterial({ map: signTexture })
);
sign.position.set(-0.4, 2.45, -6.04);
bay.add(sign);
// -------------------------------------------------------------------------
// Observed evidence: paired scuffs and transverse impressions
// -------------------------------------------------------------------------
const evidence = new THREE.Group();
evidence.position.x = -2.55;
bay.add(evidence);
const scuffMaterials = [
standard(0x353c3d, { roughness: 1 }),
standard(0x454b4b, { roughness: 1 }),
standard(0x2e3536, { roughness: 1 })
];
let seed = 7823;
function random() {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
}
for (let i = 0; i < 22; i++) {
const z = 4.05 - i * 0.38;
for (const side of [-1, 1]) {
const segmentLength = 0.24 + random() * 0.24;
const segment = addBox(
evidence,
[
0.055 + random() * 0.035,
0.012,
segmentLength
],
[
side * 0.31 + (random() - 0.5) * 0.035,
0.026 + random() * 0.003,
z + (random() - 0.5) * 0.07
],
scuffMaterials[i % scuffMaterials.length],
(random() - 0.5) * 0.035
);
segment.castShadow = false;
}
if (i % 2 === 0 || random() > 0.55) {
const impression = addBox(
evidence,
[
0.56 + random() * 0.12,
0.011,
0.025 + random() * 0.018
],
[
(random() - 0.5) * 0.05,
0.029,
z + 0.04
],
scuffMaterials[(i + 1) % scuffMaterials.length],
(random() - 0.5) * 0.06
);
impression.castShadow = false;
}
}
// Broad irregular scuff patch near the far end.
for (let i = 0; i < 8; i++) {
const patch = addBox(
evidence,
[
0.1 + random() * 0.17,
0.013,
0.18 + random() * 0.3
],
[
(random() - 0.5) * 0.65,
0.03,
-4.05 + (random() - 0.5) * 0.34
],
scuffMaterials[i % scuffMaterials.length],
(random() - 0.5) * 0.9
);
patch.castShadow = false;
}
// Yellow extent bracket, outside the observed marks.
const bracketMaterial = standard(0xe3b436, {
roughness: 0.72,
metalness: 0.03
});
addBox(evidence, [0.025, 0.014, 8.25], [-0.78, 0.025, -0.02], bracketMaterial);
addBox(evidence, [0.30, 0.014, 0.025], [-0.78, 0.025, 4.10], bracketMaterial);
addBox(evidence, [0.30, 0.014, 0.025], [-0.78, 0.025, -4.13], bracketMaterial);
function makeEvidenceMarker(label, z) {
const marker = new THREE.Group();
marker.position.set(-3.48, 0, z);
bay.add(marker);
const yellow = standard(0xf0c44f, { roughness: 0.8 });
addBox(marker, [0.48, 0.36, 0.06], [0, 0.19, 0], yellow);
addBox(marker, [0.48, 0.36, 0.06], [0, 0.19, -0.12], yellow, 0);
marker.children[1].rotation.x = -0.45;
const texture = makeCanvasTexture(256, 192, (ctx, w, h) => {
ctx.fillStyle = "#f2c752";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#24343a";
ctx.font = "900 108px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(label, w / 2, h / 2 + 3);
});
const plate = new THREE.Mesh(
new THREE.PlaneGeometry(0.42, 0.30),
new THREE.MeshBasicMaterial({ map: texture })
);
plate.position.set(0, 0.20, 0.035);
marker.add(plate);
}
makeEvidenceMarker("E1", 4.12);
makeEvidenceMarker("E2", -4.16);
// -------------------------------------------------------------------------
// Candidate movers
// -------------------------------------------------------------------------
const carts = {};
function makeCandidate(id, color, x, z) {
const group = new THREE.Group();
group.position.set(x, 0, z);
bay.add(group);
const bodyMaterial = standard(color, {
roughness: 0.62,
emissive: 0x000000,
emissiveIntensity: 0
});
const darkMaterial = standard(0x273034, { roughness: 0.9 });
const rubberMaterial = standard(0x151b1d, { roughness: 0.98 });
const hubMaterial = standard(0xaeb9ba, {
roughness: 0.42,
metalness: 0.65
});
const frameMaterial = standard(0x536269, {
roughness: 0.55,
metalness: 0.3,
emissive: 0x000000,
emissiveIntensity: 0
});
// Four broad wheels. Both candidates use the same general wheel profile.
for (const wheelX of [-0.72, 0.72]) {
for (const wheelZ of [-0.48, 0.48]) {
addCylinder(
group,
0.31,
0.31,
0.19,
24,
[wheelX, 0.33, wheelZ],
rubberMaterial,
[0, 0, Math.PI / 2]
);
addCylinder(
group,
0.125,
0.125,
0.205,
20,
[wheelX, 0.33, wheelZ],
hubMaterial,
[0, 0, Math.PI / 2]
);
}
}
addBox(group, [1.56, 0.16, 1.50], [0, 0.62, 0], frameMaterial);
addBox(group, [1.30, 0.95, 1.25], [0, 1.18, 0], bodyMaterial);
addBox(group, [1.39, 0.12, 1.34], [0, 1.69, 0], frameMaterial);
// Vertical corner guards.
for (const cornerX of [-0.64, 0.64]) {
for (const cornerZ of [-0.61, 0.61]) {
addBox(
group,
[0.07, 0.92, 0.07],
[cornerX, 1.18, cornerZ],
frameMaterial
);
}
}
// Rear handle.
addBox(group, [0.075, 1.12, 0.075], [-0.55, 1.94, -0.60], frameMaterial);
addBox(group, [0.075, 1.12, 0.075], [0.55, 1.94, -0.60], frameMaterial);
addBox(group, [1.18, 0.075, 0.075], [0, 2.48, -0.60], frameMaterial);
// Pale front label.
const labelTexture = makeCanvasTexture(256, 256, (ctx, w, h) => {
ctx.fillStyle = "#f5f0e7";
roundRect(ctx, 18, 18, w - 36, h - 36, 28);
ctx.fill();
ctx.fillStyle = `#${new THREE.Color(color).getHexString()}`;
ctx.fillRect(18, 18, 24, h - 36);
ctx.fillStyle = "#24343a";
ctx.font = "900 150px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(id, w / 2 + 8, h / 2 + 5);
});
const label = new THREE.Mesh(
new THREE.PlaneGeometry(0.53, 0.53),
new THREE.MeshBasicMaterial({
map: labelTexture,
transparent: true
})
);
label.position.set(0, 1.20, 0.636);
group.add(label);
// Neutral staging pad with a separately controllable frame.
const padMaterial = new THREE.MeshBasicMaterial({
color: 0x78929a,
transparent: true,
opacity: 0.075,
depthWrite: false
});
const padFrameMaterial = standard(0x9aa8ab, {
roughness: 0.82,
emissive: 0x000000,
emissiveIntensity: 0
});
addPlane(group, [2.18, 2.65], [0, 0.017, 0], padMaterial);
addBox(group, [2.18, 0.018, 0.025], [0, 0.028, -1.31], padFrameMaterial);
addBox(group, [2.18, 0.018, 0.025], [0, 0.028, 1.31], padFrameMaterial);
addBox(group, [0.025, 0.018, 2.65], [-1.08, 0.028, 0], padFrameMaterial);
addBox(group, [0.025, 0.018, 2.65], [1.08, 0.028, 0], padFrameMaterial);
group.userData = {
id,
bodyMaterial,
frameMaterial,
padFrameMaterial
};
carts[id] = group;
return group;
}
makeCandidate("A", 0xec7437, 1.05, 0.35);
makeCandidate("B", 0x178e91, 3.72, 0.35);
// -------------------------------------------------------------------------
// Inspection highlighting — clearly framed as hypothesis inspection
// -------------------------------------------------------------------------
let selectedCandidate = null;
const candidateButtons = [...document.querySelectorAll(".candidate")];
const hypothesisStatus = document.getElementById("hypothesis-status");
function selectCandidate(id) {
selectedCandidate = id;
for (const candidateId of ["A", "B"]) {
const cart = carts[candidateId];
const data = cart.userData;
const active = candidateId === id;
const baseColor = candidateId === "A" ? 0xec7437 : 0x178e91;
data.bodyMaterial.emissive.setHex(active ? baseColor : 0x000000);
data.bodyMaterial.emissiveIntensity = active ? 0.18 : 0;
data.frameMaterial.emissive.setHex(active ? baseColor : 0x000000);
data.frameMaterial.emissiveIntensity = active ? 0.16 : 0;
data.padFrameMaterial.emissive.setHex(active ? baseColor : 0x000000);
data.padFrameMaterial.emissiveIntensity = active ? 0.25 : 0;
}
for (const button of candidateButtons) {
button.classList.toggle("active", button.dataset.candidate === id);
}
if (id) {
hypothesisStatus.textContent =
`Inspecting ${id}: hypothesis only. No unique feature links this mover to the observed track.`;
} else {
hypothesisStatus.textContent =
"Neither mover is linked to the observed track by a unique feature.";
}
}
for (const button of candidateButtons) {
button.addEventListener("click", () => {
selectCandidate(button.dataset.candidate);
});
}
document.getElementById("clear-selection").addEventListener("click", () => {
selectCandidate(null);
});
// -------------------------------------------------------------------------
// Direct camera controls: orbit, pan, zoom, and reset
// -------------------------------------------------------------------------
const pointer = {
active: false,
id: null,
mode: "orbit",
lastX: 0,
lastY: 0
};
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
renderer.domElement.addEventListener("pointerdown", (event) => {
pointer.active = true;
pointer.id = event.pointerId;
pointer.mode =
event.button === 2 || event.shiftKey || event.ctrlKey ? "pan" : "orbit";
pointer.lastX = event.clientX;
pointer.lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointer.active || event.pointerId !== pointer.id) return;
const dx = event.clientX - pointer.lastX;
const dy = event.clientY - pointer.lastY;
pointer.lastX = event.clientX;
pointer.lastY = event.clientY;
if (pointer.mode === "orbit") {
controls.theta -= dx * 0.006;
controls.phi = THREE.MathUtils.clamp(
controls.phi - dy * 0.005,
0.3,
1.43
);
} else {
const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
const right = new THREE.Vector3()
.crossVectors(forward, camera.up)
.normalize();
const up = new THREE.Vector3()
.crossVectors(right, forward)
.normalize();
const panScale = controls.radius * 0.00135;
controls.target.addScaledVector(right, -dx * panScale);
controls.target.addScaledVector(up, dy * panScale);
controls.target.x = THREE.MathUtils.clamp(
controls.target.x, -6, 6
);
controls.target.y = THREE.MathUtils.clamp(
controls.target.y, -0.2, 2.2
);
controls.target.z = THREE.MathUtils.clamp(
controls.target.z, -5, 5
);
}
updateCamera();
});
function endPointer(event) {
if (event.pointerId !== pointer.id) return;
pointer.active = false;
pointer.id = null;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.radius = THREE.MathUtils.clamp(
controls.radius * Math.exp(event.deltaY * 0.001),
7.2,
22
);
updateCamera();
},
{ passive: false }
);
function resetView() {
controls.target.copy(defaultControls.target);
controls.radius = defaultControls.radius;
controls.theta = defaultControls.theta;
controls.phi = defaultControls.phi;
updateCamera();
}
document.getElementById("reset-view").addEventListener("click", resetView);
renderer.domElement.addEventListener("dblclick", resetView);
// -------------------------------------------------------------------------
// Screen-space labels, positioned manually without CSS2DRenderer
// -------------------------------------------------------------------------
const labels = [
{
element: document.getElementById("label-evidence"),
position: new THREE.Vector3(-2.55, 0.35, 2.25)
},
{
element: document.getElementById("label-a"),
position: new THREE.Vector3(1.05, 2.82, 0.35)
},
{
element: document.getElementById("label-b"),
position: new THREE.Vector3(3.72, 2.82, 0.35)
}
];
function updateLabels() {
const rect = renderer.domElement.getBoundingClientRect();
for (const label of labels) {
const projected = label.position.clone().project(camera);
const visible = projected.z > -1 && projected.z < 1;
label.element.style.display = visible ? "block" : "none";
if (visible) {
const x = (projected.x * 0.5 + 0.5) * rect.width;
const y = (-projected.y * 0.5 + 0.5) * rect.height;
label.element.style.left = `${x}px`;
label.element.style.top = `${y}px`;
}
}
}
// -------------------------------------------------------------------------
// Resize and render loop
// -------------------------------------------------------------------------
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
let firstFrame = true;
function animate() {
requestAnimationFrame(animate);
updateCamera();
updateLabels();
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 500);
}
}
animate();
</script>
</body>
</html>
```