Prompt specification
Build or customize the Three.js 3D scene "Knowledge Network Garden Metaphor" 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: Knowledge Network Garden Metaphor
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/knowledge-network-garden-metaphor-x3391
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts metaphors and the limits of literal correspondence. Create an original garden where connected plants symbolize related concepts. Label the mapping and distinguish symbolic links from actual botanical or neural connections. Voxel style.
Working Three.js Starter (knowledge-network-garden-metaphor-x3391):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>The Correspondence Garden</title>
<style>
:root {
--ink: #24342f;
--muted: #64736d;
--paper: #f5f2e9;
--paper-dark: #e9e4d7;
--line: #d8d1c2;
--symbolic: #d85f73;
--botanical: #2f9d68;
--neural: #29b9d1;
--selected: #7256b5;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background: var(--paper);
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
overflow: hidden;
}
button {
font: inherit;
}
#app {
display: grid;
grid-template-columns: 360px minmax(0, 1fr);
height: 100vh;
}
aside {
position: relative;
z-index: 10;
overflow-y: auto;
padding: 28px 24px 34px;
border-right: 1px solid var(--line);
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 280px),
var(--paper);
scrollbar-width: thin;
scrollbar-color: #b9b1a2 transparent;
}
.eyebrow {
margin: 0 0 8px;
color: var(--botanical);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 38px;
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
.lede {
margin: 16px 0 20px;
color: #52625b;
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
line-height: 1.45;
}
.section {
margin-top: 22px;
padding-top: 18px;
border-top: 1px solid var(--line);
}
.section-title {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin: 0 0 12px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.section-title small {
color: var(--muted);
font-size: 9px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: none;
}
#detail-card {
min-height: 184px;
padding: 16px;
border: 1px solid #d6cdbd;
border-radius: 12px;
background: rgba(255, 255, 255, 0.58);
box-shadow: 0 10px 28px rgba(64, 54, 38, 0.05);
}
#detail-card h2 {
margin: 4px 0 3px;
font-family: Georgia, "Times New Roman", serif;
font-size: 25px;
font-weight: 500;
}
#detail-card h3 {
margin: 0 0 10px;
color: var(--muted);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
#detail-card p {
margin: 9px 0;
color: #506058;
font-size: 12px;
line-height: 1.48;
}
#detail-card .limit {
padding-top: 9px;
border-top: 1px solid #e3dccf;
}
#detail-card .fact {
color: #287c56;
font-weight: 650;
}
.mapping-list {
display: grid;
gap: 6px;
}
.mapping-row {
display: grid;
grid-template-columns: 9px 1fr auto;
align-items: center;
gap: 10px;
width: 100%;
padding: 9px 10px;
border: 1px solid transparent;
border-radius: 9px;
background: transparent;
color: var(--ink);
text-align: left;
cursor: pointer;
transition:
background 150ms ease,
border-color 150ms ease,
transform 150ms ease;
}
.mapping-row:hover {
transform: translateX(2px);
background: rgba(255, 255, 255, 0.58);
}
.mapping-row.active {
border-color: #cfc5b3;
background: #fffdf8;
}
.mapping-row .swatch {
width: 8px;
height: 24px;
border-radius: 3px;
}
.mapping-row strong {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 15px;
font-weight: 600;
}
.mapping-row small {
display: block;
margin-top: 1px;
color: var(--muted);
font-size: 10px;
}
.family-badge {
padding: 4px 6px;
border: 1px solid #d4cebf;
border-radius: 99px;
color: #65736c;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.04em;
}
.path-key {
display: grid;
gap: 9px;
}
.path-button {
display: grid;
grid-template-columns: 44px 1fr;
align-items: center;
gap: 10px;
padding: 8px;
border: 1px solid transparent;
border-radius: 8px;
background: transparent;
color: var(--ink);
text-align: left;
cursor: pointer;
}
.path-button:hover {
background: rgba(255, 255, 255, 0.55);
}
.path-button[aria-pressed="false"] {
opacity: 0.42;
}
.sample {
position: relative;
display: block;
width: 42px;
height: 18px;
}
.sample::before {
position: absolute;
top: 8px;
left: 0;
width: 100%;
border-top: 2px solid currentColor;
content: "";
}
.sample.dashed::before {
border-top-style: dashed;
}
.sample.solid::before {
border-top-style: solid;
}
.sample.symbolic {
color: var(--symbolic);
}
.sample.botanical {
color: var(--botanical);
}
.sample.neural {
color: var(--neural);
}
.path-button strong {
display: block;
font-size: 11px;
}
.path-button small {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 10px;
line-height: 1.35;
}
.note {
padding: 13px 14px;
border-left: 3px solid var(--selected);
background: rgba(114, 86, 181, 0.07);
color: #59635e;
font-size: 11px;
line-height: 1.55;
}
.note strong {
color: var(--ink);
}
.limit-list {
margin: 0;
padding-left: 17px;
color: #607069;
font-size: 11px;
line-height: 1.55;
}
.limit-list li + li {
margin-top: 7px;
}
#stage {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
background: #dce9e0;
}
.webgl {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
cursor: grab;
}
.webgl.dragging {
cursor: grabbing;
}
#labels {
position: absolute;
inset: 0;
z-index: 3;
overflow: hidden;
pointer-events: none;
}
.stage-heading {
position: absolute;
z-index: 4;
top: 22px;
left: 24px;
max-width: 410px;
padding: 13px 15px;
border: 1px solid rgba(255, 255, 255, 0.64);
border-radius: 10px;
background: rgba(248, 250, 244, 0.72);
box-shadow: 0 12px 30px rgba(42, 62, 52, 0.09);
backdrop-filter: blur(10px);
pointer-events: none;
}
.stage-heading strong {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 18px;
font-weight: 500;
}
.stage-heading span {
display: block;
margin-top: 4px;
color: #607068;
font-size: 10px;
line-height: 1.45;
}
.stage-controls {
position: absolute;
z-index: 5;
right: 20px;
bottom: 20px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
}
.stage-controls button {
padding: 8px 11px;
border: 1px solid rgba(54, 73, 64, 0.18);
border-radius: 8px;
background: rgba(250, 251, 246, 0.86);
color: #45564e;
box-shadow: 0 6px 18px rgba(38, 55, 47, 0.08);
backdrop-filter: blur(8px);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.03em;
cursor: pointer;
}
.stage-controls button:hover {
background: #fffdf7;
transform: translateY(-1px);
}
.help {
position: absolute;
z-index: 4;
left: 20px;
bottom: 20px;
padding: 7px 10px;
border-radius: 7px;
background: rgba(248, 250, 244, 0.68);
color: #65736c;
font-size: 9px;
pointer-events: none;
}
.scene-label {
position: absolute;
z-index: 2;
display: block;
min-width: 68px;
padding: 5px 7px;
border: 1px solid rgba(48, 67, 58, 0.2);
border-radius: 6px;
background: rgba(255, 253, 246, 0.91);
box-shadow: 0 5px 12px rgba(32, 47, 40, 0.09);
color: var(--ink);
text-align: center;
white-space: nowrap;
pointer-events: auto;
transform: translate(-50%, -100%);
cursor: pointer;
transition:
background 120ms ease,
border-color 120ms ease,
transform 120ms ease;
}
.scene-label:hover,
.scene-label.active {
z-index: 3;
border-color: var(--selected);
background: #fffef9;
transform: translate(-50%, -100%) scale(1.04);
}
.label-concept {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 12px;
line-height: 1.05;
}
.label-plant {
display: block;
margin-top: 2px;
color: #738078;
font-size: 7px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.family-label {
position: absolute;
z-index: 1;
padding: 4px 7px;
border-radius: 5px;
background: rgba(237, 248, 237, 0.82);
color: #26734c;
font-size: 8px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
white-space: nowrap;
pointer-events: none;
transform: translate(-50%, -50%);
}
.network-label {
min-width: 0;
padding: 3px 5px;
border-color: rgba(41, 185, 209, 0.38);
background: rgba(244, 253, 254, 0.9);
color: #167c8c;
font-size: 8px;
font-weight: 750;
}
.well-label {
border-style: dashed;
border-color: rgba(114, 86, 181, 0.5);
background: rgba(247, 242, 255, 0.9);
color: #654ba3;
font-size: 8px;
font-weight: 850;
letter-spacing: 0.1em;
text-transform: uppercase;
pointer-events: none;
}
#loading {
position: absolute;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #dce9e0;
color: #53675e;
font-family: Georgia, "Times New Roman", serif;
font-size: 17px;
}
@media (max-width: 900px) {
body {
overflow: auto;
}
#app {
display: flex;
flex-direction: column;
height: auto;
}
#stage {
order: -1;
height: 62vh;
min-height: 490px;
}
aside {
overflow: visible;
border-right: 0;
border-top: 1px solid var(--line);
}
h1 {
max-width: 500px;
}
}
@media (max-width: 520px) {
aside {
padding: 23px 18px 30px;
}
.stage-heading {
top: 12px;
left: 12px;
max-width: calc(100% - 24px);
}
.stage-heading strong {
font-size: 15px;
}
.stage-controls {
right: 10px;
bottom: 10px;
max-width: 225px;
}
.help {
left: 10px;
bottom: 10px;
max-width: 115px;
line-height: 1.35;
}
.label-plant {
display: none;
}
.scene-label {
min-width: 54px;
padding: 4px 5px;
}
.label-concept {
font-size: 10px;
}
}
</style>
</head>
<body>
<div id="app">
<aside>
<p class="eyebrow">A taxonomy of metaphors</p>
<h1>The Correspondence Garden</h1>
<p class="lede">
A garden can make a metaphor look like a map. This one labels where the
metaphor ends: interpretive paths are dashed, empirical botanical
relations are green, and neural edges belong to an actual—but limited—model.
</p>
<section class="section">
<div class="section-title">
Selected correspondence
<small>click a plant or label</small>
</div>
<div id="detail-card"></div>
</section>
<section class="section">
<div class="section-title">
Mapping
<small>plant → concept</small>
</div>
<div id="mapping-list" class="mapping-list"></div>
</section>
<section class="section">
<div class="section-title">
Reading the paths
<small>click to toggle</small>
</div>
<div class="path-key">
<button class="path-button" data-layer="symbolic" aria-pressed="true">
<span class="sample dashed symbolic"></span>
<span>
<strong>Symbolic correspondence</strong>
<small>A chosen analogy. Dashed paths do not imply cause, biology, or consensus.</small>
</span>
</button>
<button class="path-button" data-layer="botanical" aria-pressed="true">
<span class="sample solid botanical"></span>
<span>
<strong>Botanical relation</strong>
<small>An empirical relation: shared family or a known plant–microbe symbiosis.</small>
</span>
</button>
<button class="path-button" data-layer="neural" aria-pressed="true">
<span class="sample solid neural"></span>
<span>
<strong>Neural model edge</strong>
<small>A real directed edge in the displayed toy network—not a map of brain anatomy.</small>
</span>
</button>
</div>
</section>
<section class="section">
<div class="section-title">Limits of correspondence</div>
<div class="note">
<strong>Green family spokes are taxonomic, not literal root grafts.</strong>
Plants in one family are related, but they are not necessarily directly
connected to one another. The clover–rhizobia link is a literal
biological partnership.
</div>
</section>
<section class="section">
<div class="section-title">Three cautions</div>
<ol class="limit-list">
<li>
A visual resemblance can suggest a concept without explaining it.
</li>
<li>
A relation can be real while the analogy attached to it remains
culturally contingent.
</li>
<li>
A network diagram records edges, not the full causal or embodied
story of thought.
</li>
</ol>
</section>
</aside>
<main id="stage" aria-label="Interactive voxel garden">
<div id="loading">Planting correspondences…</div>
<div id="labels"></div>
<div class="stage-heading">
<strong>The Correspondence Garden</strong>
<span>
Dashed coral = symbolic analogy · solid green = botanical relation ·
solid cyan = actual edge in the neural model
</span>
</div>
<div class="help">
Drag to orbit · wheel to zoom · shift-drag to pan · click to inspect
</div>
<div class="stage-controls">
<button id="reset-camera">Reset view</button>
<button data-layer="symbolic" aria-pressed="true">Symbolic paths</button>
<button data-layer="botanical" aria-pressed="true">Botanical relations</button>
<button data-layer="neural" aria-pressed="true">Neural edges</button>
</div>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const labelsRoot = document.getElementById("labels");
const detailCard = document.getElementById("detail-card");
const mappingList = document.getElementById("mapping-list");
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.className = "webgl";
renderer.domElement.setAttribute("aria-label", "Voxel garden scene");
stage.prepend(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdce9e0);
scene.fog = new THREE.Fog(0xdce9e0, 25, 54);
const camera = new THREE.PerspectiveCamera(
42,
stage.clientWidth / stage.clientHeight,
0.1,
100
);
const orbit = {
yaw: 0.73,
pitch: 0.53,
radius: 21,
target: new THREE.Vector3(0, 1.15, 0)
};
function updateCamera() {
const { yaw, pitch, radius, target } = orbit;
camera.position.set(
target.x + radius * Math.sin(yaw) * Math.cos(pitch),
target.y + radius * Math.sin(pitch),
target.z + radius * Math.cos(yaw) * Math.cos(pitch)
);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xf8fff7, 0x8c8069, 2.2);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff2cf, 3.2);
sun.position.set(-9, 16, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -17;
sun.shadow.camera.right = 17;
sun.shadow.camera.top = 16;
sun.shadow.camera.bottom = -16;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 42;
sun.shadow.bias = -0.0005;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xc8e8ff, 0.65);
fill.position.set(12, 7, -9);
scene.add(fill);
const groups = {
symbolic: new THREE.Group(),
botanical: new THREE.Group(),
neural: new THREE.Group()
};
Object.values(groups).forEach((group) => scene.add(group));
const layerState = {
symbolic: true,
botanical: true,
neural: true
};
const clickableMeshes = [];
const selectableGroups = [];
const labels = [];
const plantRecords = [];
const familyColors = {
Rosaceae: 0xd76a78,
Fabaceae: 0x70a84b,
Lamiaceae: 0x4b9d88,
Apiaceae: 0xe7a64b
};
const plantData = [
{
id: "apple",
plant: "Apple",
concept: "Nurture",
family: "Rosaceae",
pos: [-6.6, -2.6],
height: 3.25,
bridge:
"A fruit-bearing tree makes care visible: someone must plant, tend, and wait.",
limit:
"The tree does not literally create care. “Nurture” is a cultural reading projected onto it.",
fact:
"Botanical fact: cultivated apple, Malus domestica, belongs to the rose family, Rosaceae."
},
{
id: "rose",
plant: "Rose",
concept: "Belonging",
family: "Rosaceae",
pos: [-4.2, -2.7],
height: 2.05,
bridge:
"Repeated blooms and protective thorns turn a garden flower into an image of welcome and defense.",
limit:
"Belonging cannot be inferred from petals or thorns; the flower and the social idea only resemble one another.",
fact:
"Botanical fact: roses and apples share the family Rosaceae. That shared ancestry does not prove a shared meaning."
},
{
id: "strawberry",
plant: "Strawberry",
concept: "Small joys",
family: "Rosaceae",
pos: [-5.7, 0.1],
height: 1.18,
bridge:
"A low, hand-gathered fruit makes abundance available at a modest scale.",
limit:
"The size of a fruit does not measure the size or importance of a joy.",
fact:
"Botanical fact: strawberry is a Rosaceae member, despite its garden appearance."
},
{
id: "pea",
plant: "Pea",
concept: "Mutual aid",
family: "Fabaceae",
pos: [0.1, 2.8],
height: 2.65,
bridge:
"Climbing tendrils appear to seek neighboring stems for support.",
limit:
"“Mutual aid” is an interpretive metaphor here, not a moral property of the pea plant.",
fact:
"Botanical fact: pea is a legume in Fabaceae. Many legumes form real nitrogen-fixing partnerships with rhizobial bacteria."
},
{
id: "bean",
plant: "Bean",
concept: "Exchange",
family: "Fabaceae",
pos: [2.8, 2.6],
height: 2.42,
bridge:
"A vine uses a shared trellis, turning another object into the condition of its own growth.",
limit:
"Using a trellis is not proof of reciprocity, bargain, or social exchange.",
fact:
"Botanical fact: bean belongs to Fabaceae. The family relation is empirical; the concept is not."
},
{
id: "clover",
plant: "Clover",
concept: "Reciprocity",
family: "Fabaceae",
pos: [1.0, 5.0],
height: 0.98,
bridge:
"Legume roots partner with rhizobia: here, “cooperation” has an unusually literal biological anchor.",
limit:
"The real partnership is plant–microbe, not a moral contract among plants or people.",
fact:
"Botanical fact: clover root nodules house rhizobial bacteria that fix atmospheric nitrogen."
},
{
id: "mint",
plant: "Mint",
concept: "Vigilance",
family: "Lamiaceae",
pos: [4.6, -3.4],
height: 1.9,
bridge:
"Mint spreads vigorously and quickly occupies disturbed ground, suggesting watchfulness.",
limit:
"Invasiveness and vigilance are not equivalent; one is ecological, the other psychological.",
fact:
"Botanical fact: mint belongs to Lamiaceae."
},
{
id: "sage",
plant: "Sage",
concept: "Prudence",
family: "Lamiaceae",
pos: [6.8, -3.3],
height: 2.08,
bridge:
"The plant’s traditional name and apothecary associations have made it a cultural emblem of wisdom.",
limit:
"Any connection to prudence comes from lore and custom, not from its taxonomic position.",
fact:
"Botanical fact: sage is a member of Lamiaceae. A family label cannot confer wisdom."
},
{
id: "basil",
plant: "Basil",
concept: "Hospitality",
family: "Lamiaceae",
pos: [5.7, -1.0],
height: 1.75,
bridge:
"A plant shared at meals and thresholds becomes a small vessel of welcome.",
limit:
"Custom gives basil its meaning; chemistry does not make a plant hospitable.",
fact:
"Botanical fact: basil, like mint and sage, belongs to Lamiaceae."
},
{
id: "hemlock",
plant: "Hemlock",
concept: "Caution",
family: "Apiaceae",
pos: [-6.1, 5.6],
height: 2.85,
bridge:
"Hemlock carries a long cultural history as an emblem of danger and a warning against overconfidence.",
limit:
"Its toxicity is empirical. Turning that fact into a moral symbol is still an interpretation.",
fact:
"Botanical fact: hemlock contains toxic alkaloids and belongs to the carrot family, Apiaceae."
},
{
id: "parsley",
plant: "Parsley",
concept: "Boundary",
family: "Apiaceae",
pos: [-3.3, 5.5],
height: 1.42,
bridge:
"A dense tuft can be imagined as a living edge, marking where one patch ends and another begins.",
limit:
"This is a visual analogy. Dense foliage does not literally establish a social boundary.",
fact:
"Botanical fact: parsley belongs to Apiaceae, alongside carrot and hemlock."
},
{
id: "carrot",
plant: "Carrot",
concept: "Preservation",
family: "Apiaceae",
pos: [-0.7, 5.6],
height: 1.58,
bridge:
"A storage root keeps nourishment available through time, making preservation tangible.",
limit:
"Storing food does not by itself explain cultural preservation, memory, or institutions.",
fact:
"Botanical fact: carrot is a root vegetable in Apiaceae."
}
];
const symbolicLinks = [
["apple", "rose", 3.0, "Care can become belonging."],
["rose", "strawberry", 2.7, "Belonging can shelter small pleasures."],
["pea", "bean", 3.4, "Support and exchange are symbolically paired."],
["bean", "clover", 3.0, "Exchange and reciprocity are conceptually adjacent."],
["clover", "pea", 2.7, "Reciprocity returns to mutual aid."],
["mint", "sage", 3.1, "Vigilance and prudence are symbolically paired."],
["sage", "basil", 2.8, "Prudence and hospitality can overlap."],
["basil", "mint", 2.6, "Hospitality can also become vigilance."],
["hemlock", "parsley", 3.2, "Danger is imagined as a boundary."],
["parsley", "carrot", 2.9, "Boundary becomes preservation."],
["carrot", "hemlock", 2.7, "Preservation can become caution."],
["apple", "pea", 5.0, "Nurture and mutual aid are cross-linked metaphors."],
["clover", "basil", 4.8, "Reciprocity and hospitality cross family and metaphor."],
["carrot", "sage", 5.1, "Preservation and prudence cross family and metaphor."],
["strawberry", "mint", 4.7, "Small joys and vigilance cross family and metaphor."]
];
function makeMaterial(color, baseIntensity = 0, options = {}) {
const material = new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
flatShading: true,
emissive: new THREE.Color(color),
emissiveIntensity: baseIntensity,
...options
});
material.userData.baseIntensity = baseIntensity;
return material;
}
function addBox(parent, size, position, material, castShadow = true) {
const geometry = new THREE.BoxGeometry(...size);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(...position);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeLine(points, material, parent) {
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.Line(geometry, material);
if (material.isLineDashedMaterial) line.computeLineDistances();
parent.add(line);
return line;
}
function curveBetween(start, end, height, segments = 36) {
const midpoint = start.clone().lerp(end, 0.5);
midpoint.y = height;
const first = start.clone().lerp(end, 0.28);
const second = start.clone().lerp(end, 0.72);
first.y = Math.max(start.y, height * 0.76);
second.y = Math.max(end.y, height * 0.76);
return new THREE.CatmullRomCurve3([
start,
first,
midpoint,
second,
end
]).getPoints(segments);
}
function registerSelectable(group, id, type) {
group.userData.pickId = id;
group.userData.pickType = type;
group.traverse((object) => {
if (!object.isMesh) return;
object.userData.pickId = id;
object.userData.pickType = type;
clickableMeshes.push(object);
});
selectableGroups.push(group);
}
function createPlantLabel(record) {
const button = document.createElement("button");
button.className = "scene-label";
button.setAttribute("aria-label", `${record.plant}: ${record.concept}`);
const concept = document.createElement("span");
concept.className = "label-concept";
concept.textContent = record.concept;
const plant = document.createElement("span");
plant.className = "label-plant";
plant.textContent = record.plant;
button.append(concept, plant);
button.addEventListener("click", () => selectItem(record.id, "plant"));
labelsRoot.append(button);
labels.push({
element: button,
anchor: new THREE.Vector3(0, record.height, 0),
object: record.group,
id: record.id,
type: "plant"
});
}
function buildApple(group) {
const bark = makeMaterial(0x704b32);
const leaf = makeMaterial(0x4c874d);
const lightLeaf = makeMaterial(0x6da35b);
const fruit = makeMaterial(0xd94e5d);
addBox(group, [0.48, 1.85, 0.48], [0, 0.92, 0], bark);
addBox(group, [0.9, 0.28, 0.3], [-0.22, 1.58, 0], bark);
addBox(group, [0.8, 0.25, 0.28], [0.24, 1.82, 0], bark);
const canopy = [
[-0.66, 2.15, 0.05, 0.95],
[0.05, 2.28, -0.12, 1.18],
[0.72, 2.08, 0.08, 0.92],
[-0.28, 2.78, 0.02, 0.92],
[0.52, 2.64, -0.08, 0.88],
[-0.1, 3.12, 0, 0.72]
];
canopy.forEach(([x, y, z, size], index) => {
addBox(
group,
[size, size * 0.78, size * 0.9],
[x, y, z],
index % 2 ? leaf : lightLeaf
);
});
[
[-0.77, 2.02, 0.48],
[0.42, 2.43, 0.46],
[-0.28, 2.72, 0.44],
[0.72, 1.97, -0.36]
].forEach((p) => addBox(group, [0.22, 0.22, 0.22], p, fruit));
}
function buildRose(group) {
const stem = makeMaterial(0x416f3c);
const leaf = makeMaterial(0x5b9349);
const flower = makeMaterial(0xcf526f);
const flowerLight = makeMaterial(0xf08ba0);
[-0.35, 0, 0.34].forEach((x, index) => {
addBox(group, [0.11, 1.25, 0.11], [x, 0.62, 0], stem);
addBox(group, [0.38, 0.12, 0.3], [x + 0.12, 0.78, 0], leaf);
addBox(group, [0.34, 0.11, 0.28], [x - 0.1, 0.48, 0], leaf);
const y = index === 1 ? 1.38 : 1.18;
addBox(group, [0.4, 0.18, 0.4], [x, y, 0], flower);
addBox(group, [0.22, 0.2, 0.22], [x, y + 0.15, 0], flowerLight);
addBox(group, [0.18, 0.18, 0.18], [x + 0.17, y + 0.02, 0], flowerLight);
});
}
function buildStrawberry(group) {
const leaf = makeMaterial(0x4f994c);
const darkLeaf = makeMaterial(0x377647);
const fruit = makeMaterial(0xde4b57);
const seed = makeMaterial(0xf5cf69);
[-0.28, 0, 0.28].forEach((x, index) => {
addBox(group, [0.08, 0.48, 0.08], [x, 0.24, 0], darkLeaf);
addBox(group, [0.35, 0.1, 0.27], [x, 0.5, 0], leaf);
addBox(group, [0.24, 0.09, 0.22], [x + 0.1, 0.38, 0.03], index % 2 ? leaf : darkLeaf);
});
addBox(group, [0.38, 0.48, 0.38], [0, 0.28, 0.24], fruit);
addBox(group, [0.4, 0.1, 0.38], [0, 0.53, 0.24], darkLeaf);
addBox(group, [0.06, 0.06, 0.06], [0.08, 0.34, 0.45], seed);
addBox(group, [0.06, 0.06, 0.06], [-0.09, 0.23, 0.45], seed);
}
function buildPea(group) {
const wood = makeMaterial(0x8a6c43);
const stem = makeMaterial(0x3d813d);
const leaf = makeMaterial(0x65a650);
const pea = makeMaterial(0x91bd51);
addBox(group, [0.1, 2.05, 0.1], [-0.63, 1.02, 0], wood);
addBox(group, [0.1, 2.05, 0.1], [0.63, 1.02, 0], wood);
addBox(group, [1.36, 0.1, 0.1], [0, 1.98, 0], wood);
[-0.38, 0.12, 0.48].forEach((x, index) => {
addBox(group, [0.1, 1.85, 0.1], [x, 0.92, 0], stem);
addBox(group, [0.55, 0.12, 0.25], [x + 0.18, 0.65 + index * 0.18, 0], leaf);
addBox(group, [0.46, 0.11, 0.24], [x - 0.16, 1.12 + index * 0.17, 0], leaf);
});
[-0.37, 0.12, 0.48].forEach((x, index) => {
for (let i = 0; i < 3; i++) {
addBox(group, [0.16, 0.16, 0.16], [x, 0.85 + i * 0.3, 0.12], pea);
}
});
}
function buildBean(group) {
const wood = makeMaterial(0x7d6241);
const stem = makeMaterial(0x3e7e3c);
const leaf = makeMaterial(0x57964a);
const pod = makeMaterial(0xbd7041);
addBox(group, [0.11, 2.15, 0.11], [-0.32, 1.07, 0], wood);
addBox(group, [0.11, 2.15, 0.11], [0.36, 1.07, 0], wood);
addBox(group, [0.8, 0.1, 0.1], [0.02, 2.08, 0], wood);
for (let i = 0; i < 6; i++) {
const y = 0.42 + i * 0.28;
const x = Math.sin(i * 0.9) * 0.28;
addBox(group, [0.11, 0.3, 0.11], [x, y, 0], stem);
addBox(group, [0.42, 0.13, 0.32], [x + 0.22, y, 0.02], leaf);
}
addBox(group, [0.18, 0.72, 0.18], [-0.12, 1.2, 0.2], pod);
addBox(group, [0.18, 0.62, 0.18], [0.24, 1.48, 0.16], pod);
}
function buildClover(group) {
const stem = makeMaterial(0x3d7c43);
const leaf = makeMaterial(0x58a64f);
const bloom = makeMaterial(0xf3eee2);
[
[-0.36, -0.1],
[0.05, -0.28],
[0.38, 0.05],
[-0.06, 0.32]
].forEach(([x, z]) => {
addBox(group, [0.07, 0.38, 0.07], [x, 0.19, z], stem);
for (let i = 0; i < 3; i++) {
const angle = (i / 3) * Math.PI * 2;
addBox(
group,
[0.18, 0.08, 0.16],
[x + Math.cos(angle) * 0.12, 0.42, z + Math.sin(angle) * 0.12],
leaf
);
}
});
addBox(group, [0.18, 0.16, 0.18], [0.12, 0.51, -0.08], bloom);
addBox(group, [0.16, 0.15, 0.16], [-0.31, 0.43, 0.06], bloom);
}
function buildMint(group) {
const stem = makeMaterial(0x3c8054);
const leaf = makeMaterial(0x4b9a69);
const lightLeaf = makeMaterial(0x71b57c);
[-0.3, 0, 0.3].forEach((x, index) => {
const h = index === 1 ? 1.55 : 1.25;
addBox(group, [0.09, h, 0.09], [x, h / 2, 0], stem);
for (let i = 0; i < 3; i++) {
const y = 0.38 + i * 0.35;
addBox(group, [0.42, 0.16, 0.32], [x - 0.18, y, 0], i % 2 ? leaf : lightLeaf);
addBox(group, [0.38, 0.15, 0.3], [x + 0.17, y + 0.1, 0], lightLeaf);
}
});
}
function buildSage(group) {
const stem = makeMaterial(0x687858);
const leaf = makeMaterial(0x82977d);
const lightLeaf = makeMaterial(0xa0ad8c);
addBox(group, [0.12, 1.65, 0.12], [0, 0.82, 0], stem);
addBox(group, [0.12, 1.2, 0.12], [-0.26, 0.6, 0.06], stem);
addBox(group, [0.12, 1.15, 0.12], [0.25, 0.58, -0.03], stem);
for (let i = 0; i < 4; i++) {
const y = 0.42 + i * 0.29;
addBox(group, [0.46, 0.13, 0.28], [-0.27, y, 0], leaf);
addBox(group, [0.44, 0.13, 0.27], [0.27, y + 0.07, 0], lightLeaf);
}
}
function buildBasil(group) {
const stem = makeMaterial(0x487840);
const leaf = makeMaterial(0x3f8d4b);
const lightLeaf = makeMaterial(0x67a95b);
[-0.25, 0.02, 0.28].forEach((x, index) => {
const h = 1.35 - Math.abs(index - 1) * 0.15;
addBox(group, [0.09, h, 0.09], [x, h / 2, 0], stem);
addBox(group, [0.4, 0.13, 0.27], [x - 0.19, 0.48, 0], leaf);
addBox(group, [0.39, 0.12, 0.26], [x + 0.19, 0.73, 0], lightLeaf);
addBox(group, [0.35, 0.12, 0.25], [x - 0.14, 0.98, 0], leaf);
});
}
function buildHemlock(group) {
const stem = makeMaterial(0x68765a);
const leaf = makeMaterial(0x6d995d);
const lightLeaf = makeMaterial(0x8bab6c);
const berry = makeMaterial(0x5a3d48);
addBox(group, [0.2, 1.85, 0.2], [0, 0.92, 0], stem);
addBox(group, [0.78, 0.16, 0.18], [-0.28, 1.48, 0], stem);
addBox(group, [0.78, 0.16, 0.18], [0.28, 1.64, 0], stem);
const canopy = [
[-0.78, 1.9, 0, 0.7],
[-0.35, 2.08, 0, 0.8],
[0.15, 2.2, 0, 0.88],
[0.68, 2.0, 0, 0.76],
[-0.2, 2.48, 0, 0.72],
[0.48, 2.42, 0, 0.62]
];
canopy.forEach(([x, y, z, size], index) => {
addBox(group, [size, size * 0.56, size * 0.78], [x, y, z], index % 2 ? leaf : lightLeaf);
});
[
[-0.42, 2.05, 0.32],
[0.1, 2.3, 0.36],
[0.54, 2.06, 0.28],
[-0.1, 2.54, 0.28]
].forEach((p) => addBox(group, [0.13, 0.13, 0.13], p, berry));
}
function buildParsley(group) {
const stem = makeMaterial(0x3d7e42);
const leaf = makeMaterial(0x559847);
const lightLeaf = makeMaterial(0x7cab58);
for (let i = 0; i < 7; i++) {
const angle = (i / 7) * Math.PI * 2;
const x = Math.cos(angle) * 0.28;
const z = Math.sin(angle) * 0.28;
const h = 0.72 + (i % 3) * 0.16;
addBox(group, [0.07, h, 0.07], [x * 0.45, h / 2, z * 0.45], stem);
addBox(group, [0.27, 0.14, 0.23], [x, h, z], i % 2 ? leaf : lightLeaf);
addBox(group, [0.2, 0.12, 0.19], [x * 0.6, h + 0.15, z * 0.6], lightLeaf);
}
}
function buildCarrot(group) {
const root = makeMaterial(0xe57c2f);
const top = makeMaterial(0xe99b43);
const leaf = makeMaterial(0x4b9348);
const lightLeaf = makeMaterial(0x73aa55);
addBox(group, [0.42, 0.9, 0.42], [0, 0.38, 0], root);
addBox(group, [0.31, 0.32, 0.31], [0, 0.87, 0], top);
addBox(group, [0.09, 0.72, 0.09], [0, 1.08, 0], leaf);
[
[-0.25, 1.3, 0],
[0.23, 1.38, 0],
[0, 1.56, 0.02]
].forEach((p, index) => {
addBox(group, [0.38, 0.11, 0.25], p, index % 2 ? leaf : lightLeaf);
});
}
const builders = {
apple: buildApple,
rose: buildRose,
strawberry: buildStrawberry,
pea: buildPea,
bean: buildBean,
clover: buildClover,
mint: buildMint,
sage: buildSage,
basil: buildBasil,
hemlock: buildHemlock,
parsley: buildParsley,
carrot: buildCarrot
};
// Voxel ground.
const groundGeometry = new THREE.BoxGeometry(0.96, 0.24, 0.96);
const groundMaterial = makeMaterial(0xffffff);
const ground = new THREE.InstancedMesh(groundGeometry, groundMaterial, 19 * 14);
const dummy = new THREE.Object3D();
const color = new THREE.Color();
let tileIndex = 0;
for (let x = -9; x <= 9; x++) {
for (let z = -6; z <= 7; z++) {
dummy.position.set(x, 0, z);
dummy.updateMatrix();
ground.setMatrixAt(tileIndex, dummy.matrix);
const hue = 0.24 + ((x * 13 + z * 7) % 7) * 0.003;
const light = 0.69 + ((x * 5 + z * 3) % 5) * 0.015;
color.setHSL(hue, 0.19, light);
ground.setColorAt(tileIndex, color);
tileIndex++;
}
}
ground.instanceMatrix.needsUpdate = true;
ground.instanceColor.needsUpdate = true;
ground.receiveShadow = true;
scene.add(ground);
addBox(
scene,
[20.4, 0.5, 15.4],
[0, -0.35, 0.5],
makeMaterial(0x8d8065),
false
);
function addBed(x, z, width, depth, soilColor) {
const soil = makeMaterial(soilColor);
const edge = makeMaterial(0x8a7049);
addBox(scene, [width, 0.2, depth], [x, 0.22, z], soil, false);
addBox(scene, [width + 0.12, 0.24, 0.1], [x, 0.3, z - depth / 2], edge, false);
addBox(scene, [width + 0.12, 0.24, 0.1], [x, 0.3, z + depth / 2], edge, false);
addBox(scene, [0.1, 0.24, depth], [x - width / 2, 0.3, z], edge, false);
addBox(scene, [0.1, 0.24, depth], [x + width / 2, 0.3, z], edge, false);
}
addBed(-5.4, -1.2, 4.9, 4.9, 0x705844);
addBed(1.4, 3.9, 5.5, 4.9, 0x6d5b40);
addBed(5.7, -2.2, 4.7, 4.8, 0x625b43);
addBed(-3.5, 5.5, 7.5, 2.9, 0x67543d);
// Build the twelve voxel plants.
for (const record of plantData) {
const group = new THREE.Group();
group.position.set(record.pos[0], 0.33, record.pos[1]);
group.userData.phase = Math.random() * Math.PI * 2;
scene.add(group);
builders[record.id](group);
registerSelectable(group, record.id, "plant");
record.group = group;
plantRecords.push(record);
createPlantLabel(record);
}
// Actual family relations are shown as spokes to a family hub, not as
// literal pairwise plant-to-plant connections.
const familyHubs = {
Rosaceae: [-5.4, 0.46, -1.2],
Fabaceae: [1.35, 0.46, 3.85],
Lamiaceae: [5.7, 0.46, -2.2],
Apiaceae: [-3.5, 0.46, 5.5]
};
const botanicalMaterial = new THREE.LineBasicMaterial({
color: 0x2f9d68,
transparent: true,
opacity: 0.9
});
Object.entries(familyHubs).forEach(([family, hubPosition]) => {
const hub = new THREE.Vector3(...hubPosition);
const familyColor = familyColors[family];
addBox(
groups.botanical,
[0.34, 0.34, 0.34],
hubPosition,
makeMaterial(familyColor, 0.18)
);
plantRecords
.filter((record) => record.family === family)
.forEach((record) => {
const start = new THREE.Vector3(record.pos[0], 0.43, record.pos[1]);
const points = curveBetween(start, hub, 0.56, 18);
makeLine(points, botanicalMaterial, groups.botanical);
});
const familyLabel = document.createElement("div");
familyLabel.className = "family-label";
familyLabel.textContent = `${family} · shared family`;
labelsRoot.append(familyLabel);
labels.push({
element: familyLabel,
anchor: new THREE.Vector3(hub.x, 0.78, hub.z),
object: null,
id: family,
type: "family"
});
});
// A real plant–microbe connection at clover roots.
const rhizobiaGroup = new THREE.Group();
const rhizobiaMaterial = makeMaterial(0xe2d8b8, 0.1);
const bacteriaPositions = [
[0.8, 0.4, 5.36],
[1.16, 0.4, 5.34],
[0.9, 0.39, 5.56],
[1.23, 0.4, 5.62]
];
bacteriaPositions.forEach((position) => {
addBox(rhizobiaGroup, [0.12, 0.12, 0.12], position, rhizobiaMaterial);
});
scene.add(rhizobiaGroup);
registerSelectable(rhizobiaGroup, "rhizobia", "biology");
makeLine(
[
new THREE.Vector3(1, 0.43, 5),
new THREE.Vector3(1.02, 0.47, 5.23),
new THREE.Vector3(1.03, 0.44, 5.43)
],
botanicalMaterial,
groups.botanical
);
// Symbolic dashed paths.
const symbolicMaterial = new THREE.LineDashedMaterial({
color: 0xd85f73,
dashSize: 0.25,
gapSize: 0.18,
transparent: true,
opacity: 0.78
});
const symbolicMidpointMaterial = makeMaterial(0xd85f73, 0.34);
for (const [fromId, toId, height, description] of symbolicLinks) {
const from = plantRecords.find((record) => record.id === fromId);
const to = plantRecords.find((record) => record.id === toId);
const start = new THREE.Vector3(
from.pos[0],
1.35 + from.height * 0.2,
from.pos[1]
);
const end = new THREE.Vector3(
to.pos[0],
1.35 + to.height * 0.2,
to.pos[1]
);
const points = curveBetween(start, end, height, 52);
makeLine(points, symbolicMaterial, groups.symbolic);
const midpoint = points[Math.floor(points.length / 2)];
const marker = addBox(
groups.symbolic,
[0.14, 0.14, 0.14],
midpoint.toArray(),
symbolicMidpointMaterial,
false
);
marker.userData.symbolicMeaning = description;
}
// Interpretation well: the visual center acknowledges that every
// correspondence passes through an act of reading.
const wellGroup = new THREE.Group();
const stone = makeMaterial(0x8b8b82);
const violet = makeMaterial(0x8a6bc1, 0.55);
addBox(wellGroup, [2.1, 0.28, 2.1], [0, 0.15, 0], stone);
addBox(wellGroup, [1.35, 0.35, 1.35], [0, 0.38, 0], makeMaterial(0x4f6d65));
addBox(wellGroup, [0.52, 0.52, 0.52], [0, 0.82, 0], violet);
wellGroup.position.set(-0.15, 0, -1.35);
scene.add(wellGroup);
registerSelectable(wellGroup, "well", "garden");
const wellLabel = document.createElement("div");
wellLabel.className = "scene-label well-label";
wellLabel.textContent = "Interpretation well";
labelsRoot.append(wellLabel);
labels.push({
element: wellLabel,
anchor: new THREE.Vector3(-0.15, 1.65, -1.35),
object: null,
id: "well",
type: "garden"
});
// A small toy recurrent neural network. Cyan edges are actual directed
// edges in this model; the labels do not claim to reproduce brain anatomy.
const network = new THREE.Group();
network.position.set(7.0, 0.34, 5.7);
scene.add(network);
const netNodes = [
{ id: "sense", name: "Sense", x: -0.9, y: 0.95, z: 0, description: "An input unit standing for a simplified sensory signal." },
{ id: "context", name: "Context", x: 0, y: 0.95, z: 0, description: "An input unit standing for prior context." },
{ id: "goal", name: "Goal", x: 0.9, y: 0.95, z: 0, description: "An input unit standing for a task goal." },
{ id: "encode", name: "Encode", x: -0.66, y: 1.85, z: 0, description: "A hidden unit that combines incoming signals." },
{ id: "memory", name: "Memory", x: 0, y: 1.85, z: 0, description: "A recurrent unit. Its label is metaphorical; its incoming and outgoing edges are real graph edges." },
{ id: "predict", name: "Predict", x: 0.66, y: 1.85, z: 0, description: "A hidden unit that combines current and contextual information." },
{ id: "attention", name: "Attention", x: -0.3, y: 2.78, z: 0, description: "An output-side unit. “Attention” names a computation, not a literal brain region." },
{ id: "action", name: "Action", x: 0.3, y: 2.78, z: 0, description: "An output unit representing a selected action." }
];
const netEdges = [
["sense", "encode"],
["context", "encode"],
["context", "memory"],
["goal", "predict"],
["encode", "memory"],
["memory", "predict"],
["memory", "attention"],
["predict", "action"],
["encode", "attention"],
["memory", "memory"]
];
const netNodeMap = new Map();
const netMaterial = makeMaterial(0x29b9d1, 0.8);
const neuralLineMaterial = new THREE.LineBasicMaterial({
color: 0x29b9d1,
transparent: true,
opacity: 0.88
});
for (const node of netNodes) {
const mesh = addBox(
network,
[0.3, 0.3, 0.3],
[node.x, node.y, node.z],
netMaterial.clone()
);
mesh.userData.netId = node.id;
node.mesh = mesh;
netNodeMap.set(node.id, node);
registerSelectable(mesh, node.id, "neural");
const label = document.createElement("button");
label.className = "scene-label network-label";
label.textContent = node.name;
label.addEventListener("click", () => selectItem(node.id, "neural"));
labelsRoot.append(label);
labels.push({
element: label,
anchor: new THREE.Vector3(node.x, node.y + 0.32, node.z),
object: network,
id: node.id,
type: "neural"
});
}
const pulses = [];
for (const [fromId, toId] of netEdges) {
const from = netNodeMap.get(fromId);
const to = netNodeMap.get(toId);
const start = new THREE.Vector3(from.x, from.y, from.z);
const end = new THREE.Vector3(to.x, to.y, to.z);
if (fromId === toId) {
const loopPoints = [
start.clone(),
new THREE.Vector3(from.x - 0.5, from.y + 0.28, from.z),
new THREE.Vector3(from.x + 0.52, from.y + 0.28, from.z),
start.clone()
];
makeLine(
new THREE.CatmullRomCurve3(loopPoints).getPoints(28),
neuralLineMaterial,
groups.neural
);
} else {
makeLine([start, end], neuralLineMaterial, groups.neural);
}
const pulse = addBox(
groups.neural,
[0.1, 0.1, 0.1],
start.toArray(),
makeMaterial(0xb6f5ff, 1.2),
false
);
pulses.push({
mesh: pulse,
start,
end,
offset: Math.random(),
loop: fromId === toId
});
}
addBox(
network,
[2.55, 0.18, 1.35],
[0, 0.08, 0],
makeMaterial(0x486b6d)
);
const networkTitle = document.createElement("div");
networkTitle.className = "family-label";
networkTitle.style.color = "#167c8c";
networkTitle.style.background = "rgba(235, 250, 252, 0.85)";
networkTitle.textContent = "Neural model · actual graph edges";
labelsRoot.append(networkTitle);
labels.push({
element: networkTitle,
anchor: new THREE.Vector3(0, 3.38, 0),
object: network,
id: "network",
type: "neural"
});
// Mapping list.
for (const record of plantData) {
const button = document.createElement("button");
button.className = "mapping-row";
button.dataset.mappingId = record.id;
const swatch = document.createElement("span");
swatch.className = "swatch";
swatch.style.background = `#${familyColors[record.family].toString(16).padStart(6, "0")}`;
const text = document.createElement("span");
const strong = document.createElement("strong");
strong.textContent = `${record.concept} ↔ ${record.plant}`;
const small = document.createElement("small");
small.textContent = record.bridge;
text.append(strong, small);
const badge = document.createElement("span");
badge.className = "family-badge";
badge.textContent = record.family;
button.append(swatch, text, badge);
button.addEventListener("click", () => selectItem(record.id, "plant"));
mappingList.append(button);
}
const neuralButton = document.createElement("button");
neuralButton.className = "mapping-row";
neuralButton.dataset.mappingId = "network";
const neuralSwatch = document.createElement("span");
neuralSwatch.className = "swatch";
neuralSwatch.style.background = "#29b9d1";
const neuralText = document.createElement("span");
const neuralStrong = document.createElement("strong");
neuralStrong.textContent = "Memory ↔ model unit";
const neuralSmall = document.createElement("small");
neuralSmall.textContent = "A real edge in a toy recurrent graph, not a literal brain map.";
neuralText.append(neuralStrong, neuralSmall);
const neuralBadge = document.createElement("span");
neuralBadge.className = "family-badge";
neuralBadge.textContent = "model";
neuralButton.append(neuralSwatch, neuralText, neuralBadge);
neuralButton.addEventListener("click", () => selectItem("network", "neural"));
mappingList.append(neuralButton);
// Selection ring built from voxels.
const selectionRing = new THREE.Group();
const ringMaterial = makeMaterial(0x7256b5, 0.75);
const ringPositions = [];
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
ringPositions.push([Math.cos(angle) * 0.82, 0, Math.sin(angle) * 0.82]);
}
ringPositions.forEach((position) => {
addBox(selectionRing, [0.14, 0.12, 0.14], position, ringMaterial, false);
});
selectionRing.visible = false;
scene.add(selectionRing);
let selected = null;
let hovered = null;
function updateSelectionVisuals() {
selectableGroups.forEach((group) => {
const isSelected = group.userData.pickId === selected?.id;
const isHovered = group.userData.pickId === hovered?.id;
group.traverse((object) => {
if (!object.isMesh || !object.material?.emissive) return;
const base = object.material.userData.baseIntensity ?? 0;
object.material.emissiveIntensity = base + (isSelected ? 0.28 : 0) + (isHovered ? 0.18 : 0);
});
});
document.querySelectorAll(".mapping-row").forEach((row) => {
row.classList.toggle("active", row.dataset.mappingId === selected?.id);
});
labels.forEach((label) => {
label.element.classList.toggle(
"active",
label.id === selected?.id && label.type === selected?.type
);
});
const record = plantRecords.find((item) => item.id === selected?.id);
if (record) {
selectionRing.visible = true;
selectionRing.position.set(record.pos[0], 0.43, record.pos[1]);
} else {
selectionRing.visible = false;
}
}
function selectItem(id, type) {
selected = { id, type };
if (type === "plant") {
const record = plantRecords.find((item) => item.id === id);
detailCard.innerHTML = `
<p class="eyebrow">Symbolic mapping</p>
<h2>${record.concept}</h2>
<h3>${record.plant} · ${record.family}</h3>
<p><strong>Bridge:</strong> ${record.bridge}</p>
<p class="limit"><strong>Limit:</strong> ${record.limit}</p>
<p class="fact">${record.fact}</p>
`;
} else if (type === "biology") {
detailCard.innerHTML = `
<p class="eyebrow">Actual biological connection</p>
<h2>Rhizobia</h2>
<h3>Living inside clover root nodules</h3>
<p>
These bacteria occupy root nodules and help fix atmospheric nitrogen.
The plant supplies carbon compounds and protected habitat in exchange.
</p>
<p class="limit">
<strong>Limit:</strong> “Reciprocity” is a useful metaphor, but the
partnership is biological, not moral.
</p>
<p class="fact">This green line is a literal plant–microbe relation.</p>
`;
} else if (type === "neural") {
const node = netNodeMap.get(id);
if (node) {
const outgoing = netEdges
.filter(([from]) => from === id)
.map(([, to]) => netNodeMap.get(to).name);
const incoming = netEdges
.filter(([, to]) => to === id)
.map(([from]) => netNodeMap.get(from).name);
detailCard.innerHTML = `
<p class="eyebrow">Neural model unit</p>
<h2>${node.name}</h2>
<h3>Actual directed graph edges</h3>
<p>${node.description}</p>
<p>
<strong>Incoming:</strong> ${incoming.length ? incoming.join(", ") : "none"}
<br />
<strong>Outgoing:</strong> ${outgoing.length ? outgoing.join(", ") : "none"}
</p>
<p class="limit">
<strong>Limit:</strong> moving cyan packets show edge direction,
not biological synapses, causality in a brain, or a complete account
of cognition.
</p>
`;
} else {
detailCard.innerHTML = `
<p class="eyebrow">Neural model</p>
<h2>Memory ↔ model unit</h2>
<h3>Topology, not anatomy</h3>
<p>
The cyan links are actual edges in this small recurrent graph.
The unit names use familiar cognitive words, but that vocabulary
does not make the graph a literal model of the brain.
</p>
<p class="limit">
<strong>Limit:</strong> a diagram can faithfully show topology
while still omitting embodiment, learning, and causal context.
</p>
`;
}
} else {
detailCard.innerHTML = `
<p class="eyebrow">The garden's premise</p>
<h2>Interpretation well</h2>
<h3>Every correspondence passes through a reader</h3>
<p>
The well marks the point at which a resemblance becomes an
interpretation. Plants supply forms and histories; people supply
the bridge to concepts such as care, caution, or reciprocity.
</p>
<p class="limit">
<strong>Limit:</strong> the garden can expose the bridge, but it
cannot make a metaphor into a mechanism.
</p>
`;
}
updateSelectionVisuals();
}
// Initial selection.
selectItem("apple", "plant");
// Layer controls.
document.querySelectorAll("[data-layer]").forEach((button) => {
button.addEventListener("click", () => {
const layer = button.dataset.layer;
layerState[layer] = !layerState[layer];
groups[layer].visible = layerState[layer];
document.querySelectorAll(`[data-layer="${layer}"]`).forEach((control) => {
control.setAttribute("aria-pressed", String(layerState[layer]));
});
});
});
// Raycasting and hover feedback.
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let pointerDown = false;
let dragging = false;
let moved = false;
let previousX = 0;
let previousY = 0;
function setPointerFromEvent(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;
}
function pick(event) {
setPointerFromEvent(event);
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(clickableMeshes, false);
return intersections.find((intersection) => intersection.object.userData.pickId);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerDown = true;
dragging = false;
moved = false;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add("dragging");
});
renderer.domElement.addEventListener("pointermove", (event) => {
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
if (pointerDown) {
if (Math.abs(deltaX) + Math.abs(deltaY) > 1) moved = true;
if (event.shiftKey || event.buttons === 2) {
const right = new THREE.Vector3(Math.cos(orbit.yaw), 0, -Math.sin(orbit.yaw));
const forward = new THREE.Vector3(Math.sin(orbit.yaw), 0, Math.cos(orbit.yaw));
const scale = orbit.radius * 0.0015;
orbit.target.addScaledVector(right, -deltaX * scale);
orbit.target.addScaledVector(forward, -deltaY * scale);
} else {
orbit.yaw -= deltaX * 0.006;
orbit.pitch = THREE.MathUtils.clamp(
orbit.pitch + deltaY * 0.005,
0.2,
1.18
);
}
previousX = event.clientX;
previousY = event.clientY;
updateCamera();
return;
}
const hit = pick(event);
const nextHovered = hit ? { id: hit.object.userData.pickId, type: hit.object.userData.pickType } : null;
if (
nextHovered?.id !== hovered?.id ||
nextHovered?.type !== hovered?.type
) {
hovered = nextHovered;
updateSelectionVisuals();
renderer.domElement.style.cursor = hit ? "pointer" : "grab";
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!moved) {
const hit = pick(event);
if (hit) {
selectItem(hit.object.userData.pickId, hit.object.userData.pickType);
}
}
pointerDown = false;
renderer.domElement.classList.remove("dragging");
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
});
renderer.domElement.addEventListener("pointerleave", () => {
if (!pointerDown) {
hovered = null;
updateSelectionVisuals();
}
});
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.012,
10,
32
);
updateCamera();
}, { passive: false });
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
window.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
if (key === "arrowleft") orbit.yaw += 0.08;
else if (key === "arrowright") orbit.yaw -= 0.08;
else if (key === "arrowup") orbit.pitch = Math.min(1.18, orbit.pitch + 0.05);
else if (key === "arrowdown") orbit.pitch = Math.max(0.2, orbit.pitch - 0.05);
else if (key === "+" || key === "=") orbit.radius = Math.max(10, orbit.radius - 1);
else if (key === "-") orbit.radius = Math.min(32, orbit.radius + 1);
else return;
updateCamera();
});
document.getElementById("reset-camera").addEventListener("click", () => {
orbit.yaw = 0.73;
orbit.pitch = 0.53;
orbit.radius = 21;
orbit.target.set(0, 1.15, 0);
updateCamera();
});
// Responsive canvas.
function resize() {
const width = stage.clientWidth;
const height = stage.clientHeight;
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(stage);
resize();
// Project DOM labels from their 3D anchors.
const projected = new THREE.Vector3();
function updateLabels() {
const width = stage.clientWidth;
const height = stage.clientHeight;
for (const label of labels) {
if (label.object) {
projected.copy(label.anchor);
label.object.localToWorld(projected);
} else {
projected.copy(label.anchor);
}
projected.project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
projected.x > -1.12 &&
projected.x < 1.12 &&
projected.y > -1.12 &&
projected.y < 1.12;
label.element.style.display = visible ? "" : "none";
if (!visible) continue;
label.element.style.left = `${(projected.x * 0.5 + 0.5) * width}px`;
label.element.style.top = `${(-projected.y * 0.5 + 0.5) * height}px`;
}
}
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
plantRecords.forEach((record) => {
record.group.rotation.z = Math.sin(elapsed * 0.7 + record.group.userData.phase) * 0.007;
});
pulses.forEach((pulse) => {
let t = (elapsed * 0.24 + pulse.offset) % 1;
if (pulse.loop) {
const angle = t * Math.PI * 2;
pulse.mesh.position.set(
pulse.start.x + Math.cos(angle) * 0.5,
pulse.start.y + Math.sin(angle) * 0.28,
pulse.start.z
);
} else {
pulse.mesh.position.lerpVectors(pulse.start, pulse.end, t);
}
});
updateLabels();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
document.getElementById("loading").remove();
animate();
</script>
</body>
</html>
```