Prompt specification
Build or customize the Three.js 3D scene "Climate archive observation station" 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: Climate archive observation station
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/climate-archive-observation-station-x1271
Scene Description Prompt:
Please make a voxel Three.js scene in one standalone HTML file using cdnjs. Compose a weather station, calendar wall, and multiyear stacked summaries; animate aggregation from days to longer periods while preserving explicit synthetic-data labels.
Working Three.js Starter (climate-archive-observation-station-x1271):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Voxel Weather Observatory — Synthetic Data</title>
<style>
:root {
color-scheme: dark;
--ink: #eaf7ff;
--muted: #8ca9bc;
--cyan: #58e2dc;
--amber: #ffd071;
--panel: rgba(10, 23, 36, 0.82);
--line: rgba(142, 211, 231, 0.22);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #07121f;
color: var(--ink);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
.ui {
position: fixed;
inset: 0;
pointer-events: none;
}
.brand {
position: absolute;
top: 22px;
left: 24px;
max-width: min(510px, calc(100vw - 48px));
text-shadow: 0 2px 18px #000;
}
.brand h1 {
margin: 0 0 8px;
font-size: clamp(18px, 2vw, 29px);
line-height: 1.05;
letter-spacing: 0.08em;
}
.synthetic-badge {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border: 1px solid rgba(255, 208, 113, 0.55);
border-radius: 4px;
background: rgba(45, 34, 15, 0.72);
color: var(--amber);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.12em;
}
.synthetic-badge::before {
content: "";
width: 7px;
height: 7px;
background: var(--amber);
box-shadow: 0 0 12px var(--amber);
}
.panel {
border: 1px solid var(--line);
background: var(--panel);
box-shadow: 0 14px 45px rgba(0, 0, 0, 0.28);
backdrop-filter: blur(14px);
}
.readout {
position: absolute;
top: 22px;
right: 24px;
width: 278px;
padding: 16px;
border-radius: 8px;
}
.eyebrow {
color: var(--cyan);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
}
.readout-main {
display: flex;
align-items: baseline;
gap: 8px;
margin: 9px 0 13px;
}
.readout-main strong {
font-size: 35px;
line-height: 1;
color: #fff;
}
.readout-main span {
color: var(--muted);
font-size: 10px;
letter-spacing: 0.08em;
}
.metrics {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.metric {
min-width: 0;
padding-top: 9px;
border-top: 1px solid var(--line);
}
.metric small {
display: block;
margin-bottom: 5px;
color: var(--muted);
font-size: 8px;
letter-spacing: 0.07em;
}
.metric b {
display: block;
overflow: hidden;
color: var(--ink);
font-size: 14px;
text-overflow: ellipsis;
white-space: nowrap;
}
.scope {
margin-top: 13px;
color: var(--muted);
font-size: 9px;
line-height: 1.5;
}
.controls {
position: absolute;
left: 50%;
bottom: 24px;
width: min(880px, calc(100vw - 32px));
padding: 13px;
border-radius: 10px;
transform: translateX(-50%);
pointer-events: auto;
}
.control-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 11px;
}
.control-title {
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
}
.focus {
display: flex;
align-items: center;
gap: 8px;
color: var(--muted);
font-size: 10px;
}
select,
button {
min-height: 34px;
border: 1px solid rgba(143, 205, 225, 0.26);
border-radius: 5px;
background: rgba(24, 48, 65, 0.9);
color: var(--ink);
font: inherit;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
cursor: pointer;
}
select {
padding: 0 28px 0 10px;
}
button {
padding: 0 13px;
transition:
border-color 160ms ease,
background 160ms ease,
color 160ms ease,
transform 160ms ease;
}
button:hover {
border-color: var(--cyan);
transform: translateY(-1px);
}
button.active {
border-color: var(--cyan);
background: rgba(88, 226, 220, 0.18);
color: #fff;
box-shadow: inset 0 0 18px rgba(88, 226, 220, 0.08);
}
.modes {
display: grid;
grid-template-columns: repeat(5, 1fr) auto auto;
gap: 7px;
}
.mode-button {
min-width: 0;
padding: 0 8px;
}
.utility {
color: var(--muted);
}
.help {
position: absolute;
right: 24px;
bottom: 29px;
color: rgba(190, 220, 235, 0.65);
font-size: 9px;
line-height: 1.6;
text-align: right;
text-shadow: 0 2px 8px #000;
}
.warning {
position: absolute;
left: 24px;
bottom: 29px;
max-width: 250px;
color: rgba(255, 208, 113, 0.75);
font-size: 9px;
line-height: 1.6;
}
@media (max-width: 900px) {
.readout {
top: auto;
right: 16px;
bottom: 146px;
width: 242px;
}
.warning,
.help {
display: none;
}
.brand {
top: 16px;
left: 16px;
}
.controls {
bottom: 14px;
}
}
@media (max-width: 650px) {
.readout {
display: none;
}
.controls {
width: calc(100vw - 20px);
padding: 10px;
}
.control-top {
align-items: flex-start;
flex-direction: column;
gap: 8px;
}
.modes {
grid-template-columns: repeat(3, 1fr);
}
.focus {
width: 100%;
justify-content: space-between;
}
}
</style>
</head>
<body>
<div class="ui">
<header class="brand">
<h1>VOXEL WEATHER OBSERVATORY</h1>
<div class="synthetic-badge">SYNTHETIC DATA · NOT OBSERVATIONS</div>
</header>
<section class="readout panel" aria-live="polite">
<div class="eyebrow" id="grainLabel">SYNTHETIC · DAY GRAIN</div>
<div class="readout-main">
<strong id="blockCount">365</strong>
<span id="blockCaption">VOXELS / FOCUS YEAR</span>
</div>
<div class="metrics">
<div class="metric">
<small>SYNTHETIC RAIN</small>
<b id="rainValue">0 mm</b>
</div>
<div class="metric">
<small>MEAN TEMP</small>
<b id="tempValue">0 °C</b>
</div>
<div class="metric">
<small>MEAN WIND</small>
<b id="windValue">0 m/s</b>
</div>
</div>
<div class="scope" id="scopeValue">FOCUS 2025 · SEEDED GENERATOR</div>
</section>
<section class="controls panel">
<div class="control-top">
<div class="control-title">AGGREGATION PERIOD / ANIMATE THE DATA GRANULARITY</div>
<label class="focus">
FOCUS SYNTHETIC YEAR
<select id="yearSelect" aria-label="Focus synthetic year">
<option>2020</option>
<option>2021</option>
<option>2022</option>
<option>2023</option>
<option>2024</option>
<option selected>2025</option>
</select>
</label>
</div>
<div class="modes">
<button class="mode-button active" data-mode="day">DAY</button>
<button class="mode-button" data-mode="week">WEEK</button>
<button class="mode-button" data-mode="month">MONTH</button>
<button class="mode-button" data-mode="quarter">QUARTER</button>
<button class="mode-button" data-mode="year">YEAR</button>
<button id="playButton" class="utility">AUTO ▶</button>
<button id="resetButton" class="utility">RESET VIEW</button>
</div>
</section>
<div class="warning">
Every observation, calendar cell, weather reading, and multiyear total in
this scene is deterministically generated synthetic data.
</div>
<div class="help">
DRAG TO ORBIT · WHEEL TO ZOOM · R TO RESET<br />
ALL VISUALS LABELED SYNTHETIC
</div>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ---------------------------------------------------------------------
// Renderer, camera, lighting
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x07121f);
scene.fog = new THREE.Fog(0x07121f, 19, 34);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
80
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.18;
document.body.prepend(renderer.domElement);
const hemi = new THREE.HemisphereLight(0xbfefff, 0x182132, 2.15);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xfff0cc, 3.25);
sun.position.set(-7, 12, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -12;
sun.shadow.camera.right = 12;
sun.shadow.camera.top = 12;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 35;
sun.shadow.bias = -0.00025;
scene.add(sun);
const cyanLight = new THREE.PointLight(0x4ce8e1, 18, 14, 2);
cyanLight.position.set(4, 4.5, 2);
scene.add(cyanLight);
const amberLight = new THREE.PointLight(0xffbd66, 10, 10, 2);
amberLight.position.set(-6, 4, 0);
scene.add(amberLight);
const cameraTarget = new THREE.Vector3(0, 1.55, 0);
const cameraState = {
theta: 0.47,
phi: 1.0,
radius: 18.5
};
function updateCamera() {
const { theta, phi, radius } = cameraState;
const horizontal = Math.sin(phi) * radius;
camera.position.set(
cameraTarget.x + Math.sin(theta) * horizontal,
cameraTarget.y + Math.cos(phi) * radius,
cameraTarget.z + Math.cos(theta) * horizontal
);
camera.lookAt(cameraTarget);
}
updateCamera();
// Custom camera controls: no addons are used.
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi + dy * 0.005,
0.48,
1.36
);
});
function stopDragging() {
dragging = false;
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.012,
11.5,
26
);
},
{ passive: false }
);
function resetCamera() {
cameraState.theta = 0.47;
cameraState.phi = 1.0;
cameraState.radius = 18.5;
}
document.getElementById("resetButton").addEventListener("click", resetCamera);
addEventListener("keydown", (event) => {
if (event.target instanceof HTMLSelectElement) return;
if (event.key.toLowerCase() === "r") resetCamera();
if (event.key === "ArrowLeft") {
cameraState.theta -= 0.08;
}
if (event.key === "ArrowRight") {
cameraState.theta += 0.08;
}
});
addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
});
// ---------------------------------------------------------------------
// Materials and voxel helpers
// ---------------------------------------------------------------------
function standard(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.02,
...options
});
}
const materials = {
floor: standard(0x172b38, { roughness: 0.94 }),
floorEdge: standard(0x284657),
panel: standard(0x203c4a),
frame: standard(0x0d202c),
white: standard(0xeaf5ef),
blue: standard(0x68cde0),
cyan: standard(0x57e3d9, {
emissive: 0x164c53,
emissiveIntensity: 0.7
}),
amber: standard(0xffbe68, {
emissive: 0x563410,
emissiveIntensity: 0.45
}),
red: standard(0xf07467),
dark: standard(0x12212c),
metal: standard(0x79939f, { metalness: 0.55, roughness: 0.42 }),
glass: standard(0x72d9e9, {
transparent: true,
opacity: 0.72,
emissive: 0x174d5d,
emissiveIntensity: 0.55
})
};
function addBox(
parent,
width,
height,
depth,
material,
x = 0,
y = 0,
z = 0
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addEdges(parent, width, height, depth, x, y, z, color = 0x5a8798) {
const geometry = new THREE.EdgesGeometry(
new THREE.BoxGeometry(width, height, depth)
);
const lines = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0.5
})
);
lines.position.set(x, y, z);
parent.add(lines);
return lines;
}
function roundedRect(ctx, x, y, width, height, radius) {
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(
x + width,
y + height,
x + width - radius,
y + height
);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
}
function makeTextTexture(
text,
{
foreground = "#eaf7ff",
background = "rgba(8,25,37,0.88)",
border = "#58e2dc",
width = 1024,
height = 128
} = {}
) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, width, height);
roundedRect(ctx, 4, 4, width - 8, height - 8, 12);
ctx.fillStyle = background;
ctx.fill();
ctx.strokeStyle = border;
ctx.lineWidth = 4;
ctx.stroke();
const fontSize =
text.length > 58 ? 27 : text.length > 44 ? 33 : text.length > 32 ? 39 : 47;
ctx.font = `800 ${fontSize}px ui-monospace, Menlo, Consolas, monospace`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = foreground;
ctx.fillText(text, width / 2, height / 2 + 2, width - 40);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
texture.needsUpdate = true;
return texture;
}
function makePlaneText(text, width, height, options = {}) {
const texture = makeTextTexture(text, options);
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
side: THREE.DoubleSide
});
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
material
);
mesh.userData.setText = (nextText) => {
const nextTexture = makeTextTexture(nextText, options);
material.map.dispose();
material.map = nextTexture;
material.needsUpdate = true;
};
return mesh;
}
function makeSpriteText(
text,
width,
height,
options = {}
) {
const texture = makeTextTexture(text, options);
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, height, 1);
sprite.renderOrder = 20;
sprite.userData.setText = (nextText) => {
const nextTexture = makeTextTexture(nextText, options);
material.map.dispose();
material.map = nextTexture;
material.needsUpdate = true;
};
return sprite;
}
// ---------------------------------------------------------------------
// Platform and grid
// ---------------------------------------------------------------------
const world = new THREE.Group();
scene.add(world);
addBox(world, 16, 0.46, 9, materials.floor, 0, -0.27, 0);
addEdges(world, 16, 0.46, 9, 0, -0.27, 0, 0x55869a);
addBox(world, 16.1, 0.08, 9.1, materials.floorEdge, 0, -0.51, 0);
const gridPositions = [];
for (let x = -8; x <= 8.001; x += 0.5) {
gridPositions.push(x, 0.005, -4.5, x, 0.005, 4.5);
}
for (let z = -4.5; z <= 4.501; z += 0.5) {
gridPositions.push(-8, 0.005, z, 8, 0.005, z);
}
const gridGeometry = new THREE.BufferGeometry();
gridGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(gridPositions, 3)
);
const grid = new THREE.LineSegments(
gridGeometry,
new THREE.LineBasicMaterial({
color: 0x7cb4c7,
transparent: true,
opacity: 0.12
})
);
world.add(grid);
const globalBadge = makeSpriteText(
"ALL VALUES SYNTHETIC · NOT OBSERVATIONS",
6.4,
0.48,
{
foreground: "#ffd071",
background: "rgba(30,24,12,0.86)",
border: "#ffd071"
}
);
globalBadge.position.set(0, 0.25, 4.55);
world.add(globalBadge);
// ---------------------------------------------------------------------
// Voxel weather station
// ---------------------------------------------------------------------
const weather = new THREE.Group();
weather.position.set(-5.45, 0, -1.1);
world.add(weather);
addBox(weather, 3.35, 0.24, 3.1, materials.floorEdge, 0, 0.12, 0);
addEdges(weather, 3.35, 0.24, 3.1, 0, 0.12, 0);
addBox(weather, 0.72, 0.28, 0.72, materials.dark, 0, 0.38, 0);
addBox(weather, 0.18, 2.95, 0.18, materials.metal, 0, 1.96, 0);
// Sensor housing and roof.
addBox(weather, 0.86, 0.58, 0.72, materials.white, 0, 3.55, 0);
addBox(weather, 1.02, 0.12, 0.86, materials.red, 0, 3.9, 0);
addBox(weather, 0.72, 0.12, 0.62, materials.red, 0, 4.02, 0);
addBox(weather, 0.5, 0.27, 0.03, materials.cyan, 0, 3.58, 0.37);
// Louvered Stevenson screen.
addBox(weather, 0.68, 0.62, 0.58, materials.white, -0.35, 1.62, 0.02);
for (let i = 0; i < 5; i++) {
addBox(
weather,
0.52,
0.035,
0.03,
materials.dark,
-0.35,
1.4 + i * 0.105,
0.32
);
}
// Rain gauge on an arm.
addBox(weather, 0.95, 0.09, 0.09, materials.metal, 0.55, 1.72, 0);
const gauge = new THREE.Group();
gauge.position.set(1.05, 1.82, 0);
weather.add(gauge);
addBox(gauge, 0.48, 0.06, 0.48, materials.metal, 0, -0.22, 0);
addBox(gauge, 0.05, 0.42, 0.48, materials.metal, -0.23, 0, 0);
addBox(gauge, 0.05, 0.42, 0.48, materials.metal, 0.23, 0, 0);
addBox(gauge, 0.48, 0.42, 0.05, materials.metal, 0, 0, -0.23);
addBox(gauge, 0.48, 0.42, 0.05, materials.metal, 0, 0, 0.23);
addBox(gauge, 0.39, 0.18, 0.39, materials.glass, 0, -0.08, 0);
// Wind vane.
const windVane = new THREE.Group();
windVane.position.set(0, 4.35, 0);
weather.add(windVane);
addBox(windVane, 0.06, 0.65, 0.06, materials.metal, 0, -0.18, 0);
addBox(windVane, 1.18, 0.07, 0.07, materials.metal, 0.16, 0.15, 0);
addBox(windVane, 0.35, 0.4, 0.05, materials.amber, -0.45, 0.16, 0);
const arrowTop = addBox(
windVane,
0.36,
0.08,
0.08,
materials.amber,
0.68,
0.15,
0
);
arrowTop.rotation.z = Math.PI / 4;
const arrowBottom = addBox(
windVane,
0.36,
0.08,
0.08,
materials.amber,
0.68,
0.15,
0
);
arrowBottom.rotation.z = -Math.PI / 4;
// Three-cup anemometer.
const anemometer = new THREE.Group();
anemometer.position.set(0, 4.72, 0);
weather.add(anemometer);
addBox(anemometer, 0.08, 0.4, 0.08, materials.metal, 0, -0.1, 0);
for (let i = 0; i < 3; i++) {
const angle = (i / 3) * Math.PI * 2;
const arm = addBox(
anemometer,
0.64,
0.045,
0.045,
materials.metal,
0,
0.12,
0
);
arm.rotation.y = angle;
const cup = addBox(
anemometer,
0.2,
0.18,
0.2,
i === 1 ? materials.cyan : materials.white,
Math.cos(angle) * 0.31,
0.12,
Math.sin(angle) * 0.31
);
cup.rotation.y = angle;
}
// Synthetic falling droplets near the rain gauge.
const droplets = [];
for (let i = 0; i < 9; i++) {
const drop = addBox(
weather,
0.055,
0.13,
0.055,
materials.cyan,
0.85 + (i % 3) * 0.18,
2.5 + Math.floor(i / 3) * 0.22,
-0.25 + Math.floor(i / 3) * 0.16
);
droplets.push({
mesh: drop,
speed: 0.8 + (i % 4) * 0.13,
offset: i * 0.17
});
}
// Decorative voxel sun and cloud.
const sunGroup = new THREE.Group();
sunGroup.position.set(-7.05, 4.05, -3.05);
world.add(sunGroup);
addBox(sunGroup, 0.62, 0.62, 0.22, materials.amber);
addBox(sunGroup, 0.92, 0.12, 0.22, materials.amber);
addBox(sunGroup, 0.12, 0.92, 0.22, materials.amber);
const cloud = new THREE.Group();
cloud.position.set(-5.45, 4.45, -3.1);
world.add(cloud);
addBox(cloud, 1.7, 0.45, 0.48, materials.white, 0, 0, 0);
addBox(cloud, 0.68, 0.68, 0.48, materials.white, -0.38, 0.25, 0);
addBox(cloud, 0.9, 0.58, 0.48, materials.white, 0.38, 0.18, 0);
addBox(cloud, 1.25, 0.22, 0.5, materials.blue, 0.12, -0.23, 0);
const weatherLabel = makeSpriteText(
"SYNTHETIC WEATHER STATION",
3.55,
0.43,
{
foreground: "#58e2dc",
border: "#58e2dc"
}
);
weatherLabel.position.set(-5.45, 0.55, 0.53);
world.add(weatherLabel);
// ---------------------------------------------------------------------
// Synthetic data generator
// ---------------------------------------------------------------------
const YEARS = [2020, 2021, 2022, 2023, 2024, 2025];
const MONTH_NAMES = [
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"
];
function mulberry32(seed) {
let value = seed >>> 0;
return function random() {
value += 0x6d2b79f5;
let result = value;
result = Math.imul(result ^ (result >>> 15), result | 1);
result ^=
result +
Math.imul(result ^ (result >>> 7), result | 61);
return ((result ^ (result >>> 14)) >>> 0) / 4294967296;
};
}
function monthLengths(year) {
return [
31,
(year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 ? 29 : 28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
];
}
function summarize(days) {
const count = Math.max(1, days.length);
return {
count: days.length,
rain: days.reduce((sum, day) => sum + day.rain, 0),
temp: days.reduce((sum, day) => sum + day.temp, 0) / count,
wind: days.reduce((sum, day) => sum + day.wind, 0) / count
};
}
function makeDataset(year) {
const random = mulberry32(year * 7919 + 104729);
const lengths = monthLengths(year);
const days = [];
let ordinal = 0;
for (let month = 0; month < 12; month++) {
for (let day = 1; day <= lengths[month]; day++) {
const phase = (ordinal / 365) * Math.PI * 2;
const season = Math.sin(phase - 0.45);
const wetSeason = Math.max(0, Math.sin(phase - 1.2));
const temp =
12.5 +
season * 10.5 +
(random() - 0.5) * 4.2;
const rain = Math.max(
0,
(random() - 0.73) * 31 + wetSeason * 15
);
const wind =
1.3 +
(0.5 + 0.5 * Math.sin(phase * 2.15)) * 4.1 +
(random() - 0.5) * 1.7;
days.push({
year,
month,
day,
ordinal,
temp,
rain,
wind
});
ordinal++;
}
}
const months = lengths.map((length, month) =>
days.filter((day) => day.month === month)
);
const quarters = [0, 1, 2, 3].map((quarter) =>
days.filter(
(day) =>
day.month >= quarter * 3 &&
day.month < quarter * 3 + 3
)
);
return {
year,
days,
months,
quarters,
monthSummaries: months.map(summarize),
quarterSummaries: quarters.map(summarize)
};
}
const datasets = new Map(
YEARS.map((year) => [year, makeDataset(year)])
);
let focusYear = 2025;
let currentMode = "day";
// ---------------------------------------------------------------------
// Calendar wall: 12 months × 31 day cells
// ---------------------------------------------------------------------
const calendar = new THREE.Group();
calendar.position.set(-0.55, 0, -3.72);
world.add(calendar);
addBox(calendar, 7.0, 3.82, 0.2, materials.frame, 0, 2.55, 0);
addBox(calendar, 6.82, 3.62, 0.16, materials.panel, 0, 2.55, 0.05);
addEdges(calendar, 7.0, 3.82, 0.2, 0, 2.55, 0, 0x6da3b6);
const calendarTitle = makePlaneText(
"CALENDAR WALL / SYNTHETIC DAILY RAIN",
6.35,
0.38,
{
foreground: "#eaf7ff",
border: "#58e2dc"
}
);
calendarTitle.position.set(0, 4.13, 0.17);
calendar.add(calendarTitle);
const calendarFocus = makePlaneText(
"FOCUS 2025 / SEEDED SYNTHETIC VALUES",
4.8,
0.25,
{
foreground: "#ffd071",
background: "rgba(32,27,15,0.8)",
border: "#ffd071"
}
);
calendarFocus.position.set(0, 0.84, 0.17);
calendar.add(calendarFocus);
const calendarCells = new THREE.InstancedMesh(
new THREE.BoxGeometry(0.12, 0.12, 0.055),
standard(0xffffff, { roughness: 0.88 }),
12 * 31
);
calendarCells.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
calendarCells.castShadow = true;
calendarCells.receiveShadow = true;
calendar.add(calendarCells);
const monthLabelSprites = [];
for (let month = 0; month < 12; month++) {
const label = makeSpriteText(
MONTH_NAMES[month],
0.5,
0.22,
{
foreground: "#a8c9d8",
background: "rgba(8,25,37,0.75)",
border: "rgba(88,226,220,0.35)"
}
);
label.position.set(-3.25, 3.55 - month * 0.205, 0.23);
calendar.add(label);
monthLabelSprites.push(label);
}
for (const day of [1, 6, 11, 16, 21, 26, 31]) {
const label = makeSpriteText(
String(day).padStart(2, "0"),
0.34,
0.18,
{
foreground: "#7899aa",
background: "rgba(8,25,37,0.55)",
border: "rgba(88,226,220,0.2)"
}
);
label.position.set(-2.55 + (day - 1) * 0.145, 1.06, 0.22);
calendar.add(label);
}
const calendarDummy = new THREE.Object3D();
const calendarColor = new THREE.Color();
function updateCalendar() {
const dataset = datasets.get(focusYear);
const lengths = monthLengths(focusYear);
for (let month = 0; month < 12; month++) {
for (let day = 1; day <= 31; day++) {
const index = month * 31 + (day - 1);
const valid = day <= lengths[month];
calendarDummy.position.set(
-2.55 + (day - 1) * 0.145,
3.55 - month * 0.205,
0.18
);
calendarDummy.scale.setScalar(valid ? 1 : 0.001);
calendarDummy.updateMatrix();
calendarCells.setMatrixAt(index, calendarDummy.matrix);
const observation = valid
? dataset.months[month][day - 1]
: null;
const normalized = observation
? THREE.MathUtils.clamp(observation.rain / 27, 0, 1)
: 0;
rainColor(normalized, calendarColor);
calendarCells.setColorAt(index, calendarColor);
}
}
calendarCells.instanceMatrix.needsUpdate = true;
if (calendarCells.instanceColor) {
calendarCells.instanceColor.needsUpdate = true;
}
const total = summarize(dataset.days).rain;
calendarFocus.userData.setText(
`FOCUS ${focusYear} / ${total.toFixed(0)} MM TOTAL / ALL SYNTHETIC`
);
}
// ---------------------------------------------------------------------
// Multiyear summary sculpture
// ---------------------------------------------------------------------
const summary = new THREE.Group();
world.add(summary);
addBox(
summary,
6.25,
0.17,
4.72,
materials.floorEdge,
4.55,
0.055,
0.34
);
addEdges(
summary,
6.25,
0.17,
4.72,
4.55,
0.055,
0.34,
0x6da3b6
);
addBox(
summary,
6.25,
0.72,
0.14,
materials.frame,
4.55,
3.23,
-1.88
);
const summaryTitle = makePlaneText(
"MULTIYEAR STACKED SUMMARY / SYNTHETIC",
6.0,
0.35,
{
foreground: "#eaf7ff",
border: "#58e2dc"
}
);
summaryTitle.position.set(4.55, 3.42, -1.79);
summary.add(summaryTitle);
const summaryFocus = makePlaneText(
"FOCUS 2025 / ALL OBSERVATIONS SYNTHETIC",
5.2,
0.23,
{
foreground: "#ffd071",
background: "rgba(32,27,15,0.8)",
border: "#ffd071"
}
);
summaryFocus.position.set(4.55, 3.08, -1.79);
summary.add(summaryFocus);
const MAX_BLOCKS = 365;
const summaryBlocks = new THREE.InstancedMesh(
new THREE.BoxGeometry(1, 1, 1),
standard(0xffffff, { roughness: 0.67 }),
MAX_BLOCKS
);
summaryBlocks.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
summaryBlocks.castShadow = true;
summaryBlocks.receiveShadow = true;
world.add(summaryBlocks);
const instanceDummy = new THREE.Object3D();
const instanceColor = new THREE.Color();
function rainColor(normalized, target = new THREE.Color()) {
const amount = THREE.MathUtils.clamp(normalized, 0, 1);
target.setHSL(0.54 - amount * 0.42, 0.76, 0.38 + amount * 0.18);
return target;
}
function makeState(x, y, z, sx, sy, sz, color) {
return {
x,
y,
z,
sx,
sy,
sz,
color: color.clone()
};
}
function buildTarget(mode) {
const dataset = datasets.get(focusYear);
if (mode === "day") {
const maximum = Math.max(
1,
...dataset.days.map((day) => day.rain)
);
const offsets = new Array(12).fill(0);
return dataset.days.map((day) => {
const normalized = day.rain / maximum;
const offset = offsets[day.month]++;
const color = rainColor(normalized);
return makeState(
2.12 + day.month * 0.445,
0.34 + offset * 0.083,
0.22,
0.18 + Math.sqrt(normalized) * 0.075,
0.065,
0.18 + Math.sqrt(normalized) * 0.075,
color
);
});
}
if (mode === "week") {
const weeks = [];
for (let index = 0; index < 52; index++) {
weeks.push(dataset.days.slice(index * 7, index * 7 + 7));
}
const summaries = weeks.map(summarize);
const maximum = Math.max(1, ...summaries.map((item) => item.rain));
const monthCounts = new Array(12).fill(0);
return weeks.map((week, index) => {
const month = week[0].month;
const withinMonth = monthCounts[month]++;
const normalized = summaries[index].rain / maximum;
return makeState(
2.12 + month * 0.445,
0.39 + withinMonth * 0.52,
0.22,
0.31,
0.38,
0.31,
rainColor(normalized)
);
});
}
if (mode === "month") {
const maximum = Math.max(
1,
...dataset.monthSummaries.map((item) => item.rain)
);
return dataset.monthSummaries.map((item, month) => {
const normalized = item.rain / maximum;
const height = 0.65 + normalized * 1.35;
return makeState(
2.12 + month * 0.445,
0.2 + height / 2,
0.22,
0.34,
height,
0.34,
rainColor(normalized)
);
});
}
if (mode === "quarter") {
const maximum = Math.max(
1,
...dataset.quarterSummaries.map((item) => item.rain)
);
return dataset.quarterSummaries.map((item, quarter) => {
const normalized = item.rain / maximum;
const height = 0.85 + normalized * 1.55;
return makeState(
2.45 + quarter * 1.5,
0.2 + height / 2,
0.22,
0.48,
height,
0.48,
rainColor(normalized)
);
});
}
// YEAR mode: six year groups, each containing four stacked quarters.
const allQuarterData = [];
for (const year of YEARS) {
for (const item of datasets.get(year).quarterSummaries) {
allQuarterData.push(item);
}
}
const maximum = Math.max(1, ...allQuarterData.map((item) => item.rain));
const states = [];
YEARS.forEach((year, yearIndex) => {
let stackBottom = 0.22;
datasets.get(year).quarterSummaries.forEach((item, quarter) => {
const normalized = item.rain / maximum;
const height = 0.34 + normalized * 0.42;
const color = rainColor(normalized);
if (year === focusYear) {
color.lerp(new THREE.Color(0xffffff), 0.2);
}
states.push(
makeState(
2.15 + yearIndex * 0.95,
stackBottom + height / 2,
0.22,
year === focusYear ? 0.42 : 0.35,
height,
year === focusYear ? 0.42 : 0.35,
color
)
);
stackBottom += height + 0.025;
});
});
return states;
}
// Label sets for the summary floor.
const labelSets = {
month: [],
quarter: [],
year: []
};
for (let month = 0; month < 12; month++) {
const label = makeSpriteText(
MONTH_NAMES[month],
0.42,
0.2,
{
foreground: "#b9d8e4",
background: "rgba(8,25,37,0.78)",
border: "rgba(88,226,220,0.3)"
}
);
label.position.set(2.12 + month * 0.445, 0.2, 2.53);
world.add(label);
labelSets.month.push(label);
}
for (let quarter = 0; quarter < 4; quarter++) {
const label = makeSpriteText(
`Q${quarter + 1}`,
0.5,
0.22,
{
foreground: "#b9d8e4",
background: "rgba(8,25,37,0.78)",
border: "rgba(88,226,220,0.3)"
}
);
label.position.set(2.45 + quarter * 1.5, 0.2, 2.53);
world.add(label);
labelSets.quarter.push(label);
}
for (let yearIndex = 0; yearIndex < YEARS.length; yearIndex++) {
const label = makeSpriteText(
String(YEARS[yearIndex]),
0.62,
0.23,
{
foreground: "#b9d8e4",
background: "rgba(8,25,37,0.78)",
border: "rgba(88,226,220,0.3)"
}
);
label.position.set(2.15 + yearIndex * 0.95, 0.2, 2.53);
world.add(label);
labelSets.year.push(label);
}
function labelCategory(mode) {
if (mode === "quarter") return "quarter";
if (mode === "year") return "year";
return "month";
}
function setLabelOpacity(category, opacity) {
for (const label of labelSets[category]) {
label.material.opacity = opacity;
label.visible = opacity > 0.005;
}
}
setLabelOpacity("month", 1);
setLabelOpacity("quarter", 0);
setLabelOpacity("year", 0);
// ---------------------------------------------------------------------
// Aggregation animation
// ---------------------------------------------------------------------
let currentStates = buildTarget("day");
let transition = null;
function setInstance(index, state) {
instanceDummy.position.set(state.x, state.y, state.z);
instanceDummy.scale.set(
Math.max(0.0001, state.sx),
Math.max(0.0001, state.sy),
Math.max(0.0001, state.sz)
);
instanceDummy.updateMatrix();
summaryBlocks.setMatrixAt(index, instanceDummy.matrix);
summaryBlocks.setColorAt(index, state.color);
}
for (let index = 0; index < MAX_BLOCKS; index++) {
setInstance(index, currentStates[index]);
}
summaryBlocks.instanceMatrix.needsUpdate = true;
if (summaryBlocks.instanceColor) {
summaryBlocks.instanceColor.needsUpdate = true;
}
function beginTransition(nextMode) {
const previousMode = currentMode;
if (nextMode === previousMode && !transition) return;
const target = buildTarget(nextMode);
const from = currentStates.map((state) => ({
...state,
color: state.color.clone()
}));
const to = [];
for (let index = 0; index < MAX_BLOCKS; index++) {
if (index < target.length) {
to.push(target[index]);
} else {
to.push({
x: from[index].x,
y: -5,
z: from[index].z,
sx: 0,
sy: 0,
sz: 0,
color: from[index].color.clone()
});
}
}
transition = {
from,
to,
start: performance.now(),
duration: 1150,
labelFrom: labelCategory(previousMode),
labelTo: labelCategory(nextMode)
};
currentMode = nextMode;
updateModeUI();
updateReadout();
}
function updateTransition(now) {
if (!transition) return;
const raw = THREE.MathUtils.clamp(
(now - transition.start) / transition.duration,
0,
1
);
const eased =
raw < 0.5
? 4 * raw * raw * raw
: 1 - Math.pow(-2 * raw + 2, 3) / 2;
for (let index = 0; index < MAX_BLOCKS; index++) {
const a = transition.from[index];
const b = transition.to[index];
const state = currentStates[index];
state.x = THREE.MathUtils.lerp(a.x, b.x, eased);
state.y = THREE.MathUtils.lerp(a.y, b.y, eased);
state.z = THREE.MathUtils.lerp(a.z, b.z, eased);
state.sx = THREE.MathUtils.lerp(a.sx, b.sx, eased);
state.sy = THREE.MathUtils.lerp(a.sy, b.sy, eased);
state.sz = THREE.MathUtils.lerp(a.sz, b.sz, eased);
state.color.copy(a.color).lerp(b.color, eased);
setInstance(index, state);
}
summaryBlocks.instanceMatrix.needsUpdate = true;
if (summaryBlocks.instanceColor) {
summaryBlocks.instanceColor.needsUpdate = true;
}
if (transition.labelFrom === transition.labelTo) {
setLabelOpacity(transition.labelTo, 1);
} else {
setLabelOpacity(transition.labelFrom, 1 - eased);
setLabelOpacity(transition.labelTo, eased);
}
if (raw >= 1) {
currentStates = transition.to.map((state) => ({
...state,
color: state.color.clone()
}));
for (let index = 0; index < MAX_BLOCKS; index++) {
setInstance(index, currentStates[index]);
}
summaryBlocks.instanceMatrix.needsUpdate = true;
if (summaryBlocks.instanceColor) {
summaryBlocks.instanceColor.needsUpdate = true;
}
transition = null;
}
}
// ---------------------------------------------------------------------
// UI and controls
// ---------------------------------------------------------------------
const modeButtons = [...document.querySelectorAll(".mode-button")];
const yearSelect = document.getElementById("yearSelect");
const playButton = document.getElementById("playButton");
const grainLabel = document.getElementById("grainLabel");
const blockCount = document.getElementById("blockCount");
const blockCaption = document.getElementById("blockCaption");
const rainValue = document.getElementById("rainValue");
const tempValue = document.getElementById("tempValue");
const windValue = document.getElementById("windValue");
const scopeValue = document.getElementById("scopeValue");
function updateModeUI() {
for (const button of modeButtons) {
button.classList.toggle("active", button.dataset.mode === currentMode);
}
}
function updateReadout() {
const dataset = datasets.get(focusYear);
let days = dataset.days;
let scope = `FOCUS ${focusYear} · SEEDED GENERATOR`;
if (currentMode === "year") {
days = YEARS.flatMap((year) => datasets.get(year).days);
scope = "ARCHIVE 2020—2025 · SYNTHETIC · NO OBSERVATIONS";
}
const stats = summarize(days);
grainLabel.textContent = `SYNTHETIC · ${currentMode.toUpperCase()} GRAIN`;
blockCount.textContent =
currentMode === "year" ? "24" : buildTarget(currentMode).length;
blockCaption.textContent =
currentMode === "year"
? "STACK BLOCKS / 6 YEARS"
: "VOXELS / FOCUS YEAR";
rainValue.textContent = `${stats.rain.toFixed(0)} mm`;
tempValue.textContent = `${stats.temp.toFixed(1)} °C`;
windValue.textContent = `${stats.wind.toFixed(1)} m/s`;
scopeValue.textContent = scope;
}
modeButtons.forEach((button) => {
button.addEventListener("click", () => {
setAutoPlay(false);
beginTransition(button.dataset.mode);
});
});
yearSelect.addEventListener("change", () => {
focusYear = Number(yearSelect.value);
updateCalendar();
summaryFocus.userData.setText(
`FOCUS ${focusYear} / ALL OBSERVATIONS SYNTHETIC`
);
beginTransition(currentMode);
updateReadout();
});
let autoPlay = false;
let nextAutoAt = 0;
const cycle = ["day", "week", "month", "quarter", "year"];
function setAutoPlay(enabled) {
autoPlay = enabled;
playButton.textContent = enabled ? "PAUSE ■" : "AUTO ▶";
playButton.classList.toggle("active", enabled);
nextAutoAt = performance.now() + 1700;
}
playButton.addEventListener("click", () => {
setAutoPlay(!autoPlay);
});
// ---------------------------------------------------------------------
// Animation loop
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
function animate(now) {
const delta = Math.min(clock.getDelta(), 0.05);
updateTransition(now);
if (autoPlay && now >= nextAutoAt && !transition) {
const currentIndex = cycle.indexOf(currentMode);
beginTransition(cycle[(currentIndex + 1) % cycle.length]);
nextAutoAt = now + 1750;
}
// Gentle synthetic sensor motion.
const wind = datasets.get(focusYear).days[180].wind;
windVane.rotation.y += delta * (0.25 + wind * 0.08);
anemometer.rotation.y -= delta * (0.8 + wind * 0.7);
cloud.position.y = 4.45 + Math.sin(now * 0.00065) * 0.07;
for (const droplet of droplets) {
droplet.mesh.position.y -=
delta * droplet.speed;
if (droplet.mesh.position.y < 1.92) {
droplet.mesh.position.y = 2.85 + droplet.offset;
}
}
updateCamera();
renderer.render(scene, camera);
}
updateCalendar();
updateModeUI();
updateReadout();
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```