Prompt specification
Build or customize the Three.js 3D scene "Identify the Process From Multiple Clues" 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: Identify the Process From Multiple Clues
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/identify-the-process-from-multiple-clues-x3812
Scene Description Prompt:
A low-poly planetary-geology puzzle using landforms, layering, and context, allowing uncertain formation mechanisms. One HTML file with Three.js from cdnjs.
Working Three.js Starter (identify-the-process-from-multiple-clues-x3812):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>STRATA — Planetary Geology Puzzle</title>
<style>
:root {
--bg: #071019;
--panel: rgba(10, 19, 28, 0.86);
--panel-solid: #0b1721;
--line: rgba(174, 208, 218, 0.17);
--line-bright: rgba(174, 208, 218, 0.34);
--text: #edf3ef;
--muted: #8fa5aa;
--cyan: #79d9d0;
--amber: #e9b96e;
--red: #e27c68;
--shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}
* { 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 {
background:
radial-gradient(circle at 50% 18%, rgba(53, 99, 113, 0.13), transparent 45%),
linear-gradient(180deg, #09131d, #050b11);
}
button, input { font: inherit; }
button { color: inherit; }
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
#scene:active { cursor: grabbing; }
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 2;
background:
linear-gradient(90deg, rgba(3, 8, 13, 0.35), transparent 26%, transparent 74%, rgba(3, 8, 13, 0.35)),
linear-gradient(180deg, rgba(3, 8, 13, 0.24), transparent 25%, transparent 74%, rgba(3, 8, 13, 0.38));
}
header {
position: fixed;
z-index: 20;
top: 0;
left: 0;
right: 0;
height: 74px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 22px;
border-bottom: 1px solid var(--line);
background: linear-gradient(180deg, rgba(5, 12, 18, 0.96), rgba(5, 12, 18, 0.72));
backdrop-filter: blur(16px);
}
.brand {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.brand-mark {
width: 34px;
height: 34px;
border: 1px solid var(--cyan);
border-radius: 50%;
position: relative;
box-shadow: inset 0 0 0 6px rgba(121, 217, 208, 0.06);
}
.brand-mark::before,
.brand-mark::after {
content: "";
position: absolute;
left: 7px;
right: 7px;
height: 1px;
background: var(--cyan);
transform: rotate(-18deg);
}
.brand-mark::before { top: 12px; }
.brand-mark::after { top: 20px; opacity: 0.48; }
.eyebrow {
color: var(--cyan);
font: 600 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 3px 0 0;
font-size: 21px;
line-height: 1;
letter-spacing: 0.16em;
font-weight: 740;
}
.mission {
margin-left: 20px;
padding-left: 20px;
border-left: 1px solid var(--line);
color: var(--muted);
font-size: 11px;
line-height: 1.5;
}
.mission strong {
display: block;
color: #d7e2df;
font-size: 12px;
font-weight: 600;
}
.header-actions {
display: flex;
align-items: center;
gap: 8px;
}
.icon-button,
.header-button {
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.035);
border-radius: 7px;
min-height: 34px;
padding: 0 12px;
cursor: pointer;
color: #c9d5d5;
font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: 150ms ease;
}
.icon-button:hover,
.header-button:hover {
border-color: var(--line-bright);
background: rgba(121, 217, 208, 0.08);
color: white;
}
.header-button.primary {
color: #071219;
border-color: var(--cyan);
background: var(--cyan);
}
.header-button.primary:hover { background: #9ce8e0; }
.panel {
position: fixed;
z-index: 15;
top: 92px;
bottom: 54px;
border: 1px solid var(--line);
border-radius: 12px;
background: var(--panel);
backdrop-filter: blur(18px);
box-shadow: var(--shadow);
overflow: hidden;
transition: transform 220ms ease, opacity 220ms ease;
}
#deck {
left: 18px;
width: 276px;
display: flex;
flex-direction: column;
}
#notebook {
right: 18px;
width: 330px;
padding: 18px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: rgba(121, 217, 208, 0.3) transparent;
}
.panel-heading {
padding: 17px 17px 12px;
border-bottom: 1px solid var(--line);
}
.panel-heading h2 {
margin: 5px 0 0;
font-size: 15px;
font-weight: 650;
letter-spacing: 0.02em;
}
.panel-intro {
margin: 10px 0 0;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
#cards {
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
overflow-y: auto;
}
.evidence-card {
--accent: #e9b96e;
position: relative;
display: grid;
grid-template-columns: 34px 1fr;
gap: 10px;
padding: 12px 12px 12px 10px;
border: 1px solid var(--line);
border-radius: 9px;
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
user-select: none;
transition: 150ms ease;
outline: none;
}
.evidence-card::before {
content: "";
position: absolute;
left: 0;
top: 10px;
bottom: 10px;
width: 2px;
border-radius: 3px;
background: var(--accent);
opacity: 0.55;
}
.evidence-card:hover,
.evidence-card:focus-visible {
border-color: rgba(255, 255, 255, 0.25);
background: rgba(255, 255, 255, 0.055);
transform: translateX(2px);
}
.evidence-card.selected {
border-color: color-mix(in srgb, var(--accent) 65%, transparent);
background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.evidence-card.placed { opacity: 0.68; }
.evidence-card.placed.selected { opacity: 1; }
.card-index {
color: var(--accent);
font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
padding-top: 2px;
}
.card-title {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
color: #edf3ef;
font-size: 12px;
font-weight: 650;
}
.card-subtitle {
color: var(--muted);
font-size: 10.5px;
line-height: 1.45;
margin-top: 5px;
}
.placed-badge {
flex: none;
border: 1px solid rgba(121, 217, 208, 0.35);
color: var(--cyan);
border-radius: 999px;
padding: 3px 5px;
font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.section-label {
display: flex;
align-items: center;
justify-content: space-between;
margin: 17px 0 9px;
color: #b5c7c7;
font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.section-label:first-child { margin-top: 0; }
.section-label span {
color: var(--muted);
font-size: 8px;
letter-spacing: 0.08em;
}
.context-box {
padding: 12px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.025);
}
.context-box p {
margin: 0;
color: #c7d4d3;
font-size: 11px;
line-height: 1.55;
}
.context-box .uncertainty {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--line);
color: #8fa5aa;
font-style: italic;
}
.mechanism-list {
display: grid;
gap: 7px;
}
.mechanism-option {
display: flex;
align-items: flex-start;
gap: 9px;
padding: 10px;
border: 1px solid var(--line);
border-radius: 8px;
cursor: pointer;
transition: 140ms ease;
}
.mechanism-option:hover {
border-color: var(--line-bright);
background: rgba(255, 255, 255, 0.025);
}
.mechanism-option:has(input:checked) {
border-color: rgba(121, 217, 208, 0.55);
background: rgba(121, 217, 208, 0.07);
}
.mechanism-option input {
accent-color: var(--cyan);
margin: 2px 0 0;
}
.mechanism-option b {
display: block;
font-size: 11px;
font-weight: 650;
}
.mechanism-option small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 9.5px;
line-height: 1.45;
}
.confidence-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 5px;
}
.confidence-button {
min-height: 40px;
border: 1px solid var(--line);
border-radius: 7px;
background: rgba(255, 255, 255, 0.025);
color: var(--muted);
cursor: pointer;
font: 650 8.5px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.confidence-button:hover:not(:disabled) {
color: white;
border-color: var(--line-bright);
}
.confidence-button.active {
color: var(--cyan);
border-color: rgba(121, 217, 208, 0.55);
background: rgba(121, 217, 208, 0.08);
}
.confidence-button:disabled { opacity: 0.35; cursor: default; }
.age-slots {
display: grid;
gap: 7px;
}
.age-slot {
min-height: 48px;
display: grid;
grid-template-columns: 34px 1fr 25px;
align-items: center;
border: 1px dashed rgba(174, 208, 218, 0.24);
border-radius: 8px;
overflow: hidden;
transition: 140ms ease;
}
.age-slot.filled {
border-style: solid;
border-color: var(--line-bright);
background: rgba(255, 255, 255, 0.025);
}
.age-slot.drag-over {
border-color: var(--cyan);
background: rgba(121, 217, 208, 0.08);
}
.slot-rank {
align-self: stretch;
display: grid;
place-items: center;
border-right: 1px solid var(--line);
color: var(--muted);
font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.slot-content {
min-width: 0;
border: 0;
background: transparent;
text-align: left;
height: 46px;
padding: 0 8px;
cursor: pointer;
}
.slot-content b {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 10.5px;
font-weight: 650;
}
.slot-content small {
display: block;
color: var(--muted);
margin-top: 3px;
font: 500 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.slot-remove {
border: 0;
background: transparent;
color: #6f858b;
cursor: pointer;
height: 30px;
width: 24px;
}
.slot-remove:hover { color: var(--red); }
.submit-button {
width: 100%;
min-height: 45px;
margin-top: 17px;
border: 1px solid var(--cyan);
border-radius: 8px;
background: var(--cyan);
color: #061218;
font: 750 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.12em;
text-transform: uppercase;
cursor: pointer;
transition: 140ms ease;
}
.submit-button:hover:not(:disabled) {
background: #a0eee7;
transform: translateY(-1px);
}
.submit-button:disabled {
opacity: 0.3;
cursor: default;
}
.notebook-status {
margin-top: 7px;
color: var(--muted);
font-size: 9px;
line-height: 1.45;
text-align: center;
}
#siteLabels {
position: fixed;
inset: 0;
z-index: 5;
pointer-events: none;
}
.site-label {
position: absolute;
transform: translate(-50%, -100%);
pointer-events: auto;
border: 1px solid rgba(174, 208, 218, 0.25);
border-radius: 6px;
padding: 6px 8px;
background: rgba(6, 13, 19, 0.84);
color: #cbd8d6;
cursor: pointer;
white-space: nowrap;
font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.1em;
text-transform: uppercase;
backdrop-filter: blur(8px);
transition: 140ms ease;
}
.site-label::after {
content: "";
position: absolute;
width: 1px;
height: 13px;
left: 50%;
top: 100%;
background: rgba(174, 208, 218, 0.4);
}
.site-label:hover,
.site-label.selected {
border-color: var(--accent);
color: white;
box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 18%, transparent);
}
#helpbar {
position: fixed;
z-index: 12;
left: 50%;
bottom: 13px;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 15px;
max-width: calc(100% - 36px);
padding: 9px 13px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(6, 13, 19, 0.78);
backdrop-filter: blur(12px);
color: #91a5aa;
font: 600 8.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.04em;
white-space: nowrap;
}
.key {
display: inline-grid;
place-items: center;
min-width: 19px;
height: 17px;
padding: 0 4px;
margin-right: 4px;
border: 1px solid var(--line-bright);
border-radius: 4px;
color: #c9d8d6;
}
#hintReadout {
position: fixed;
z-index: 11;
left: 312px;
bottom: 18px;
max-width: 330px;
padding: 10px 12px;
border-left: 2px solid var(--amber);
background: rgba(6, 13, 19, 0.72);
color: #b9c6c4;
font-size: 10px;
line-height: 1.45;
pointer-events: none;
opacity: 0;
transition: opacity 180ms ease;
}
#hintReadout.visible { opacity: 1; }
#toast {
position: fixed;
z-index: 50;
left: 50%;
top: 88px;
transform: translate(-50%, -8px);
max-width: 460px;
padding: 10px 14px;
border: 1px solid rgba(121, 217, 208, 0.35);
border-radius: 7px;
background: rgba(8, 19, 27, 0.94);
color: #dce7e4;
font-size: 11px;
box-shadow: var(--shadow);
opacity: 0;
pointer-events: none;
transition: 180ms ease;
}
#toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
#modalOverlay {
position: fixed;
inset: 0;
z-index: 60;
display: grid;
place-items: center;
padding: 24px;
background: rgba(2, 7, 11, 0.76);
backdrop-filter: blur(10px);
opacity: 0;
pointer-events: none;
transition: 180ms ease;
}
#modalOverlay.open {
opacity: 1;
pointer-events: auto;
}
.modal-card {
width: min(720px, 100%);
max-height: min(760px, 90vh);
overflow-y: auto;
border: 1px solid var(--line-bright);
border-radius: 14px;
background: #0a151e;
box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
padding: 25px;
transform: translateY(10px) scale(0.985);
transition: 180ms ease;
}
#modalOverlay.open .modal-card {
transform: translateY(0) scale(1);
}
.modal-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
.modal-card h2 {
margin: 6px 0 0;
font-size: 25px;
letter-spacing: -0.02em;
}
.modal-card p {
color: #a9b9b8;
font-size: 12px;
line-height: 1.65;
}
.close-button {
width: 32px;
height: 32px;
border: 1px solid var(--line);
border-radius: 7px;
background: rgba(255, 255, 255, 0.03);
color: var(--muted);
cursor: pointer;
}
.guide-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin: 20px 0;
}
.guide-item {
padding: 13px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.025);
}
.guide-item b {
display: block;
margin-bottom: 6px;
color: var(--cyan);
font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.guide-item span {
color: #a9b9b8;
font-size: 10.5px;
line-height: 1.5;
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 22px;
}
.score-layout {
display: grid;
grid-template-columns: 180px 1fr;
gap: 20px;
margin: 20px 0;
}
.score-box {
border: 1px solid rgba(121, 217, 208, 0.3);
border-radius: 10px;
padding: 18px;
background: rgba(121, 217, 208, 0.05);
}
.score-number {
display: block;
color: var(--cyan);
font: 750 42px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.score-max {
color: var(--muted);
font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.score-breakdown {
display: grid;
gap: 8px;
}
.score-line {
display: flex;
justify-content: space-between;
gap: 15px;
padding-bottom: 8px;
border-bottom: 1px solid var(--line);
color: var(--muted);
font-size: 11px;
}
.score-line b { color: #dce6e3; }
.result-row {
display: grid;
grid-template-columns: 1.1fr 1fr 1fr;
gap: 12px;
padding: 11px 0;
border-bottom: 1px solid var(--line);
font-size: 10.5px;
}
.result-row small {
display: block;
color: var(--muted);
margin-bottom: 3px;
font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.result-row .correct { color: var(--cyan); }
.result-row .wrong { color: var(--red); }
.explanation {
margin-top: 16px;
padding: 13px 15px;
border-left: 2px solid var(--amber);
background: rgba(233, 185, 110, 0.045);
color: #bdc8c5;
font-size: 11px;
line-height: 1.65;
}
.mobile-toggle { display: none; }
@media (max-width: 1050px) {
.mission { display: none; }
#deck { width: 235px; }
#notebook { width: 292px; }
#hintReadout { left: 270px; max-width: 270px; }
}
@media (max-width: 760px) {
header { height: 62px; padding: 0 12px; }
h1 { font-size: 17px; }
.brand-mark { width: 30px; height: 30px; }
.eyebrow { font-size: 7px; }
.header-button { display: none; }
.mobile-toggle { display: inline-block; }
.panel {
top: auto;
bottom: 48px;
max-height: 42vh;
width: calc(100% - 20px);
}
#deck { left: 10px; }
#notebook { right: 10px; }
#deck.mobile-hidden { transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; }
#notebook.mobile-hidden { transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; }
#cards { flex-direction: row; overflow-x: auto; }
.evidence-card { min-width: 220px; }
#hintReadout { display: none; }
#helpbar { font-size: 7px; gap: 7px; bottom: 8px; }
.help-extra { display: none; }
.guide-grid, .score-layout { grid-template-columns: 1fr; }
.result-row { grid-template-columns: 1fr; gap: 5px; }
.site-label { font-size: 7px; padding: 5px 6px; }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive low-poly planetary geology terrain"></canvas>
<div class="vignette"></div>
<div id="siteLabels"></div>
<header>
<div class="brand">
<div class="brand-mark" aria-hidden="true"></div>
<div>
<div class="eyebrow">Planetary archive / Nysa-3b</div>
<h1>STRATA</h1>
</div>
<div class="mission">
<strong>Reconstruct the geological history</strong>
Order four records, infer their mechanisms, and grade your confidence.
</div>
</div>
<div class="header-actions">
<button class="icon-button mobile-toggle" id="deckToggle" title="Toggle observations">OBS</button>
<button class="header-button" id="notesButton">Field notes</button>
<button class="header-button" id="hintButton">Hint</button>
<button class="header-button" id="resetButton">Reset</button>
<button class="header-button mobile-toggle" id="notesToggle" title="Toggle notebook">LOG</button>
</div>
</header>
<aside class="panel" id="deck">
<div class="panel-heading">
<div class="eyebrow">Evidence deck</div>
<h2>Field observations</h2>
<p class="panel-intro">Select an observation, then place it in the relative-age sequence. You may also drag a card onto a slot.</p>
</div>
<div id="cards"></div>
</aside>
<aside class="panel" id="notebook">
<div class="section-label">
Selected observation
<span id="selectedCode">OBS 01</span>
</div>
<div class="context-box" id="contextBox"></div>
<div class="section-label">
Formation mechanism
<span>Choose one</span>
</div>
<div class="mechanism-list" id="mechanismList"></div>
<div class="section-label">
Interpretive confidence
<span>Evidence strength</span>
</div>
<div class="confidence-row" id="confidenceList"></div>
<div class="section-label">
Relative age
<span>Oldest → youngest</span>
</div>
<div class="age-slots" id="ageSlots"></div>
<button class="submit-button" id="submitButton" disabled>Submit reconstruction</button>
<div class="notebook-status" id="submitStatus"></div>
</aside>
<div id="helpbar">
<span><span class="key">DRAG</span>Orbit</span>
<span><span class="key">WHEEL</span>Zoom</span>
<span class="help-extra"><span class="key">SHIFT</span>Pan</span>
<span class="help-extra"><span class="key">1–4</span>Select</span>
<span class="help-extra"><span class="key">H</span>Hint</span>
<span class="help-extra">Click a marker to inspect</span>
</div>
<div id="hintReadout"></div>
<div id="toast" role="status" aria-live="polite"></div>
<div id="modalOverlay">
<div class="modal-card" id="modalBody" role="dialog" aria-modal="true"></div>
</div>
<script type="module">
import * as THREE from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js';
/* --------------------------------------------------------------------------
Data and interface state
-------------------------------------------------------------------------- */
const $ = (selector) => document.querySelector(selector);
const evidence = {
layers: {
code: "OBS 01",
title: "Layered beds",
subtitle: "Parallel, continuous strata",
color: 0xe6b66f,
x: 37,
z: 18,
observation:
"Alternating beds remain parallel and continuous. The lowest exposed unit wraps around the block margin; no deformation is visible within it.",
uncertainty:
"Deposition is the strongest interpretation, but a low-relief evaporite sequence cannot be excluded without grain or crystal data.",
primary: "deposition",
alternatives: [],
options: [
{
value: "evaporite",
label: "Evaporite crystallization",
note: "Layering produced by mineral precipitation in a drying basin."
},
{
value: "deposition",
label: "Sedimentary deposition",
note: "Successive layers settled in a basin, lake, or other low-energy environment."
},
{
value: "ejecta",
label: "Impact ejecta deposition",
note: "Layered material accumulated around an impact structure."
}
]
},
fault: {
code: "OBS 02",
title: "Offset contact",
subtitle: "A break displaces matching beds",
color: 0xe27c68,
x: -18,
z: 12,
observation:
"Matching beds terminate against a steep planar break. The block on the northeast side stands slightly higher than its counterpart.",
uncertainty:
"The geometry favors tectonic displacement. An impact-generated fracture remains plausible, although no radial fracture set is preserved.",
primary: "tectonic",
alternatives: ["impactFracture"],
options: [
{
value: "impactFracture",
label: "Impact-induced fracturing",
note: "A major collision generated a fracture and local displacement."
},
{
value: "tectonic",
label: "Tectonic faulting",
note: "Crustal movement offset pre-existing sedimentary layers."
},
{
value: "slump",
label: "Slope failure",
note: "A gravity-driven mass movement produced the offset contact."
}
]
},
impact: {
code: "OBS 03",
title: "Circular hollow",
subtitle: "Bowl, raised rim, radial debris",
color: 0x8fc8e1,
x: -24,
z: -10,
observation:
"A roughly circular depression has a raised rim. A radial ejecta blanket thins outward and covers the nearby fault trace.",
uncertainty:
"The morphology strongly favors an impact, but a volcanic caldera is viable because no diagnostic metal fragments have been sampled.",
primary: "impact",
alternatives: ["caldera"],
options: [
{
value: "blast",
label: "Explosion excavation",
note: "A subsurface explosion formed a steep-walled excavation pit."
},
{
value: "caldera",
label: "Volcanic caldera",
note: "Collapse around a magma reservoir produced the circular depression."
},
{
value: "impact",
label: "Meteorite impact",
note: "A high-speed collision excavated the bowl and scattered ejecta."
}
]
},
channel: {
code: "OBS 04",
title: "Incised trough",
subtitle: "A sinuous cut crosses older relief",
color: 0x79d9d0,
x: 3,
z: 6,
observation:
"A narrow, sinuous trough cuts through the crater's eastern rim. Downslope, the trough opens into a low, spreading deposit.",
uncertainty:
"The branching form and sediment fan favor fluvial incision. A carved glacial trough is less consistent with the channel geometry, but remains a possible alternative.",
primary: "fluvial",
alternatives: ["glacial"],
options: [
{
value: "wind",
label: "Wind abrasion",
note: "Persistent wind erosion excavated and widened the trough."
},
{
value: "fluvial",
label: "Fluvial erosion",
note: "Flowing liquid cut the channel and transported sediment into a fan."
},
{
value: "glacial",
label: "Glacial carving",
note: "Moving ice eroded the trough and deposited material downslope."
}
]
}
};
const evidenceOrder = ["layers", "fault", "impact", "channel"];
const expectedOrder = ["layers", "fault", "impact", "channel"];
const confidenceOptions = [
{ value: "strong", label: "Strongly supported", points: 10 },
{ value: "probable", label: "Reasonably supported", points: 7 },
{ value: "uncertain", label: "Uncertain", points: 4 }
];
const state = {
selected: "layers",
order: [null, null, null, null],
mechanisms: {},
confidence: {},
hintLevel: 0
};
let toastTimer;
function toast(message) {
const element = $("#toast");
element.textContent = message;
element.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => element.classList.remove("show"), 2800);
}
function mechanismLabel(id, value) {
return evidence[id].options.find(option => option.value === value)?.label || "Not assigned";
}
function confidenceLabel(value) {
return confidenceOptions.find(option => option.value === value)?.label || "Not assigned";
}
function renderDeck() {
$("#cards").innerHTML = evidenceOrder.map((id, index) => {
const site = evidence[id];
const slot = state.order.indexOf(id);
const color = `#${new THREE.Color(site.color).getHexString()}`;
return `
<article class="evidence-card ${state.selected === id ? "selected" : ""} ${slot >= 0 ? "placed" : ""}"
style="--accent:${color}" data-id="${id}" draggable="true" tabindex="0" role="button">
<div class="card-index">0${index + 1}</div>
<div>
<div class="card-title">
<span>${site.title}</span>
${slot >= 0 ? `<span class="placed-badge">AGE ${slot + 1}</span>` : ""}
</div>
<div class="card-subtitle">${site.subtitle}</div>
</div>
</article>
`;
}).join("");
}
function renderNotebook() {
const id = state.selected;
const site = evidence[id];
const mechanism = state.mechanisms[id];
const confidence = state.confidence[id];
$("#selectedCode").textContent = site.code;
$("#contextBox").innerHTML = `
<p>${site.observation}</p>
<p class="uncertainty"><strong>Interpretive caveat:</strong> ${site.uncertainty}</p>
`;
$("#mechanismList").innerHTML = site.options.map(option => `
<label class="mechanism-option">
<input type="radio" name="mechanism" value="${option.value}" ${mechanism === option.value ? "checked" : ""}>
<span>
<b>${option.label}</b>
<small>${option.note}</small>
</span>
</label>
`).join("");
$("#confidenceList").innerHTML = confidenceOptions.map(option => `
<button class="confidence-button ${confidence === option.value ? "active" : ""}"
data-confidence="${option.value}" ${mechanism ? "" : "disabled"}>
${option.label}
</button>
`).join("");
const ageLabels = ["Oldest", "Second", "Third", "Youngest"];
$("#ageSlots").innerHTML = state.order.map((occupant, index) => {
const occupantSite = occupant ? evidence[occupant] : null;
return `
<div class="age-slot ${occupant ? "filled" : ""}" data-slot="${index}">
<div class="slot-rank">${index + 1}</div>
<button class="slot-content" data-slot="${index}" aria-label="Place observation in ${ageLabels[index]} slot">
<b>${occupantSite ? occupantSite.title : "Empty observation slot"}</b>
<small>${occupantSite ? occupantSite.subtitle : ageLabels[index]}</small>
</button>
${occupant ? `<button class="slot-remove" data-remove="${occupant}" title="Remove from sequence">×</button>` : `<span></span>`}
</div>
`;
}).join("");
const placedCount = state.order.filter(Boolean).length;
const mechanismCount = evidenceOrder.filter(key => state.mechanisms[key]).length;
const confidenceCount = evidenceOrder.filter(key => state.confidence[key]).length;
const complete = placedCount === 4 && mechanismCount === 4 && confidenceCount === 4;
$("#submitButton").disabled = !complete;
$("#submitStatus").textContent = complete
? "All records ready for evaluation."
: `${placedCount}/4 ordered · ${mechanismCount}/4 mechanisms · ${confidenceCount}/4 confidence ratings`;
}
function selectEvidence(id) {
if (!evidence[id]) return;
state.selected = id;
renderDeck();
renderNotebook();
updateMarkerHighlight();
}
function placeCard(id, slotIndex) {
const from = state.order.indexOf(id);
const displaced = state.order[slotIndex];
if (from >= 0) {
state.order[slotIndex] = id;
state.order[from] = displaced;
} else {
state.order[slotIndex] = id;
}
renderDeck();
renderNotebook();
}
function removeCard(id) {
const index = state.order.indexOf(id);
if (index >= 0) state.order[index] = null;
renderDeck();
renderNotebook();
}
$("#cards").addEventListener("click", event => {
const card = event.target.closest(".evidence-card");
if (card) selectEvidence(card.dataset.id);
});
$("#cards").addEventListener("keydown", event => {
if ((event.key === "Enter" || event.key === " ") && event.target.classList.contains("evidence-card")) {
event.preventDefault();
selectEvidence(event.target.dataset.id);
}
});
$("#cards").addEventListener("dragstart", event => {
const card = event.target.closest(".evidence-card");
if (!card) return;
event.dataTransfer.setData("text/plain", card.dataset.id);
event.dataTransfer.effectAllowed = "move";
selectEvidence(card.dataset.id);
});
$("#ageSlots").addEventListener("click", event => {
const remove = event.target.closest("[data-remove]");
if (remove) {
event.stopPropagation();
removeCard(remove.dataset.remove);
return;
}
const slot = event.target.closest("[data-slot]");
if (slot) placeCard(state.selected, Number(slot.dataset.slot));
});
$("#ageSlots").addEventListener("dragover", event => {
const slot = event.target.closest(".age-slot");
if (!slot) return;
event.preventDefault();
slot.classList.add("drag-over");
});
$("#ageSlots").addEventListener("dragleave", event => {
event.target.closest(".age-slot")?.classList.remove("drag-over");
});
$("#ageSlots").addEventListener("drop", event => {
event.preventDefault();
const slot = event.target.closest(".age-slot");
if (!slot) return;
const id = event.dataTransfer.getData("text/plain");
if (evidence[id]) placeCard(id, Number(slot.dataset.slot));
slot.classList.remove("drag-over");
});
$("#mechanismList").addEventListener("change", event => {
if (!event.target.matches("input[name=mechanism]")) return;
state.mechanisms[state.selected] = event.target.value;
renderNotebook();
});
$("#confidenceList").addEventListener("click", event => {
const button = event.target.closest("[data-confidence]");
if (!button || button.disabled) return;
state.confidence[state.selected] = button.dataset.confidence;
renderNotebook();
});
/* --------------------------------------------------------------------------
Three.js scene
-------------------------------------------------------------------------- */
const canvas = $("#scene");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 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;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071019);
scene.fog = new THREE.FogExp2(0x071019, 0.0065);
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
400
);
const controls = {
target: new THREE.Vector3(0, 2, 0),
theta: 0.76,
phi: 0.91,
radius: 112
};
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();
const hemi = new THREE.HemisphereLight(0xb9dcff, 0x342115, 1.9);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffdfaa, 3.2);
sun.position.set(-38, 68, 28);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -75;
sun.shadow.camera.right = 75;
sun.shadow.camera.top = 70;
sun.shadow.camera.bottom = -70;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 180;
sun.shadow.bias = -0.0006;
sun.shadow.normalBias = 0.035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x62a9d6, 1.15);
fill.position.set(45, 28, -50);
scene.add(fill);
const terrainGroup = new THREE.Group();
scene.add(terrainGroup);
const WORLD_W = 100;
const WORLD_D = 76;
const BOTTOM_Y = -12;
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
function smoothstep(min, max, value) {
const t = clamp((value - min) / (max - min), 0, 1);
return t * t * (3 - 2 * t);
}
function distanceToSegment(x, z, ax, az, bx, bz) {
const abx = bx - ax;
const abz = bz - az;
const t = clamp(((x - ax) * abx + (z - az) * abz) / (abx * abx + abz * abz), 0, 1);
const px = ax + abx * t;
const pz = az + abz * t;
return {
distance: Math.hypot(x - px, z - pz),
side: abx * (z - az) - abz * (x - ax)
};
}
function canyonCenter(z) {
return -10 + 16 * Math.sin((z + 8) * 0.09) + 1.2 * Math.sin(z * 0.23);
}
function heightAt(x, z) {
let height = 1.8;
height += Math.sin(x * 0.13 + 0.8) * Math.cos(z * 0.17) * 0.72;
height += Math.sin(x * 0.055 - z * 0.08 + 1.6) * 0.58;
// Mesa / resistant plateau on the east side.
const mesaDistance = Math.hypot(x - 27, z - 12);
const mesa = 1 - smoothstep(10.5, 16.5, mesaDistance);
height += 6.1 * mesa;
// Circular impact structure with depressed floor and raised rim.
const craterDistance = Math.hypot(x + 24, z + 10);
const craterBowl = 1 - smoothstep(2.5, 8.2, craterDistance);
const craterRim = Math.exp(-Math.pow((craterDistance - 9.4) / 2.25, 2));
height -= 4.5 * craterBowl;
height += 2.9 * craterRim;
height += 0.34 * Math.exp(-Math.pow(craterDistance / 19, 2));
// Sinuous channel incised from north to south.
const channelDistance = Math.abs(x - canyonCenter(z));
const channel = 1 - smoothstep(1.8, 5.8, channelDistance);
height -= 4.7 * channel;
// Small alluvial fan at the downstream end.
const fanDistance = Math.hypot(x - 11, z - 29);
const fan = Math.max(0, 1 - fanDistance / 13);
height += 2.4 * fan * fan;
// Fault scarp: a narrow groove with a small vertical step.
const fault = distanceToSegment(x, z, -42, -28, -4, 28);
const faultMask = Math.exp(-Math.pow(fault.distance / 1.15, 2));
height -= 0.75 * faultMask;
if (fault.side > 0) {
height += 0.9 * Math.exp(-Math.pow(fault.distance / 3.4, 2));
}
return height;
}
const terrainPositions = [];
const terrainColors = [];
const gridX = 50;
const gridZ = 38;
function terrainColor(x, z, height) {
const color = new THREE.Color();
const channelDistance = Math.abs(x - canyonCenter(z));
const craterDistance = Math.hypot(x + 24, z + 10);
const mesaDistance = Math.hypot(x - 27, z - 12);
const fault = distanceToSegment(x, z, -42, -28, -4, 28);
if (channelDistance < 2.4) {
color.set(0x536d69);
} else if (craterDistance < 7.7) {
color.set(0x66544a);
} else if (mesaDistance < 15.5) {
color.set(0xc29663);
} else if (fault.distance < 0.8) {
color.set(0x342e2d);
} else {
color.set(0x9b7654);
const variation = Math.sin(x * 0.37 + z * 0.23) * 0.035;
color.offsetHSL(variation, 0, variation * 0.45 + (height - 3) * 0.009);
}
const low = 1 - smoothstep(-2, 3, height);
color.lerp(new THREE.Color(0x4f6260), low * 0.48);
return color;
}
function pushTriangle(a, b, c, color) {
for (const point of [a, b, c]) {
terrainPositions.push(point[0], point[1], point[2]);
terrainColors.push(color.r, color.g, color.b);
}
}
for (let iz = 0; iz < gridZ; iz++) {
const z0 = -WORLD_D / 2 + (iz / gridZ) * WORLD_D;
const z1 = -WORLD_D / 2 + ((iz + 1) / gridZ) * WORLD_D;
for (let ix = 0; ix < gridX; ix++) {
const x0 = -WORLD_W / 2 + (ix / gridX) * WORLD_W;
const x1 = -WORLD_W / 2 + ((ix + 1) / gridX) * WORLD_W;
const p00 = [x0, heightAt(x0, z0), z0];
const p01 = [x0, heightAt(x0, z1), z1];
const p10 = [x1, heightAt(x1, z0), z0];
const p11 = [x1, heightAt(x1, z1), z1];
const first = terrainColor(
(x0 + x0 + x1) / 3,
(z0 + z1 + z0) / 3,
(p00[1] + p01[1] + p10[1]) / 3
);
const second = terrainColor(
(x1 + x0 + x1) / 3,
(z0 + z1 + z1) / 3,
(p10[1] + p01[1] + p11[1]) / 3
);
pushTriangle(p00, p01, p10, first);
pushTriangle(p10, p01, p11, second);
}
}
const terrainGeometry = new THREE.BufferGeometry();
terrainGeometry.setAttribute("position", new THREE.Float32BufferAttribute(terrainPositions, 3));
terrainGeometry.setAttribute("color", new THREE.Float32BufferAttribute(terrainColors, 3));
terrainGeometry.computeVertexNormals();
const terrainMaterial = new THREE.MeshStandardMaterial({
vertexColors: true,
roughness: 0.96,
metalness: 0.02,
flatShading: true
});
const terrain = new THREE.Mesh(terrainGeometry, terrainMaterial);
terrain.receiveShadow = true;
terrain.castShadow = true;
terrainGroup.add(terrain);
/* --------------------------------------------------------------------------
Exposed stratigraphic walls and section lines
-------------------------------------------------------------------------- */
const sidePositions = [];
const sideColors = [];
const strataColors = [
new THREE.Color(0x6c5544),
new THREE.Color(0xa77b57),
new THREE.Color(0x745947),
new THREE.Color(0xc09263),
new THREE.Color(0x80634d),
new THREE.Color(0xb18a64)
];
function addSideQuad(a, b, c, d, color) {
sidePositions.push(
...a, ...b, ...c,
...b, ...d, ...c
);
for (let i = 0; i < 6; i++) {
sideColors.push(color.r, color.g, color.b);
}
}
const edges = [
{ fixed: "z", value: -WORLD_D / 2, from: -WORLD_W / 2, to: WORLD_W / 2, count: 40 },
{ fixed: "x", value: WORLD_W / 2, from: -WORLD_D / 2, to: WORLD_D / 2, count: 30 },
{ fixed: "z", value: WORLD_D / 2, from: WORLD_W / 2, to: -WORLD_W / 2, count: 40 },
{ fixed: "x", value: -WORLD_W / 2, from: WORLD_D / 2, to: -WORLD_D / 2, count: 30 }
];
const boundaries = [BOTTOM_Y, -8, -4, 0, 4, 8];
for (const edge of edges) {
for (let i = 0; i < edge.count; i++) {
const a0 = edge.from + (edge.to - edge.from) * (i / edge.count);
const a1 = edge.from + (edge.to - edge.from) * ((i + 1) / edge.count);
const pointA = edge.fixed === "z"
? [a0, 0, edge.value]
: [edge.value, 0, a0];
const pointB = edge.fixed === "z"
? [a1, 0, edge.value]
: [edge.value, 0, a1];
const topA = heightAt(pointA[0], pointA[2]);
const topB = heightAt(pointB[0], pointB[2]);
for (let band = 0; band < boundaries.length; band++) {
const lower = boundaries[band];
const upper = band + 1 < boundaries.length ? boundaries[band + 1] : Math.max(upperSafe(topA, topB), lower + 0.5);
if (upper <= lower) continue;
const lowA = Math.min(lower, topA);
const lowB = Math.min(lower, topB);
const highA = Math.min(upper, topA);
const highB = Math.min(upper, topB);
if (highA <= lowA + 0.01 && highB <= lowB + 0.01) continue;
const a = [pointA[0], lowA, pointA[2]];
const b = [pointB[0], lowB, pointB[2]];
const c = [pointA[0], highA, pointA[2]];
const d = [pointB[0], highB, pointB[2]];
addSideQuad(a, b, c, d, strataColors[band % strataColors.length]);
}
}
}
function upperSafe(a, b) {
return Math.max(a, b);
}
const sideGeometry = new THREE.BufferGeometry();
sideGeometry.setAttribute("position", new THREE.Float32BufferAttribute(sidePositions, 3));
sideGeometry.setAttribute("color", new THREE.Float32BufferAttribute(sideColors, 3));
sideGeometry.computeVertexNormals();
const sideMaterial = new THREE.MeshStandardMaterial({
vertexColors: true,
roughness: 1,
metalness: 0,
flatShading: true,
side: THREE.DoubleSide
});
const sideWalls = new THREE.Mesh(sideGeometry, sideMaterial);
sideWalls.castShadow = true;
sideWalls.receiveShadow = true;
terrainGroup.add(sideWalls);
// Fine horizontal section traces make the layering easier to read.
const sectionPositions = [];
for (const edge of edges) {
for (let i = 0; i < edge.count; i++) {
const a0 = edge.from + (edge.to - edge.from) * (i / edge.count);
const a1 = edge.from + (edge.to - edge.from) * ((i + 1) / edge.count);
const pA = edge.fixed === "z"
? [a0, 0, edge.value]
: [edge.value, 0, a0];
const pB = edge.fixed === "z"
? [a1, 0, edge.value]
: [edge.value, 0, a1];
for (const boundary of [-8, -4, 0, 4, 8]) {
if (boundary < Math.min(heightAt(pA[0], pA[2]), heightAt(pB[0], pB[2])) - 0.08) {
sectionPositions.push(pA[0], boundary, pA[2], pB[0], boundary, pB[2]);
}
}
}
}
const sectionGeometry = new THREE.BufferGeometry();
sectionGeometry.setAttribute("position", new THREE.Float32BufferAttribute(sectionPositions, 3));
const sectionLines = new THREE.LineSegments(
sectionGeometry,
new THREE.LineBasicMaterial({ color: 0xd0aa78, transparent: true, opacity: 0.28 })
);
terrainGroup.add(sectionLines);
/* --------------------------------------------------------------------------
Geological surface details
-------------------------------------------------------------------------- */
// Dark fault ribbon.
const faultRibbonPositions = [];
const faultA = new THREE.Vector2(-42, -28);
const faultB = new THREE.Vector2(-4, 28);
for (let i = 0; i < 70; i++) {
const t0 = i / 70;
const t1 = (i + 1) / 70;
const p0 = faultA.clone().lerp(faultB, t0);
const p1 = faultA.clone().lerp(faultB, t1);
const dir = faultB.clone().sub(faultA).normalize();
const normal = new THREE.Vector2(-dir.y, dir.x).multiplyScalar(0.32);
const a = [p0.x + normal.x, heightAt(p0.x + normal.x, p0.y + normal.y) + 0.08, p0.y + normal.y];
const b = [p0.x - normal.x, heightAt(p0.x - normal.x, p0.y - normal.y) + 0.08, p0.y - normal.y];
const c = [p1.x + normal.x, heightAt(p1.x + normal.x, p1.y + normal.y) + 0.08, p1.y + normal.y];
const d = [p1.x - normal.x, heightAt(p1.x - normal.x, p1.y - normal.y) + 0.08, p1.y - normal.y];
faultRibbonPositions.push(...a, ...b, ...c, ...b, ...d, ...c);
}
const faultGeometry = new THREE.BufferGeometry();
faultGeometry.setAttribute("position", new THREE.Float32BufferAttribute(faultRibbonPositions, 3));
faultGeometry.computeVertexNormals();
const faultRibbon = new THREE.Mesh(
faultGeometry,
new THREE.MeshStandardMaterial({
color: 0x302724,
roughness: 1,
side: THREE.DoubleSide
})
);
terrainGroup.add(faultRibbon);
// A small layered outcrop near the resistant mesa.
const outcrop = new THREE.Group();
outcrop.position.set(37, heightAt(37, 18) + 0.1, 18);
outcrop.rotation.y = -0.17;
for (let i = 0; i < 8; i++) {
const layer = new THREE.Mesh(
new THREE.BoxGeometry(6.7 - i * 0.22, 0.48, 3.2 - i * 0.1),
new THREE.MeshStandardMaterial({
color: strataColors[i % strataColors.length],
roughness: 1,
flatShading: true
})
);
layer.position.y = 0.25 + i * 0.48;
layer.position.x = i * 0.045;
layer.castShadow = true;
layer.receiveShadow = true;
outcrop.add(layer);
}
terrainGroup.add(outcrop);
/* --------------------------------------------------------------------------
Rocks, dust, grid, and stars
-------------------------------------------------------------------------- */
let randomSeed = 74291;
function random() {
randomSeed = (randomSeed * 1664525 + 1013904223) >>> 0;
return randomSeed / 4294967296;
}
const rockGeometry = new THREE.DodecahedronGeometry(1, 0);
const rockMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.95,
flatShading: true
});
const rocks = new THREE.InstancedMesh(rockGeometry, rockMaterial, 95);
rocks.castShadow = true;
rocks.receiveShadow = true;
const dummy = new THREE.Object3D();
for (let i = 0; i < rocks.count; i++) {
let x;
let z;
if (i < 24) {
const angle = random() * Math.PI * 2;
const radius = 10 + random() * 9;
x = -24 + Math.cos(angle) * radius;
z = -10 + Math.sin(angle) * radius;
} else {
x = -47 + random() * 94;
z = -35 + random() * 70;
}
const scale = 0.28 + random() * 1.25;
dummy.position.set(x, heightAt(x, z) + scale * 0.43, z);
dummy.rotation.set(random() * 2, random() * Math.PI, random() * 2);
dummy.scale.set(scale * (0.7 + random() * 0.5), scale, scale * (0.7 + random() * 0.5));
dummy.updateMatrix();
rocks.setMatrixAt(i, dummy.matrix);
const tint = new THREE.Color().setHSL(0.075 + random() * 0.045, 0.22, 0.34 + random() * 0.16);
rocks.setColorAt(i, tint);
}
rocks.instanceMatrix.needsUpdate = true;
if (rocks.instanceColor) rocks.instanceColor.needsUpdate = true;
terrainGroup.add(rocks);
const dustPositions = [];
for (let i = 0; i < 340; i++) {
dustPositions.push(
(random() - 0.5) * 125,
3 + random() * 32,
(random() - 0.5) * 105
);
}
const dustGeometry = new THREE.BufferGeometry();
dustGeometry.setAttribute("position", new THREE.Float32BufferAttribute(dustPositions, 3));
const dust = new THREE.Points(
dustGeometry,
new THREE.PointsMaterial({
color: 0xe1c9a0,
size: 0.23,
transparent: true,
opacity: 0.34,
depthWrite: false
})
);
scene.add(dust);
const starPositions = [];
for (let i = 0; i < 260; i++) {
const theta = random() * Math.PI * 2;
const radius = 150 + random() * 80;
starPositions.push(
Math.cos(theta) * radius,
25 + random() * 115,
Math.sin(theta) * radius
);
}
const starGeometry = new THREE.BufferGeometry();
starGeometry.setAttribute("position", new THREE.Float32BufferAttribute(starPositions, 3));
scene.add(new THREE.Points(
starGeometry,
new THREE.PointsMaterial({
color: 0x9fc4cf,
size: 0.38,
transparent: true,
opacity: 0.52,
depthWrite: false
})
));
const basePlane = new THREE.Mesh(
new THREE.PlaneGeometry(260, 260),
new THREE.MeshStandardMaterial({ color: 0x071018, roughness: 1 })
);
basePlane.rotation.x = -Math.PI / 2;
basePlane.position.y = BOTTOM_Y - 0.25;
basePlane.receiveShadow = true;
scene.add(basePlane);
const grid = new THREE.GridHelper(220, 44, 0x36545b, 0x193138);
grid.position.y = BOTTOM_Y - 0.18;
grid.material.transparent = true;
grid.material.opacity = 0.22;
grid.material.depthWrite = false;
scene.add(grid);
/* --------------------------------------------------------------------------
Survey markers and projected HTML labels
-------------------------------------------------------------------------- */
const markerRecords = {};
const pickables = [];
for (const id of evidenceOrder) {
const site = evidence[id];
const group = new THREE.Group();
const ground = heightAt(site.x, site.z);
group.position.set(site.x, ground + 0.18, site.z);
const ringMaterial = new THREE.MeshBasicMaterial({
color: site.color,
transparent: true,
opacity: 0.9
});
const ring = new THREE.Mesh(new THREE.TorusGeometry(1.55, 0.12, 6, 24), ringMaterial);
ring.rotation.x = Math.PI / 2;
ring.position.y = 0.22;
group.add(ring);
const beaconMaterial = new THREE.MeshStandardMaterial({
color: site.color,
emissive: site.color,
emissiveIntensity: 0.72,
roughness: 0.45
});
const beacon = new THREE.Mesh(new THREE.CylinderGeometry(0.12, 0.18, 3.8, 6), beaconMaterial);
beacon.position.y = 2.0;
group.add(beacon);
const core = new THREE.Mesh(new THREE.OctahedronGeometry(0.48, 0), beaconMaterial);
core.position.y = 4.05;
group.add(core);
const hitArea = new THREE.Mesh(
new THREE.SphereGeometry(2.5, 10, 8),
new THREE.MeshBasicMaterial({ transparent: true, opacity: 0, depthWrite: false })
);
hitArea.position.y = 2;
group.add(hitArea);
group.traverse(object => {
if (object.isMesh) {
object.userData.siteId = id;
pickables.push(object);
}
});
terrainGroup.add(group);
const label = document.createElement("button");
label.className = "site-label";
label.textContent = site.title;
label.style.setProperty("--accent", `#${new THREE.Color(site.color).getHexString()}`);
label.addEventListener("click", () => selectEvidence(id));
$("#siteLabels").appendChild(label);
markerRecords[id] = {
group,
ring,
beacon,
core,
label,
anchor: new THREE.Vector3(site.x, ground + 5.2, site.z)
};
}
function updateMarkerHighlight() {
for (const id of evidenceOrder) {
const record = markerRecords[id];
const selected = state.selected === id;
record.ring.material.color.set(selected ? 0xffffff : evidence[id].color);
record.ring.material.opacity = selected ? 1 : 0.72;
record.label.classList.toggle("selected", selected);
record.group.scale.setScalar(selected ? 1.12 : 1);
}
}
/* --------------------------------------------------------------------------
Direct camera controls — no addons
-------------------------------------------------------------------------- */
const pointer = {
active: false,
moved: false,
button: 0,
x: 0,
y: 0,
lastX: 0,
lastY: 0
};
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("pointerdown", event => {
pointer.active = true;
pointer.moved = false;
pointer.button = event.button;
pointer.x = pointer.lastX = event.clientX;
pointer.y = pointer.lastY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!pointer.active) return;
const dx = event.clientX - pointer.lastX;
const dy = event.clientY - pointer.lastY;
if (Math.abs(event.clientX - pointer.x) + Math.abs(event.clientY - pointer.y) > 4) {
pointer.moved = true;
}
if (event.shiftKey || pointer.button === 2) {
const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
forward.y = 0;
forward.normalize();
const right = new THREE.Vector3().crossVectors(forward, camera.up).normalize();
const panScale = controls.radius * 0.00125;
controls.target.addScaledVector(right, -dx * panScale);
controls.target.addScaledVector(forward, -dy * panScale);
controls.target.x = clamp(controls.target.x, -55, 55);
controls.target.z = clamp(controls.target.z, -45, 45);
} else {
controls.theta -= dx * 0.006;
controls.phi = clamp(controls.phi - dy * 0.005, 0.33, 1.38);
}
pointer.lastX = event.clientX;
pointer.lastY = event.clientY;
updateCamera();
});
canvas.addEventListener("pointerup", event => {
if (pointer.active && !pointer.moved && event.button === 0) {
const bounds = canvas.getBoundingClientRect();
const mouse = new THREE.Vector2(
((event.clientX - bounds.left) / bounds.width) * 2 - 1,
-((event.clientY - bounds.top) / bounds.height) * 2 + 1
);
const raycaster = new THREE.Raycaster();
raycaster.setFromCamera(mouse, camera);
const hit = raycaster.intersectObjects(pickables, false)[0];
if (hit?.object.userData.siteId) {
selectEvidence(hit.object.userData.siteId);
}
}
pointer.active = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
});
canvas.addEventListener("pointercancel", () => {
pointer.active = false;
});
canvas.addEventListener("wheel", event => {
event.preventDefault();
controls.radius = clamp(controls.radius * Math.exp(event.deltaY * 0.001), 48, 155);
updateCamera();
}, { passive: false });
canvas.addEventListener("dblclick", () => {
controls.target.set(0, 2, 0);
controls.theta = 0.76;
controls.phi = 0.91;
controls.radius = 112;
updateCamera();
});
/* --------------------------------------------------------------------------
Scoring, hints, notes, and results
-------------------------------------------------------------------------- */
function evaluate() {
let sequenceScore = 0;
let mechanismScore = 0;
let confidenceScore = 0;
const rows = [];
state.order.forEach((id, index) => {
if (id === expectedOrder[index]) sequenceScore += 40;
});
for (const id of evidenceOrder) {
const site = evidence[id];
const selectedMechanism = state.mechanisms[id];
const selectedConfidence = state.confidence[id];
let mechanismPoints = 0;
let mechanismAccepted = false;
if (selectedMechanism === site.primary) {
mechanismPoints = 25;
mechanismAccepted = true;
} else if (site.alternatives.includes(selectedMechanism)) {
mechanismPoints = 15;
mechanismAccepted = true;
}
mechanismScore += mechanismPoints;
if (mechanismAccepted) {
const confidence = confidenceOptions.find(option => option.value === selectedConfidence);
confidenceScore += confidence?.points || 0;
}
const userSlot = state.order.indexOf(id);
const expectedSlot = expectedOrder.indexOf(id);
rows.push({
id,
userSlot,
expectedSlot,
selectedMechanism,
mechanismAccepted,
sequenceCorrect: userSlot === expectedSlot
});
}
const total = sequenceScore + mechanismScore + confidenceScore;
const grade = total >= 260
? "High-confidence reconstruction"
: total >= 190
? "Coherent field model"
: "Hypothesis needs revision";
const scoreMarkup = `
<div class="score-layout">
<div class="score-box">
<span class="score-number">${total}</span>
<span class="score-max">OUT OF 300</span>
</div>
<div class="score-breakdown">
<div class="score-line"><span>Relative sequence</span><b>${sequenceScore} / 160</b></div>
<div class="score-line"><span>Formation mechanisms</span><b>${mechanismScore} / 100</b></div>
<div class="score-line"><span>Confidence calibration</span><b>${confidenceScore} / 40</b></div>
</div>
</div>
`;
const rowMarkup = rows.map(row => {
const site = evidence[row.id];
const rank = row.userSlot >= 0 ? `${row.userSlot + 1}` : "—";
const expected = `${row.expectedSlot + 1}`;
return `
<div class="result-row">
<div>
<small>Observation</small>
${site.title}
</div>
<div>
<small>Your sequence</small>
<span class="${row.sequenceCorrect ? "correct" : "wrong"}">${rank} / expected ${expected}</span>
</div>
<div>
<small>Mechanism</small>
<span class="${row.mechanismAccepted ? "correct" : "wrong"}">
${mechanismLabel(row.id, row.selectedMechanism)}
</span>
</div>
</div>
`;
}).join("");
openModal(`
<div class="modal-top">
<div>
<div class="eyebrow">Archive evaluation</div>
<h2>${grade}</h2>
</div>
<button class="close-button" id="modalClose">×</button>
</div>
${scoreMarkup}
<div class="section-label">Evidence review <span>${confidenceLabel(state.confidence[state.selected])}</span></div>
${rowMarkup}
<div class="explanation">
<strong>Geological reasoning:</strong> The beds form the substrate. The fault offsets those beds but is itself covered by impact ejecta.
The channel then cuts the crater rim and feeds the younger fan. A scientifically cautious interpretation can accept a caldera
or glacial alternative when marked uncertain; the final reconstruction still has to respect the cross-cutting relationships.
</div>
<div class="modal-actions">
<button class="header-button" id="reviewButton">Review model</button>
<button class="header-button primary" id="newModelButton">New reconstruction</button>
</div>
`);
$("#reviewButton").addEventListener("click", closeModal);
$("#newModelButton").addEventListener("click", () => {
closeModal();
resetPuzzle();
});
}
function resetPuzzle() {
state.order = [null, null, null, null];
state.mechanisms = {};
state.confidence = {};
state.hintLevel = 0;
state.selected = "layers";
$("#hintReadout").classList.remove("visible");
renderDeck();
renderNotebook();
updateMarkerHighlight();
toast("Field model cleared. Begin with the most fundamental record.");
}
const hints = [
"Begin with the most fundamental record: the parallel beds must be older than the structure that displaces them.",
"The fault offsets the beds, but a radial ejecta blanket covers the fault trace. The fault therefore predates the impact.",
"The sinuous trough cuts the eastern rim of the circular hollow. Channel incision is the youngest event.",
"The horizontal beds are consistent with sediment settling. For the hollow, ejecta geometry supports impact more strongly than collapse, though uncertainty remains valid."
];
$("#hintButton").addEventListener("click", () => {
const index = Math.min(state.hintLevel, hints.length - 1);
const readout = $("#hintReadout");
readout.textContent = `FIELD HINT ${state.hintLevel + 1}: ${hints[index]}`;
readout.classList.add("visible");
state.hintLevel++;
toast("A field hint has been added to the lower-left display.");
});
function openModal(content) {
$("#modalBody").innerHTML = content;
$("#modalOverlay").classList.add("open");
$("#modalClose")?.addEventListener("click", closeModal);
}
function closeModal() {
$("#modalOverlay").classList.remove("open");
}
$("#modalOverlay").addEventListener("click", event => {
if (event.target === $("#modalOverlay")) closeModal();
});
$("#notesButton").addEventListener("click", () => {
openModal(`
<div class="modal-top">
<div>
<div class="eyebrow">Field manual / objective 04</div>
<h2>Read the landscape as a sequence</h2>
</div>
<button class="close-button" id="modalClose">×</button>
</div>
<p>
The survey block contains four linked records. Your task is to reconstruct their relative age and identify the process
that best explains each one. A mechanism does not need to be asserted with false certainty: alternatives can be
accepted when the evidence is genuinely ambiguous.
</p>
<div class="guide-grid">
<div class="guide-item">
<b>01 · Layering</b>
<span>Use superposition: a layer is younger than the layers it covers.</span>
</div>
<div class="guide-item">
<b>02 · Cross-cutting</b>
<span>A fault or channel is younger than the feature it cuts or displaces.</span>
</div>
<div class="guide-item">
<b>03 · Covering</b>
<span>Impact ejecta covering a fault means the collision happened afterward.</span>
</div>
</div>
<p>
Place all four observations in the age column, select a formation mechanism, then rate how strongly the contextual
evidence supports it. “Uncertain” is a valid scientific answer, not a failure state.
</p>
<div class="explanation">
<strong>Controls:</strong> drag to orbit, wheel to zoom, Shift-drag to pan, click a survey marker to inspect it.
Keyboard shortcuts: 1–4 select observations, H opens a hint, and Enter submits a complete model.
</div>
<div class="modal-actions">
<button class="header-button primary" id="beginButton">Begin survey</button>
</div>
`);
$("#beginButton").addEventListener("click", closeModal);
});
$("#submitButton").addEventListener("click", evaluate);
$("#resetButton").addEventListener("click", resetPuzzle);
$("#deckToggle").addEventListener("click", () => {
$("#deck").classList.toggle("mobile-hidden");
$("#notebook").classList.add("mobile-hidden");
});
$("#notesToggle").addEventListener("click", () => {
$("#notebook").classList.toggle("mobile-hidden");
$("#deck").classList.add("mobile-hidden");
});
document.addEventListener("keydown", event => {
if (event.target.matches("input, textarea, select")) return;
if (event.key >= "1" && event.key <= "4") {
selectEvidence(evidenceOrder[Number(event.key) - 1]);
}
if (event.key.toLowerCase() === "h") {
$("#hintButton").click();
}
if (event.key === "Enter" && !$("#submitButton").disabled) {
evaluate();
}
if (event.key === "Escape") closeModal();
});
/* --------------------------------------------------------------------------
Animation and projected labels
-------------------------------------------------------------------------- */
const projected = new THREE.Vector3();
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const id of evidenceOrder) {
const label = markerRecords[id].label;
projected.copy(markerRecords[id].anchor).project(camera);
const visible = projected.z > -1 && projected.z < 1;
label.style.display = visible ? "block" : "none";
if (visible) {
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
label.style.left = `${x}px`;
label.style.top = `${y}px`;
}
}
}
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
dust.rotation.y = elapsed * 0.012;
dust.position.y = Math.sin(elapsed * 0.18) * 0.35;
for (const id of evidenceOrder) {
const record = markerRecords[id];
const pulse = 1 + Math.sin(elapsed * 2.4 + evidenceOrder.indexOf(id)) * 0.055;
record.ring.scale.setScalar(pulse);
record.core.rotation.y = elapsed * 0.8;
record.core.rotation.x = elapsed * 0.43;
record.core.position.y = 4.05 + Math.sin(elapsed * 1.7 + evidenceOrder.indexOf(id)) * 0.15;
}
updateLabels();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
renderDeck();
renderNotebook();
updateMarkerHighlight();
animate();
</script>
</body>
</html>
```