Prompt specification
Build or customize the Three.js 3D scene "Early-growth resource comparison" 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: Early-growth resource comparison
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/early-growth-resource-comparison-x0788
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts seed reserves and germination. Create a fictional seedling model with different reserve amounts and light availability; users inspect growth-stage limits under explicit rules rather than treating outputs as agronomic predictions. Voxel style.
Working Three.js Starter (early-growth-resource-comparison-x0788):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Seed Reserve Lab — Fictional Voxel Model</title>
<style>
:root {
--bg: #091310;
--panel: rgba(15, 29, 25, 0.88);
--panel-strong: rgba(20, 38, 32, 0.96);
--line: rgba(207, 236, 215, 0.13);
--text: #e8f3e8;
--muted: #96aa9f;
--green: #8ee081;
--green-dark: #315f43;
--gold: #f0c46a;
--blue: #7fc9ed;
--danger: #f09a78;
--radius: 18px;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 20%, #183229 0%, #0b1814 48%, #07100d 100%);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input,
select {
font: inherit;
}
button {
color: inherit;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.ui {
position: fixed;
z-index: 10;
}
.panel {
pointer-events: auto;
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--panel);
box-shadow:
0 20px 60px rgba(0, 0, 0, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.035);
backdrop-filter: blur(16px) saturate(120%);
}
.topbar {
top: 20px;
left: 22px;
right: 22px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
pointer-events: auto;
}
.brand-mark {
position: relative;
width: 38px;
height: 38px;
transform: rotate(-8deg);
}
.brand-mark span {
position: absolute;
width: 15px;
height: 15px;
border-radius: 3px;
background: var(--green);
box-shadow: 0 0 18px rgba(142, 224, 129, 0.2);
}
.brand-mark span:nth-child(1) {
left: 2px;
top: 2px;
}
.brand-mark span:nth-child(2) {
right: 1px;
top: 8px;
background: #d2ef9c;
}
.brand-mark span:nth-child(3) {
left: 7px;
bottom: 1px;
background: #4b9c68;
}
.brand h1 {
margin: 0;
font-size: 15px;
line-height: 1.15;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.brand p {
margin: 5px 0 0;
color: var(--muted);
font-size: 11px;
letter-spacing: 0.06em;
}
.top-actions {
display: flex;
align-items: center;
gap: 8px;
pointer-events: auto;
}
.model-badge,
.top-button {
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(13, 26, 22, 0.72);
backdrop-filter: blur(12px);
}
.model-badge {
padding: 9px 13px;
color: #c9d9cf;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.model-badge::before {
content: "";
display: inline-block;
width: 7px;
height: 7px;
margin-right: 8px;
border-radius: 2px;
background: var(--gold);
box-shadow: 0 0 12px rgba(240, 196, 106, 0.5);
}
.top-button {
padding: 9px 12px;
color: #cbd8d0;
font-size: 11px;
cursor: pointer;
transition: 160ms ease;
}
.top-button:hover {
border-color: rgba(142, 224, 129, 0.35);
color: white;
background: rgba(37, 65, 51, 0.8);
}
.trials-panel {
top: 92px;
left: 22px;
width: 244px;
padding: 18px;
}
.panel-kicker {
margin: 0 0 6px;
color: var(--green);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.panel h2 {
margin: 0;
font-size: 17px;
font-weight: 650;
letter-spacing: -0.02em;
}
.panel-sub {
margin: 7px 0 15px;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
.trial-list {
display: grid;
gap: 9px;
}
.trial-card {
width: 100%;
padding: 13px;
border: 1px solid var(--line);
border-radius: 13px;
background: rgba(255, 255, 255, 0.025);
text-align: left;
cursor: pointer;
transition: 160ms ease;
}
.trial-card:hover {
transform: translateY(-1px);
border-color: rgba(142, 224, 129, 0.28);
background: rgba(142, 224, 129, 0.055);
}
.trial-card.selected {
border-color: rgba(142, 224, 129, 0.58);
background: rgba(142, 224, 129, 0.085);
box-shadow: inset 3px 0 0 var(--green);
}
.trial-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 9px;
}
.trial-name {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
font-weight: 700;
}
.trial-code {
display: grid;
width: 23px;
height: 23px;
place-items: center;
border-radius: 6px;
background: rgba(142, 224, 129, 0.12);
color: var(--green);
font-size: 10px;
}
.trial-stage {
max-width: 105px;
overflow: hidden;
color: #c5d3ca;
font-size: 10px;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
}
.mini-bars {
display: grid;
gap: 6px;
}
.mini-row {
display: grid;
grid-template-columns: 38px 1fr 35px;
align-items: center;
gap: 7px;
color: var(--muted);
font-size: 9px;
}
.mini-track {
height: 4px;
overflow: hidden;
border-radius: 3px;
background: rgba(255, 255, 255, 0.07);
}
.mini-fill {
height: 100%;
border-radius: inherit;
}
.mini-fill.reserve {
background: var(--gold);
}
.mini-fill.light {
background: var(--blue);
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 9px;
}
.legend span {
display: flex;
align-items: center;
gap: 5px;
}
.legend i {
width: 7px;
height: 7px;
border-radius: 2px;
}
.inspector {
top: 92px;
right: 22px;
width: 358px;
max-height: calc(100vh - 112px);
padding: 18px;
overflow: auto;
scrollbar-width: thin;
scrollbar-color: rgba(142, 224, 129, 0.35) transparent;
}
.inspector-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.specimen-select {
max-width: 145px;
padding: 7px 25px 7px 9px;
border: 1px solid var(--line);
border-radius: 9px;
outline: none;
background: #162820;
color: var(--text);
font-size: 10px;
}
.control-block {
margin-top: 17px;
}
.control-label {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
font-size: 11px;
}
.control-label strong {
font-size: 13px;
font-variant-numeric: tabular-nums;
}
.control-note {
margin-top: 5px;
color: var(--muted);
font-size: 9px;
line-height: 1.45;
}
input[type="range"] {
width: 100%;
height: 5px;
margin: 7px 0;
border-radius: 4px;
outline: none;
background: rgba(255, 255, 255, 0.09);
appearance: none;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
width: 17px;
height: 17px;
border: 3px solid #183126;
border-radius: 5px;
background: var(--green);
box-shadow: 0 0 0 1px rgba(142, 224, 129, 0.5);
appearance: none;
}
input[type="range"]::-moz-range-thumb {
width: 13px;
height: 13px;
border: 3px solid #183126;
border-radius: 5px;
background: var(--green);
}
#reserveSlider::-webkit-slider-thumb {
background: var(--gold);
box-shadow: 0 0 0 1px rgba(240, 196, 106, 0.55);
}
#reserveSlider::-moz-range-thumb {
background: var(--gold);
}
#lightSlider::-webkit-slider-thumb {
background: var(--blue);
box-shadow: 0 0 0 1px rgba(127, 201, 237, 0.55);
}
#lightSlider::-moz-range-thumb {
background: var(--blue);
}
.preset-title {
margin-bottom: 7px;
color: var(--muted);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.presets {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.preset {
padding: 7px 9px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.025);
color: #b9c9c0;
font-size: 9px;
cursor: pointer;
transition: 140ms ease;
}
.preset:hover {
border-color: rgba(142, 224, 129, 0.42);
color: white;
background: rgba(142, 224, 129, 0.08);
}
.outcome {
margin-top: 16px;
padding: 13px;
border: 1px solid rgba(240, 154, 120, 0.25);
border-radius: 12px;
background: rgba(240, 154, 120, 0.065);
}
.outcome.pass {
border-color: rgba(142, 224, 129, 0.28);
background: rgba(142, 224, 129, 0.065);
}
.outcome-kicker {
color: var(--danger);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.outcome.pass .outcome-kicker {
color: var(--green);
}
.outcome strong {
display: block;
margin-top: 5px;
font-size: 14px;
}
.outcome p {
margin: 5px 0 0;
color: #b8c7be;
font-size: 10px;
line-height: 1.5;
}
.gate-header {
display: flex;
align-items: center;
justify-content: space-between;
margin: 17px 0 7px;
font-size: 11px;
font-weight: 700;
}
.gate-header span {
color: var(--muted);
font-size: 9px;
font-weight: 500;
}
.gate-list {
display: grid;
gap: 5px;
}
.gate {
display: grid;
grid-template-columns: 23px minmax(0, 1fr) auto;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 7px 9px;
border: 1px solid rgba(255, 255, 255, 0.055);
border-radius: 9px;
background: rgba(255, 255, 255, 0.018);
}
.gate.blocked {
border-color: rgba(240, 154, 120, 0.32);
background: rgba(240, 154, 120, 0.055);
}
.gate.locked {
opacity: 0.42;
}
.gate-icon {
display: grid;
width: 22px;
height: 22px;
place-items: center;
border-radius: 6px;
background: rgba(142, 224, 129, 0.11);
color: var(--green);
font-size: 11px;
font-weight: 800;
}
.gate.blocked .gate-icon {
background: rgba(240, 154, 120, 0.12);
color: var(--danger);
}
.gate.locked .gate-icon {
background: rgba(255, 255, 255, 0.06);
color: var(--muted);
}
.gate-title {
font-size: 10px;
font-weight: 700;
}
.gate-rule {
margin-top: 2px;
color: var(--muted);
font-size: 8px;
font-variant-numeric: tabular-nums;
}
.gate-cost {
color: #afc0b6;
font-size: 9px;
white-space: nowrap;
}
.primary-button {
width: 100%;
margin-top: 14px;
padding: 11px 14px;
border: 0;
border-radius: 10px;
background: var(--green);
color: #102118;
font-size: 11px;
font-weight: 850;
letter-spacing: 0.04em;
cursor: pointer;
transition: 150ms ease;
}
.primary-button:hover {
transform: translateY(-1px);
background: #a4ed98;
}
.primary-button:disabled {
cursor: default;
opacity: 0.55;
transform: none;
}
details {
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid var(--line);
}
summary {
color: #b8c9bf;
font-size: 10px;
cursor: pointer;
}
details p {
margin: 9px 0 0;
color: var(--muted);
font-size: 9px;
line-height: 1.6;
}
.timeline {
right: 402px;
bottom: 20px;
left: 288px;
padding: 14px 17px 12px;
}
.timeline-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.timeline-title {
font-size: 11px;
font-weight: 750;
}
.timeline-status {
color: var(--muted);
font-size: 9px;
}
.stage-track {
position: relative;
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 4px;
}
.stage-track::before {
content: "";
position: absolute;
top: 10px;
right: 7%;
left: 7%;
height: 1px;
background: rgba(255, 255, 255, 0.1);
}
.stage-node {
position: relative;
z-index: 1;
min-width: 0;
text-align: center;
}
.stage-dot {
width: 20px;
height: 20px;
margin: 0 auto 7px;
border: 4px solid #162720;
border-radius: 6px;
background: #34473e;
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
transition: 180ms ease;
}
.stage-node.reached .stage-dot {
background: var(--green);
box-shadow: 0 0 13px rgba(142, 224, 129, 0.35);
}
.stage-node.active .stage-dot {
transform: scale(1.2);
background: #d6f7b8;
}
.stage-node.blocked .stage-dot {
background: var(--danger);
box-shadow: 0 0 12px rgba(240, 154, 120, 0.35);
}
.stage-label {
overflow: hidden;
color: #82968b;
font-size: 8px;
text-overflow: ellipsis;
white-space: nowrap;
}
.stage-node.reached .stage-label {
color: #c8d8ce;
}
.timeline-foot {
display: flex;
justify-content: space-between;
gap: 12px;
margin-top: 10px;
padding-top: 9px;
border-top: 1px solid var(--line);
color: #7f9288;
font-size: 8px;
}
#world-labels {
position: fixed;
inset: 0;
z-index: 4;
overflow: hidden;
pointer-events: none;
}
.world-label {
position: absolute;
min-width: 112px;
padding: 7px 10px;
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 9px;
background: rgba(8, 18, 14, 0.72);
color: #b9cbc1;
font-size: 9px;
text-align: center;
transform: translate(-50%, -100%);
backdrop-filter: blur(8px);
transition: 160ms ease;
}
.world-label.selected {
border-color: rgba(142, 224, 129, 0.42);
color: white;
}
.world-label b {
display: block;
margin-top: 3px;
color: var(--green);
font-size: 10px;
}
#loading {
position: fixed;
inset: 0;
z-index: 30;
display: grid;
place-items: center;
background: #091310;
color: var(--green);
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 1100px) {
.trials-panel {
width: 218px;
}
.timeline {
left: 258px;
right: 392px;
}
.inspector {
width: 340px;
}
.model-badge {
display: none;
}
}
@media (max-width: 860px) {
.trials-panel {
display: none;
}
.timeline {
right: 12px;
left: 12px;
}
.inspector {
right: 12px;
width: 330px;
}
.topbar {
left: 14px;
right: 14px;
}
}
@media (max-width: 650px) {
.brand p,
#resetTrials {
display: none;
}
.brand h1 {
font-size: 12px;
}
.inspector {
top: 76px;
right: 10px;
left: 10px;
width: auto;
max-height: 48vh;
padding: 14px;
}
.timeline {
right: 10px;
bottom: 10px;
left: 10px;
padding: 11px;
}
.timeline-foot {
display: none;
}
.stage-label {
font-size: 7px;
}
.world-label {
display: none;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive voxel scene of three fictional seed germination trials"></div>
<div id="world-labels"></div>
<header class="topbar ui">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<span></span><span></span><span></span>
</div>
<div>
<h1>Seed / Reserve Lab</h1>
<p>Voxel germination rule inspector</p>
</div>
</div>
<div class="top-actions">
<div class="model-badge">Fictional model · not agronomic</div>
<button class="top-button" id="resetTrials" type="button">Reset trials</button>
<button class="top-button" id="resetView" type="button">Reset view</button>
</div>
</header>
<aside class="panel trials-panel ui">
<p class="panel-kicker">Comparison trials</p>
<h2>Three seed systems</h2>
<p class="panel-sub">
Change a trial’s starting reserve or light score. The same explicit
transition rules are applied to every specimen.
</p>
<div id="trialList" class="trial-list"></div>
<div class="legend">
<span><i style="background: var(--gold)"></i>Reserve units</span>
<span><i style="background: var(--blue)"></i>Light score</span>
</div>
</aside>
<aside class="panel inspector ui">
<div class="inspector-head">
<div>
<p class="panel-kicker">Inspector</p>
<h2 id="selectedTitle">Specimen A</h2>
</div>
<select id="specimenSelect" class="specimen-select" aria-label="Select specimen"></select>
</div>
<div class="control-block">
<div class="control-label">
<span>Initial reserve</span>
<strong id="reserveValue">35 units</strong>
</div>
<input
id="reserveSlider"
type="range"
min="10"
max="100"
step="1"
value="35"
aria-label="Initial fictional reserve"
/>
<div class="control-note">
Fictional units only. Reserve is consumed exactly as listed in the
transition table.
</div>
</div>
<div class="control-block">
<div class="control-label">
<span>Light availability</span>
<strong id="lightValue">70 / 100</strong>
</div>
<input
id="lightSlider"
type="range"
min="0"
max="100"
step="1"
value="70"
aria-label="Fictional light availability"
/>
<div class="control-note">
An abstract availability score, not lux. Light gates only the final
two transitions in this model.
</div>
</div>
<div class="control-block">
<div class="preset-title">Preset conditions</div>
<div class="presets">
<button class="preset" type="button" data-preset="reserve">Reserve-limited</button>
<button class="preset" type="button" data-preset="light">Light-limited</button>
<button class="preset" type="button" data-preset="full">All transitions pass</button>
</div>
</div>
<div id="outcome" class="outcome" aria-live="polite"></div>
<div class="gate-header">
Transition rules
<span>Fictional · deterministic</span>
</div>
<div id="gateList" class="gate-list"></div>
<button id="playButton" class="primary-button" type="button">
Replay all growth
</button>
<details>
<summary>Assumptions and intended use</summary>
<p>
This is an authored teaching model. Moisture is always adequate.
Species, dormancy, pathogens, temperature, soil, real reserve
chemistry, and field variability are not modeled. Outputs are not
predictions of germination, crop performance, seed viability, or
yield.
</p>
</details>
</aside>
<section class="panel timeline ui">
<div class="timeline-head">
<div class="timeline-title">Stage pathway</div>
<div id="timelineStatus" class="timeline-status"></div>
</div>
<div id="stageTrack" class="stage-track"></div>
<div class="timeline-foot">
<span>Drag to orbit · wheel to zoom · select a plot</span>
<span>Water is fixed adequate · no real-world calibration</span>
</div>
</section>
<div id="loading">Building voxel seed lab…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Fictional model rules
// -------------------------------------------------------------------------
const STAGES = [
"Wet seed",
"Radicle",
"Shoot",
"Cotyledons",
"True leaves",
"Independent"
];
const GATES = [
{
stage: "Radicle",
reserve: 10,
light: 0,
cost: 10,
description: "Root tip leaves the seed."
},
{
stage: "Shoot",
reserve: 10,
light: 0,
cost: 10,
description: "An embryonic shoot emerges."
},
{
stage: "Cotyledons",
reserve: 10,
light: 0,
cost: 10,
description: "Seed leaves expand."
},
{
stage: "True leaves",
reserve: 15,
light: 25,
cost: 15,
description: "True leaves form after light becomes sufficient."
},
{
stage: "Independent",
reserve: 20,
light: 50,
cost: 20,
description: "The seedling meets the final independence rule."
}
];
const DEFAULT_SPECIMENS = [
{
code: "A",
name: "Sparse",
reserve: 35,
light: 70,
x: -4.15
},
{
code: "B",
name: "Shade-bound",
reserve: 85,
light: 30,
x: 0
},
{
code: "C",
name: "Well-stocked",
reserve: 90,
light: 85,
x: 4.15
}
];
const PRESETS = {
reserve: { reserve: 35, light: 70 },
light: { reserve: 85, light: 30 },
full: { reserve: 90, light: 85 }
};
const specimens = DEFAULT_SPECIMENS.map((s) => ({ ...s }));
const visuals = [];
const hitMeshes = [];
const worldLabels = [];
let selectedIndex = 0;
let outcomes = [];
let currentStages = [];
let playTimer = null;
const sceneElement = document.getElementById("scene");
const trialList = document.getElementById("trialList");
const specimenSelect = document.getElementById("specimenSelect");
const reserveSlider = document.getElementById("reserveSlider");
const lightSlider = document.getElementById("lightSlider");
const reserveValue = document.getElementById("reserveValue");
const lightValue = document.getElementById("lightValue");
const selectedTitle = document.getElementById("selectedTitle");
const outcomeElement = document.getElementById("outcome");
const gateList = document.getElementById("gateList");
const stageTrack = document.getElementById("stageTrack");
const timelineStatus = document.getElementById("timelineStatus");
const playButton = document.getElementById("playButton");
const worldLabelsElement = document.getElementById("world-labels");
// -------------------------------------------------------------------------
// Three.js scene
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0x091310, 0.032);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Three voxel seed plots. Drag to orbit and click a plot to inspect it."
);
sceneElement.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xcce7da, 0x162015, 1.65);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xdff5d4, 1.25);
keyLight.position.set(-5, 9, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -12;
keyLight.shadow.camera.right = 12;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -8;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x6ba5b6, 0.65);
rimLight.position.set(8, 4, -7);
scene.add(rimLight);
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const material = {
floor: new THREE.MeshStandardMaterial({
color: 0x0d1c17,
roughness: 0.96
}),
plinth: new THREE.MeshStandardMaterial({
color: 0x22342c,
roughness: 0.82
}),
plinthEdge: new THREE.MeshStandardMaterial({
color: 0x41584d,
roughness: 0.72
}),
soil: new THREE.MeshStandardMaterial({
color: 0x4a3022,
roughness: 1
}),
soilDark: new THREE.MeshStandardMaterial({
color: 0x2d211b,
roughness: 1
}),
pebble: new THREE.MeshStandardMaterial({
color: 0x806147,
roughness: 1
}),
seed: new THREE.MeshStandardMaterial({
color: 0xd8a951,
roughness: 0.88
}),
root: new THREE.MeshStandardMaterial({
color: 0xf1e4bc,
roughness: 0.9
}),
stem: new THREE.MeshStandardMaterial({
color: 0x5fae55,
roughness: 0.86
}),
leaf: new THREE.MeshStandardMaterial({
color: 0x8bd36d,
roughness: 0.9
}),
leafDark: new THREE.MeshStandardMaterial({
color: 0x4f9c58,
roughness: 0.9
}),
leafLight: new THREE.MeshStandardMaterial({
color: 0xb4e578,
roughness: 0.9
}),
lamp: new THREE.MeshStandardMaterial({
color: 0xd8f7a5,
emissive: 0xb8ee71,
emissiveIntensity: 1.8,
roughness: 0.4
}),
hit: new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false,
colorWrite: false
})
};
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
material.floor
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -1.47;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(32, 32, 0x355044, 0x20342b);
grid.position.y = -1.455;
grid.material.transparent = true;
grid.material.opacity = 0.27;
scene.add(grid);
function addBox(parent, size, position, mat, castShadow = true) {
const mesh = new THREE.Mesh(unitBox, mat);
mesh.scale.set(size[0], size[1], size[2]);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function deterministicRandom(seed) {
let value = seed % 2147483647;
return () => {
value = (value * 16807) % 2147483647;
return (value - 1) / 2147483646;
};
}
// -------------------------------------------------------------------------
// Voxel plant construction
// -------------------------------------------------------------------------
function addLeafCluster(parent, x, y, z, scale, mat, direction = 1) {
addBox(
parent,
[0.38 * scale, 0.13 * scale, 0.22 * scale],
[x, y, z],
mat
);
addBox(
parent,
[0.22 * scale, 0.13 * scale, 0.22 * scale],
[x + direction * 0.24 * scale, y + 0.02 * scale, z],
mat
);
addBox(
parent,
[0.18 * scale, 0.13 * scale, 0.22 * scale],
[x + direction * 0.40 * scale, y + 0.04 * scale, z],
mat
);
}
function makePlantStage(stage) {
const group = new THREE.Group();
group.position.set(0, -0.13, 0);
// The seed becomes smaller as its reserve is transferred to the plant.
const seedScale = Math.max(0.1, 0.43 - stage * 0.06);
addBox(
group,
[seedScale, seedScale * 0.72, seedScale * 0.78],
[0, -0.01, 0.64],
material.seed
);
if (stage >= 1) {
const rootCount = Math.min(7, stage + 2);
for (let i = 0; i < rootCount; i++) {
const direction = i % 2 === 0 ? -1 : 1;
const bend = Math.sin(i * 1.7) * 0.1;
addBox(
group,
[0.17, 0.17, 0.17],
[
bend + direction * i * 0.025,
-0.2 - i * 0.17,
0.65 + Math.sin(i) * 0.018
],
material.root
);
if (i > 1 && i % 2 === 0) {
addBox(
group,
[0.13, 0.13, 0.13],
[
bend + direction * (0.1 + i * 0.025),
-0.28 - i * 0.17,
0.65
],
material.root
);
}
}
}
if (stage >= 2) {
const stemCount = Math.min(7, stage + 1);
for (let i = 0; i < stemCount; i++) {
addBox(
group,
[0.16, 0.22, 0.16],
[0, 0.12 + i * 0.19, 0.64],
i % 2 ? material.stem : material.leafDark
);
}
}
if (stage >= 3) {
addLeafCluster(group, -0.24, 0.57, 0.64, 1, material.leaf, -1);
addLeafCluster(group, 0.24, 0.57, 0.64, 1, material.leaf, 1);
}
if (stage >= 4) {
addLeafCluster(group, -0.28, 0.93, 0.64, 0.8, material.leafDark, -1);
addLeafCluster(group, 0.28, 0.93, 0.64, 0.8, material.leaf, 1);
addLeafCluster(group, -0.2, 1.16, 0.64, 0.65, material.leafLight, -1);
addLeafCluster(group, 0.2, 1.16, 0.64, 0.65, material.leafLight, 1);
}
if (stage >= 5) {
addLeafCluster(group, -0.31, 1.35, 0.64, 0.72, material.leaf, -1);
addLeafCluster(group, 0.31, 1.35, 0.64, 0.72, material.leaf, 1);
addLeafCluster(group, 0, 1.58, 0.64, 0.56, material.leafLight, 1);
addBox(
group,
[0.18, 0.22, 0.18],
[0, 1.53, 0.64],
material.stem
);
}
group.visible = false;
return group;
}
function createMeter(parent, x, color, type) {
const blocks = [];
const off = new THREE.Color(color);
const dim = new THREE.Color(0x26372f);
for (let i = 0; i < 10; i++) {
const blockMaterial = new THREE.MeshStandardMaterial({
color: off,
emissive: off,
emissiveIntensity: 0.42,
roughness: 0.56
});
const block = addBox(
parent,
[0.16, 0.135, 0.16],
[x, -1.03 + i * 0.18, 0.78],
blockMaterial
);
block.userData.type = type;
block.userData.activeColor = off.clone();
block.userData.dimColor = dim.clone();
blocks.push(block);
}
return blocks;
}
function updateMeter(blocks, amount) {
const activeCount = Math.ceil(Math.max(0, amount) / 10);
blocks.forEach((block, index) => {
const active = index < activeCount;
block.material.color.copy(
active ? block.userData.activeColor : block.userData.dimColor
);
block.material.emissive.copy(
active ? block.userData.activeColor : block.userData.dimColor
);
block.material.emissiveIntensity = active ? 0.48 : 0.04;
});
}
function createSpecimenVisual(specimen, index) {
const root = new THREE.Group();
root.position.x = specimen.x;
scene.add(root);
// Voxel planter and soil cross-section.
addBox(
root,
[2.9, 0.28, 2.42],
[0, -1.3, 0.18],
material.plinth
);
addBox(
root,
[2.64, 1.12, 1.76],
[0, -0.71, -0.31],
material.soil
);
addBox(
root,
[2.72, 0.12, 1.82],
[0, -0.19, -0.31],
material.soilDark
);
for (const x of [-1.35, 1.35]) {
addBox(
root,
[0.12, 1.15, 0.12],
[x, -0.69, 0.61],
material.plinthEdge
);
}
addBox(
root,
[2.82, 0.12, 0.12],
[0, -0.14, 0.61],
material.plinthEdge
);
const random = deterministicRandom(311 + index * 97);
for (let i = 0; i < 11; i++) {
const px = (random() - 0.5) * 2.25;
const pz = -0.95 + random() * 1.1;
addBox(
root,
[0.1 + random() * 0.12, 0.06, 0.1 + random() * 0.12],
[px, -0.105, pz],
material.pebble,
false
);
}
// Voxel light fixture and stepped light beam.
addBox(
root,
[0.36, 0.22, 0.36],
[0, 3.35, 0.18],
material.lamp
);
addBox(
root,
[0.1, 0.48, 0.1],
[0, 3.68, 0.18],
material.plinthEdge
);
const beamMaterial = new THREE.MeshBasicMaterial({
color: 0x9ee6c4,
transparent: true,
opacity: 0.02,
depthWrite: false,
blending: THREE.AdditiveBlending
});
for (let i = 0; i < 5; i++) {
const width = 0.52 + i * 0.17;
addBox(
root,
[width, 0.64, width],
[0, 3.0 - i * 0.63, 0.18],
beamMaterial,
false
);
}
const spotTarget = new THREE.Object3D();
spotTarget.position.set(0, -0.1, 0.55);
root.add(spotTarget);
const spot = new THREE.SpotLight(
0xd8f7ad,
2,
8,
Math.PI * 0.25,
0.55,
1.4
);
spot.position.set(0, 3.3, 0.18);
spot.target = spotTarget;
spot.castShadow = true;
spot.shadow.mapSize.set(512, 512);
spot.shadow.camera.near = 0.4;
spot.shadow.camera.far = 8;
root.add(spot);
const reserveMeter = createMeter(root, -1.18, 0xf0c46a, "reserve");
const lightMeter = createMeter(root, 1.18, 0x7fc9ed, "light");
// Selected-plot outline.
const outlineMaterial = new THREE.MeshBasicMaterial({
color: 0x9deb91,
transparent: true,
opacity: 0.75
});
const outline = new THREE.Group();
addBox(outline, [3.08, 0.045, 0.055], [0, -1.145, 1.41], outlineMaterial, false);
addBox(outline, [3.08, 0.045, 0.055], [0, -1.145, -1.04], outlineMaterial, false);
addBox(outline, [0.055, 0.045, 2.5], [-1.51, -1.145, 0.185], outlineMaterial, false);
addBox(outline, [0.055, 0.045, 2.5], [1.51, -1.145, 0.185], outlineMaterial, false);
root.add(outline);
const stageGroups = STAGES.map((_, stage) => {
const group = makePlantStage(stage);
root.add(group);
return group;
});
// Invisible selection volume.
const hitMesh = addBox(
root,
[3.2, 4.8, 2.8],
[0, 1.25, 0.15],
material.hit,
false
);
hitMesh.userData.specimenIndex = index;
hitMeshes.push(hitMesh);
const label = document.createElement("div");
label.className = "world-label";
worldLabelsElement.appendChild(label);
worldLabels.push({
element: label,
x: specimen.x,
root
});
return {
root,
stageGroups,
reserveMeter,
lightMeter,
outline,
outlineMaterial,
beamMaterial,
spot,
lamp: root.children.find(
(child) =>
child.isMesh &&
child.scale.x === 0.36 &&
child.scale.y === 0.22
),
currentStage: 0
};
}
specimens.forEach((specimen, index) => {
visuals.push(createSpecimenVisual(specimen, index));
});
// -------------------------------------------------------------------------
// Model evaluation and interface rendering
// -------------------------------------------------------------------------
function computeOutcome(specimen) {
let remaining = specimen.reserve;
let maxStage = 0;
let blocked = null;
const states = [];
for (let i = 0; i < GATES.length; i++) {
const gate = GATES[i];
const reservePass = remaining >= gate.reserve;
const lightPass = specimen.light >= gate.light;
const passed = reservePass && lightPass;
states.push({
passed,
reservePass,
lightPass,
remainingBefore: remaining
});
if (!passed) {
blocked = {
index: i,
gate,
remaining,
reason: !reservePass
? `Only ${remaining} reserve units remain; ${gate.reserve} are required`
: `Light score is ${specimen.light}; ${gate.light} is required`
};
break;
}
maxStage++;
remaining -= gate.cost;
}
return {
maxStage,
remaining,
blocked,
states
};
}
function remainingAtStage(initialReserve, stage) {
let remaining = initialReserve;
for (let i = 0; i < stage; i++) {
remaining -= GATES[i].cost;
}
return remaining;
}
function recomputeOutcomes() {
outcomes = specimens.map(computeOutcome);
}
function setSelected(index) {
selectedIndex = index;
specimenSelect.value = String(index);
visuals.forEach((visual, visualIndex) => {
const selected = visualIndex === index;
visual.outline.visible = selected;
visual.outlineMaterial.opacity = selected ? 0.76 : 0;
worldLabels[visualIndex].element.classList.toggle("selected", selected);
});
renderUI();
}
function renderTrialList() {
trialList.innerHTML = specimens
.map((specimen, index) => {
const outcome = outcomes[index];
const selected = index === selectedIndex ? " selected" : "";
return `
<button
class="trial-card${selected}"
type="button"
data-specimen="${index}"
>
<div class="trial-top">
<div class="trial-name">
<span class="trial-code">${specimen.code}</span>
${specimen.name}
</div>
<div class="trial-stage">${STAGES[outcome.maxStage]}</div>
</div>
<div class="mini-bars">
<div class="mini-row">
<span>Reserve</span>
<div class="mini-track">
<div
class="mini-fill reserve"
style="width:${specimen.reserve}%"
></div>
</div>
<span>${specimen.reserve}</span>
</div>
<div class="mini-row">
<span>Light</span>
<div class="mini-track">
<div
class="mini-fill light"
style="width:${specimen.light}%"
></div>
</div>
<span>${specimen.light}</span>
</div>
</div>
</button>
`;
})
.join("");
trialList.querySelectorAll("[data-specimen]").forEach((button) => {
button.addEventListener("click", () => {
setSelected(Number(button.dataset.specimen));
});
});
}
function renderInspector() {
const specimen = specimens[selectedIndex];
const outcome = outcomes[selectedIndex];
selectedTitle.textContent = `Specimen ${specimen.code} · ${specimen.name}`;
reserveSlider.value = specimen.reserve;
lightSlider.value = specimen.light;
reserveValue.textContent = `${specimen.reserve} units`;
lightValue.textContent = `${specimen.light} / 100`;
if (outcome.blocked) {
const blockedStage = outcome.blocked.gate.stage;
outcomeElement.className = "outcome";
outcomeElement.innerHTML = `
<div class="outcome-kicker">Growth limit found</div>
<strong>Cannot pass into ${blockedStage}</strong>
<p>${outcome.blocked.reason}.</p>
`;
} else {
outcomeElement.className = "outcome pass";
outcomeElement.innerHTML = `
<div class="outcome-kicker">All transitions pass</div>
<strong>Independent seedling</strong>
<p>${outcome.remaining} fictional reserve units remain at the end of
the modeled sequence.</p>
`;
}
gateList.innerHTML = GATES.map((gate, index) => {
const passed = index < outcome.maxStage;
const blocked = index === outcome.maxStage;
const locked = index > outcome.maxStage;
const stateClass = blocked
? "blocked"
: locked
? "locked"
: "";
const icon = passed ? "✓" : blocked ? "!" : "·";
const lightRequirement =
gate.light > 0 ? ` · light ≥ ${gate.light}` : " · no light gate";
return `
<div class="gate ${stateClass}">
<div class="gate-icon">${icon}</div>
<div>
<div class="gate-title">→ ${gate.stage}</div>
<div class="gate-rule">
reserve ≥ ${gate.reserve}${lightRequirement}
</div>
</div>
<div class="gate-cost">−${gate.cost} R</div>
</div>
`;
}).join("");
}
function renderTimeline() {
const outcome = outcomes[selectedIndex];
const current = currentStages[selectedIndex];
stageTrack.innerHTML = STAGES.map((stage, index) => {
const reached = index <= current;
const active = index === current;
const blocked = outcome.maxStage < 5 && index === outcome.maxStage + 1;
const classes = [
"stage-node",
reached ? "reached" : "",
active ? "active" : "",
blocked ? "blocked" : ""
]
.filter(Boolean)
.join(" ");
return `
<div class="${classes}">
<div class="stage-dot"></div>
<div class="stage-label">${stage}</div>
</div>
`;
}).join("");
timelineStatus.textContent =
`Current: ${STAGES[current]} · Reachable ceiling: ${STAGES[outcome.maxStage]}`;
}
function renderWorldLabelText() {
specimens.forEach((specimen, index) => {
const outcome = outcomes[index];
worldLabels[index].element.innerHTML = `
<span>${specimen.code} · ${specimen.name}</span>
<b>${STAGES[outcome.maxStage]}</b>
`;
});
}
function renderUI() {
renderTrialList();
renderInspector();
renderTimeline();
renderWorldLabelText();
}
function setVisualStage(index, stage, animate = true) {
const visual = visuals[index];
const specimen = specimens[index];
visual.stageGroups.forEach((group, groupIndex) => {
group.visible = groupIndex === stage;
});
const activeGroup = visual.stageGroups[stage];
if (animate) {
activeGroup.scale.set(1, 0.08, 1);
activeGroup.userData.animStart = performance.now();
} else {
activeGroup.scale.set(1, 1, 1);
}
const remaining = remainingAtStage(specimen.reserve, stage);
updateMeter(visual.reserveMeter, remaining);
updateMeter(visual.lightMeter, specimen.light);
visual.currentStage = stage;
}
function updateAllVisuals(animate = true) {
specimens.forEach((_, index) => {
setVisualStage(index, currentStages[index], animate);
});
}
function stopPlayback() {
if (playTimer !== null) {
clearInterval(playTimer);
playTimer = null;
}
playButton.disabled = false;
playButton.textContent = "Replay all growth";
}
function resetTrials() {
stopPlayback();
specimens.forEach((specimen, index) => {
Object.assign(specimen, DEFAULT_SPECIMENS[index]);
});
recomputeOutcomes();
currentStages = outcomes.map((outcome) => outcome.maxStage);
updateAllVisuals(true);
renderUI();
}
// -------------------------------------------------------------------------
// Controls
// -------------------------------------------------------------------------
specimens.forEach((specimen, index) => {
const option = document.createElement("option");
option.value = String(index);
option.textContent = `${specimen.code} · ${specimen.name}`;
specimenSelect.appendChild(option);
});
specimenSelect.addEventListener("change", () => {
setSelected(Number(specimenSelect.value));
});
reserveSlider.addEventListener("input", (event) => {
stopPlayback();
specimens[selectedIndex].reserve = Number(event.target.value);
recomputeOutcomes();
currentStages[selectedIndex] = outcomes[selectedIndex].maxStage;
setVisualStage(selectedIndex, currentStages[selectedIndex], true);
renderUI();
});
lightSlider.addEventListener("input", (event) => {
stopPlayback();
specimens[selectedIndex].light = Number(event.target.value);
recomputeOutcomes();
currentStages[selectedIndex] = outcomes[selectedIndex].maxStage;
setVisualStage(selectedIndex, currentStages[selectedIndex], true);
renderUI();
});
document.querySelectorAll("[data-preset]").forEach((button) => {
button.addEventListener("click", () => {
stopPlayback();
const preset = PRESETS[button.dataset.preset];
specimens[selectedIndex].reserve = preset.reserve;
specimens[selectedIndex].light = preset.light;
recomputeOutcomes();
currentStages[selectedIndex] = outcomes[selectedIndex].maxStage;
setVisualStage(selectedIndex, currentStages[selectedIndex], true);
renderUI();
});
});
playButton.addEventListener("click", () => {
stopPlayback();
currentStages = specimens.map(() => 0);
updateAllVisuals(true);
renderUI();
playButton.disabled = true;
playButton.textContent = "Growing…";
playTimer = window.setInterval(() => {
let changed = false;
specimens.forEach((_, index) => {
if (currentStages[index] < outcomes[index].maxStage) {
currentStages[index]++;
changed = true;
}
});
if (changed) {
specimens.forEach((_, index) => {
setVisualStage(index, currentStages[index], true);
});
renderTimeline();
renderWorldLabelText();
}
if (currentStages.every((stage, index) => stage === outcomes[index].maxStage)) {
stopPlayback();
renderUI();
}
}, 820);
});
document.getElementById("resetTrials").addEventListener("click", resetTrials);
// -------------------------------------------------------------------------
// Direct camera controls: no Three.js addons
// -------------------------------------------------------------------------
const cameraState = {
theta: 0.06,
phi: 1.03,
radius: 14.6,
targetTheta: 0.06,
targetPhi: 1.03,
targetRadius: 14.6
};
const cameraTarget = new THREE.Vector3(0, 0.72, 0);
function resetCamera() {
cameraState.targetTheta = 0.06;
cameraState.targetPhi = 1.03;
cameraState.targetRadius = 14.6;
}
document.getElementById("resetView").addEventListener("click", resetCamera);
function updateCamera() {
cameraState.theta +=
(cameraState.targetTheta - cameraState.theta) * 0.12;
cameraState.phi +=
(cameraState.targetPhi - cameraState.phi) * 0.12;
cameraState.radius +=
(cameraState.targetRadius - cameraState.radius) * 0.12;
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraTarget.x +
cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraTarget.y + cameraState.radius * Math.cos(cameraState.phi),
cameraTarget.z +
cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraTarget);
}
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const drag = {
active: false,
moved: false,
lastX: 0,
lastY: 0
};
renderer.domElement.addEventListener("pointerdown", (event) => {
drag.active = true;
drag.moved = false;
drag.lastX = event.clientX;
drag.lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!drag.active) return;
const dx = event.clientX - drag.lastX;
const dy = event.clientY - drag.lastY;
if (Math.abs(dx) + Math.abs(dy) > 3) {
drag.moved = true;
}
cameraState.targetTheta -= dx * 0.006;
cameraState.targetPhi = THREE.MathUtils.clamp(
cameraState.targetPhi + dy * 0.005,
0.42,
1.38
);
drag.lastX = event.clientX;
drag.lastY = event.clientY;
});
renderer.domElement.addEventListener("pointerup", (event) => {
drag.active = false;
if (!drag.moved) {
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;
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(hitMeshes, false);
if (hits.length) {
setSelected(hits[0].object.userData.specimenIndex);
}
}
});
renderer.domElement.addEventListener("pointercancel", () => {
drag.active = false;
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.targetRadius = THREE.MathUtils.clamp(
cameraState.targetRadius + event.deltaY * 0.012,
9.5,
23
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
// -------------------------------------------------------------------------
// Resize and animation
// -------------------------------------------------------------------------
function onResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", onResize);
const projected = new THREE.Vector3();
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
specimens.forEach((specimen, index) => {
const visual = visuals[index];
const activeGroup = visual.stageGroups[visual.currentStage];
if (activeGroup.userData.animStart !== undefined) {
const progress = Math.min(
1,
(performance.now() - activeGroup.userData.animStart) / 380
);
const eased = 1 - Math.pow(1 - progress, 3);
activeGroup.scale.y = 0.08 + eased * 0.92;
if (progress >= 1) {
delete activeGroup.userData.animStart;
}
}
visual.spot.intensity = 0.2 + specimen.light * 0.15;
visual.beamMaterial.opacity = 0.004 + specimen.light * 0.00027;
if (visual.lamp) {
visual.lamp.material.emissiveIntensity =
0.8 + specimen.light * 0.018 +
Math.sin(elapsed * 2.2 + index) * 0.12;
}
});
updateCamera();
renderer.render(scene, camera);
worldLabels.forEach((label) => {
projected.set(label.x, 3.96, 0.18).project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.15 &&
Math.abs(projected.y) < 1.15;
label.element.style.display = visible ? "block" : "none";
if (visible) {
label.element.style.left =
`${(projected.x * 0.5 + 0.5) * window.innerWidth}px`;
label.element.style.top =
`${(-projected.y * 0.5 + 0.5) * window.innerHeight}px`;
}
});
}
recomputeOutcomes();
currentStages = outcomes.map((outcome) => outcome.maxStage);
updateAllVisuals(false);
setSelected(0);
updateCamera();
renderer.render(scene, camera);
animate();
requestAnimationFrame(() => {
document.getElementById("loading").classList.add("hidden");
});
</script>
</body>
</html>
```