Prompt specification
Build or customize the Three.js 3D scene "Land and ocean seasonal heating model" 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: Land and ocean seasonal heating model
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/land-and-ocean-seasonal-heating-model-x1225
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring monsoon circulation. Build adjacent land and water slabs with labeled seasonal temperature indicators; show a simplified pressure-gradient arrow while noting that real monsoons involve broader circulation. Low-poly.
Working Three.js Starter (land-and-ocean-seasonal-heating-model-x1225):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Monsoon Circulation — Low-Poly Seasonal Model</title>
<style>
:root {
--panel: rgba(7, 24, 34, 0.82);
--panel-border: rgba(174, 220, 235, 0.18);
--text: #eefaff;
--muted: #9eb8c4;
--cyan: #57ddff;
--green: #b8dc79;
--coral: #ff8c72;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #071a26;
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#app {
position: fixed;
inset: 0;
overflow: hidden;
}
#app canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
#app canvas:focus-visible {
outline: 2px solid var(--cyan);
outline-offset: -4px;
}
#label-layer {
position: absolute;
inset: 0;
z-index: 3;
overflow: hidden;
pointer-events: none;
}
.topbar {
position: absolute;
z-index: 5;
top: 0;
left: 0;
right: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
padding: 24px 28px;
pointer-events: none;
background: linear-gradient(
to bottom,
rgba(4, 17, 26, 0.82),
rgba(4, 17, 26, 0)
);
}
.title-block {
max-width: 560px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 8px;
color: var(--cyan);
font-size: 0.68rem;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 23px;
height: 2px;
content: "";
background: var(--cyan);
box-shadow: 0 0 12px rgba(87, 221, 255, 0.65);
}
h1 {
margin: 0;
font-size: clamp(1.65rem, 3.6vw, 3.25rem);
font-weight: 760;
letter-spacing: -0.045em;
line-height: 0.98;
text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.subtitle {
max-width: 500px;
margin: 10px 0 0;
color: #b9cbd4;
font-size: 0.86rem;
line-height: 1.55;
}
.season-panel {
min-width: 280px;
padding: 11px;
border: 1px solid var(--panel-border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(14px);
pointer-events: auto;
}
.season-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 4px 8px;
color: var(--muted);
font-size: 0.61rem;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
#season-caption {
color: var(--green);
letter-spacing: 0.06em;
}
.season-buttons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
}
.season-button {
min-height: 55px;
padding: 8px 11px;
border: 1px solid rgba(180, 214, 228, 0.12);
border-radius: 10px;
color: var(--muted);
background: rgba(255, 255, 255, 0.035);
cursor: pointer;
text-align: left;
transition:
background 180ms ease,
border-color 180ms ease,
color 180ms ease,
transform 180ms ease;
}
.season-button:hover {
transform: translateY(-1px);
border-color: rgba(87, 221, 255, 0.32);
}
.season-button.active {
border-color: rgba(87, 221, 255, 0.55);
color: var(--text);
background: rgba(87, 221, 255, 0.11);
box-shadow: inset 0 0 0 1px rgba(87, 221, 255, 0.08);
}
.season-button span {
display: block;
font-size: 0.74rem;
font-weight: 850;
letter-spacing: 0.09em;
}
.season-button small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 0.59rem;
letter-spacing: 0.08em;
}
.world-label {
position: absolute;
transform: translate(-50%, -100%);
will-change: left, top;
}
.temp-card {
width: 174px;
overflow: hidden;
border: 1px solid rgba(190, 224, 236, 0.18);
border-radius: 12px;
background: rgba(7, 25, 35, 0.86);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
backdrop-filter: blur(10px);
}
.temp-card::after {
position: absolute;
bottom: -17px;
left: 50%;
width: 1px;
height: 17px;
content: "";
background: linear-gradient(rgba(190, 224, 236, 0.38), transparent);
}
.card-title {
display: flex;
align-items: center;
gap: 7px;
padding: 9px 11px 7px;
border-bottom: 1px solid rgba(190, 224, 236, 0.1);
font-size: 0.67rem;
font-weight: 850;
letter-spacing: 0.14em;
}
.card-title .dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 10px rgba(184, 220, 121, 0.6);
}
.temp-card.ocean .card-title .dot {
background: var(--cyan);
box-shadow: 0 0 10px rgba(87, 221, 255, 0.65);
}
.temp-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 10px;
margin: 5px 7px;
padding: 5px 6px;
border-radius: 7px;
color: rgba(220, 237, 244, 0.44);
transition:
color 220ms ease,
background 220ms ease;
}
.temp-row span {
font-size: 0.57rem;
font-weight: 750;
letter-spacing: 0.1em;
}
.temp-row strong {
font-size: 1rem;
font-variant-numeric: tabular-nums;
}
.temp-row.active {
color: var(--text);
background: rgba(255, 255, 255, 0.075);
}
.temp-card.land .temp-row.active {
box-shadow: inset 2px 0 var(--green);
}
.temp-card.ocean .temp-row.active {
box-shadow: inset 2px 0 var(--cyan);
}
.pressure-state {
padding: 5px 11px 9px;
color: var(--muted);
font-size: 0.53rem;
font-weight: 750;
letter-spacing: 0.07em;
line-height: 1.45;
}
.flow-label {
width: max-content;
max-width: 220px;
padding: 7px 10px;
border: 1px solid rgba(87, 221, 255, 0.28);
border-radius: 999px;
color: var(--cyan);
background: rgba(5, 27, 39, 0.86);
box-shadow: 0 7px 24px rgba(0, 0, 0, 0.22);
text-align: center;
backdrop-filter: blur(8px);
}
.flow-label span,
.flow-label strong {
display: block;
}
.flow-label span {
font-size: 0.51rem;
font-weight: 800;
letter-spacing: 0.14em;
}
.flow-label strong {
margin-top: 2px;
color: #e9fbff;
font-size: 0.63rem;
letter-spacing: 0.05em;
}
.pressure-badge {
width: max-content;
padding: 5px 8px;
border: 1px solid currentColor;
border-radius: 6px;
background: rgba(6, 24, 34, 0.84);
font-size: 0.54rem;
font-weight: 850;
letter-spacing: 0.11em;
box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}
.pressure-badge.high {
color: #70d9ff;
}
.pressure-badge.low {
color: #ff967d;
}
.bottom-panel {
position: absolute;
z-index: 5;
left: 24px;
bottom: 22px;
width: min(440px, calc(100vw - 48px));
padding: 14px 16px;
border: 1px solid var(--panel-border);
border-radius: 13px;
color: #b7cad3;
background: rgba(7, 24, 34, 0.78);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(12px);
font-size: 0.72rem;
line-height: 1.55;
pointer-events: none;
}
.bottom-panel strong {
display: block;
margin-bottom: 4px;
color: #f0fbff;
font-size: 0.66rem;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.bottom-panel .legend {
display: flex;
flex-wrap: wrap;
gap: 8px 14px;
margin-top: 9px;
color: #d0e0e7;
font-size: 0.62rem;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 6px;
}
.swatch {
width: 18px;
height: 3px;
border-radius: 99px;
background: var(--cyan);
}
.swatch.land {
background: var(--green);
}
.swatch.updraft {
background: #ffad67;
}
.view-controls {
position: absolute;
z-index: 5;
right: 24px;
bottom: 22px;
display: flex;
align-items: center;
gap: 10px;
pointer-events: auto;
}
.view-hint {
padding: 8px 11px;
border: 1px solid rgba(174, 220, 235, 0.13);
border-radius: 9px;
color: var(--muted);
background: rgba(7, 24, 34, 0.68);
font-size: 0.61rem;
letter-spacing: 0.03em;
backdrop-filter: blur(8px);
}
#reset-view {
padding: 9px 12px;
border: 1px solid rgba(87, 221, 255, 0.28);
border-radius: 9px;
color: #e9fbff;
background: rgba(87, 221, 255, 0.09);
cursor: pointer;
font-size: 0.66rem;
font-weight: 800;
letter-spacing: 0.06em;
}
#reset-view:hover {
background: rgba(87, 221, 255, 0.16);
}
#loading {
position: absolute;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
color: var(--cyan);
background: #071a26;
font-size: 0.72rem;
font-weight: 750;
letter-spacing: 0.15em;
text-transform: uppercase;
}
@media (max-width: 760px) {
.topbar {
flex-direction: column;
gap: 14px;
padding: 16px;
}
.title-block {
max-width: 100%;
}
.subtitle {
display: none;
}
.season-panel {
width: 100%;
min-width: 0;
}
.season-button {
min-height: 48px;
}
.bottom-panel {
left: 14px;
bottom: 62px;
width: calc(100vw - 28px);
padding: 11px 12px;
font-size: 0.65rem;
}
.bottom-panel .legend {
display: none;
}
.view-controls {
right: 14px;
bottom: 14px;
}
.view-hint {
display: none;
}
.temp-card {
width: 145px;
transform-origin: bottom center;
}
.temp-card,
.flow-label,
.pressure-badge {
scale: 0.86;
}
}
</style>
</head>
<body>
<main id="app">
<div id="loading">Loading monsoon model…</div>
<div id="label-layer">
<div id="land-card" class="world-label temp-card land">
<div class="card-title"><span class="dot"></span>LAND</div>
<div class="temp-row" data-season="summer">
<span>SUMMER</span><strong>32°C</strong>
</div>
<div class="temp-row" data-season="winter">
<span>WINTER</span><strong>18°C</strong>
</div>
<div id="land-pressure" class="pressure-state">
LOW PRESSURE · RISING AIR
</div>
</div>
<div id="ocean-card" class="world-label temp-card ocean">
<div class="card-title"><span class="dot"></span>WATER</div>
<div class="temp-row" data-season="summer">
<span>SUMMER</span><strong>29°C</strong>
</div>
<div class="temp-row" data-season="winter">
<span>WINTER</span><strong>24°C</strong>
</div>
<div id="ocean-pressure" class="pressure-state">
HIGH PRESSURE · MOIST AIR
</div>
</div>
<div id="flow-label" class="world-label flow-label">
<span>SIMPLIFIED PRESSURE GRADIENT</span>
<strong>OCEAN HIGH → LAND LOW</strong>
</div>
<div id="high-badge" class="world-label pressure-badge high">
HIGH PRESSURE
</div>
<div id="low-badge" class="world-label pressure-badge low">
LOW PRESSURE
</div>
</div>
<header class="topbar">
<div class="title-block">
<div class="eyebrow">Atmosphere / Seasonal Contrast</div>
<h1>Monsoon Circulation</h1>
<p class="subtitle">
A low-poly teaching model of land–sea heating, seasonal pressure
reversal, moisture transport, and rising air.
</p>
</div>
<section class="season-panel" aria-label="Select a season">
<div class="season-heading">
<span>Seasonal state</span>
<span id="season-caption">SUMMER MONSOON</span>
</div>
<div class="season-buttons">
<button
class="season-button active"
data-season="summer"
aria-pressed="true"
>
<span>SUMMER</span>
<small>JUL–SEP</small>
</button>
<button
class="season-button"
data-season="winter"
aria-pressed="false"
>
<span>WINTER</span>
<small>NOV–FEB</small>
</button>
</div>
</section>
</header>
<aside class="bottom-panel">
<strong>Conceptual cross-section · not to scale</strong>
The arrow shows only a simplified local surface pressure gradient. Real
monsoons involve broader planetary and regional circulation, coupled
ocean–atmosphere dynamics, moisture transport, and topography.
<div class="legend">
<span class="legend-item"><i class="swatch"></i>Surface flow</span>
<span class="legend-item"><i class="swatch land"></i>Hot land</span>
<span class="legend-item"><i class="swatch updraft"></i>Rising air</span>
</div>
</aside>
<div class="view-controls">
<div class="view-hint">Drag to orbit · Wheel to zoom · Arrow keys to pan</div>
<button id="reset-view" type="button">RESET VIEW</button>
</div>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const app = document.getElementById("app");
const labelLayer = document.getElementById("label-layer");
const loading = document.getElementById("loading");
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly monsoon circulation scene. Drag to orbit and use the wheel to zoom."
);
app.insertBefore(renderer.domElement, app.firstChild);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071a26);
scene.fog = new THREE.Fog(0x071a26, 21, 39);
const camera = new THREE.PerspectiveCamera(40, 1, 0.1, 100);
const cameraTarget = new THREE.Vector3(0, 1.15, 0);
const orbit = {
theta: 0.68,
phi: 1.02,
radius: 15,
desiredTheta: 0.68,
desiredPhi: 1.02,
desiredRadius: 15
};
const hemisphere = new THREE.HemisphereLight(0xc5efff, 0x24443b, 2.15);
scene.add(hemisphere);
const sunLight = new THREE.DirectionalLight(0xffe3b2, 3.0);
sunLight.position.set(-7, 12, 8);
sunLight.castShadow = true;
sunLight.shadow.mapSize.set(2048, 2048);
sunLight.shadow.camera.left = -10;
sunLight.shadow.camera.right = 10;
sunLight.shadow.camera.top = 10;
sunLight.shadow.camera.bottom = -10;
sunLight.shadow.camera.near = 1;
sunLight.shadow.camera.far = 30;
sunLight.shadow.bias = -0.0003;
scene.add(sunLight);
const rimLight = new THREE.DirectionalLight(0x65cfff, 1.15);
rimLight.position.set(8, 5, -9);
scene.add(rimLight);
const fillLight = new THREE.PointLight(0xff9d6e, 12, 15, 2);
fillLight.position.set(3, 4, 2);
scene.add(fillLight);
// Floor and slab foundations.
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0x0a202b,
roughness: 1,
metalness: 0
});
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(60, 60),
floorMaterial
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.72;
floor.receiveShadow = true;
scene.add(floor);
const oceanBoxMaterial = new THREE.MeshStandardMaterial({
color: 0x0b5068,
roughness: 0.74,
metalness: 0.04
});
const landBoxMaterial = new THREE.MeshStandardMaterial({
color: 0x4b6540,
roughness: 0.95,
metalness: 0
});
const oceanBox = new THREE.Mesh(
new THREE.BoxGeometry(5.6, 0.65, 8.4),
oceanBoxMaterial
);
oceanBox.position.set(-2.8, -0.35, 0);
oceanBox.castShadow = true;
oceanBox.receiveShadow = true;
scene.add(oceanBox);
const landBox = new THREE.Mesh(
new THREE.BoxGeometry(5.6, 0.65, 8.4),
landBoxMaterial
);
landBox.position.set(2.8, -0.35, 0);
landBox.castShadow = true;
landBox.receiveShadow = true;
scene.add(landBox);
const coastEdge = new THREE.Mesh(
new THREE.BoxGeometry(0.12, 0.72, 8.4),
new THREE.MeshStandardMaterial({
color: 0xb99a68,
roughness: 0.9
})
);
coastEdge.position.set(0, -0.32, 0);
coastEdge.castShadow = true;
scene.add(coastEdge);
function random01(index) {
const value = Math.sin(index * 127.1 + 311.7) * 43758.5453123;
return value - Math.floor(value);
}
// Faceted, low-poly ocean surface.
const oceanGeometry = new THREE.PlaneGeometry(5.55, 8.35, 7, 10);
oceanGeometry.rotateX(-Math.PI / 2);
const oceanPositions = oceanGeometry.attributes.position;
const oceanColors = [];
for (let i = 0; i < oceanPositions.count; i++) {
const x = oceanPositions.getX(i);
const z = oceanPositions.getZ(i);
const wave =
0.018 +
random01(i + 10) * 0.065 +
Math.sin((x + z) * 1.9) * 0.022;
oceanPositions.setY(i, wave);
const color = new THREE.Color().setHSL(
0.525 + random01(i + 90) * 0.025,
0.62,
0.34 + random01(i + 170) * 0.09
);
oceanColors.push(color.r, color.g, color.b);
}
oceanGeometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(oceanColors, 3)
);
oceanGeometry.computeVertexNormals();
const oceanSurfaceMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
vertexColors: true,
flatShading: true,
roughness: 0.32,
metalness: 0.08,
transparent: true,
opacity: 0.94
});
const oceanSurface = new THREE.Mesh(oceanGeometry, oceanSurfaceMaterial);
oceanSurface.position.x = -2.8;
oceanSurface.receiveShadow = true;
scene.add(oceanSurface);
// Faceted, low-poly land surface.
const landGeometry = new THREE.PlaneGeometry(5.55, 8.35, 7, 10);
landGeometry.rotateX(-Math.PI / 2);
const landPositions = landGeometry.attributes.position;
const landColors = [];
for (let i = 0; i < landPositions.count; i++) {
const x = landPositions.getX(i);
const z = landPositions.getZ(i);
const ridge = Math.max(0, 1 - Math.abs(z + 1.8) / 2.8);
const height =
0.085 +
random01(i + 300) * 0.13 +
ridge * random01(i + 420) * 0.09;
landPositions.setY(i, height);
const color = new THREE.Color().setHSL(
0.225 + random01(i + 510) * 0.045,
0.31,
0.31 + random01(i + 600) * 0.09
);
landColors.push(color.r, color.g, color.b);
}
landGeometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(landColors, 3)
);
landGeometry.computeVertexNormals();
const landSurfaceMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
vertexColors: true,
flatShading: true,
roughness: 0.96,
metalness: 0
});
const landSurface = new THREE.Mesh(landGeometry, landSurfaceMaterial);
landSurface.position.x = 2.8;
landSurface.castShadow = true;
landSurface.receiveShadow = true;
scene.add(landSurface);
// Small angular hills.
const hillMaterial = new THREE.MeshStandardMaterial({
color: 0x607b4f,
flatShading: true,
roughness: 1
});
function addHill(x, z, radius, height, rotation) {
const hill = new THREE.Mesh(
new THREE.ConeGeometry(radius, height, 5, 1),
hillMaterial
);
hill.position.set(x, 0.13 + height * 0.5, z);
hill.rotation.y = rotation;
hill.castShadow = true;
hill.receiveShadow = true;
scene.add(hill);
}
addHill(1.9, -2.7, 0.88, 1.22, 0.25);
addHill(3.65, -2.2, 0.68, 0.92, -0.35);
addHill(4.35, -0.85, 0.48, 0.65, 0.4);
// Tiny faceted trees.
const trunkMaterial = new THREE.MeshStandardMaterial({
color: 0x725138,
flatShading: true,
roughness: 1
});
const treeMaterial = new THREE.MeshStandardMaterial({
color: 0x476b45,
flatShading: true,
roughness: 1
});
function addTree(x, z, scale) {
const group = new THREE.Group();
const trunk = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.075, 0.42, 5),
trunkMaterial
);
trunk.position.y = 0.21;
const crown = new THREE.Mesh(
new THREE.ConeGeometry(0.28, 0.72, 6),
treeMaterial
);
crown.position.y = 0.66;
group.add(trunk, crown);
group.position.set(x, 0.12, z);
group.scale.setScalar(scale);
group.traverse((child) => {
if (child.isMesh) {
child.castShadow = true;
child.receiveShadow = true;
}
});
scene.add(group);
}
[
[1.05, -3.2, 0.8],
[3.9, -3.1, 0.72],
[4.35, 1.7, 0.86],
[1.15, 2.75, 0.75],
[4.25, -0.15, 0.65],
[1.15, 0.45, 0.66],
[3.55, 2.95, 0.78]
].forEach((values) => addTree(...values));
// Shoreline foam and angular wave marks.
const shorePoints = [];
for (let z = -4.05; z <= 4.05; z += 0.22) {
shorePoints.push(
new THREE.Vector3(
0.02 + Math.sin(z * 4.2) * 0.07,
0.16,
z
)
);
}
const shore = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(shorePoints),
new THREE.LineBasicMaterial({
color: 0xd9f8ff,
transparent: true,
opacity: 0.52
})
);
scene.add(shore);
const waveVertices = [];
for (let i = 0; i < 18; i++) {
const x = -5.25 + random01(i + 700) * 4.7;
const z = -3.8 + random01(i + 750) * 7.6;
const length = 0.22 + random01(i + 800) * 0.42;
waveVertices.push(x, 0.14, z, x + length, 0.14, z + 0.025);
}
const waveGeometry = new THREE.BufferGeometry();
waveGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(waveVertices, 3)
);
const waves = new THREE.LineSegments(
waveGeometry,
new THREE.LineBasicMaterial({
color: 0xd3f6ff,
transparent: true,
opacity: 0.34
})
);
scene.add(waves);
// Main simplified surface pressure-gradient arrow.
const arrowMaterial = new THREE.MeshStandardMaterial({
color: 0x57ddff,
emissive: 0x176777,
emissiveIntensity: 0.8,
roughness: 0.35,
metalness: 0.12,
transparent: true,
opacity: 1
});
const pressureArrow = new THREE.Group();
const arrowShaft = new THREE.Mesh(
new THREE.CylinderGeometry(0.065, 0.065, 4.45, 7),
arrowMaterial
);
arrowShaft.rotation.z = -Math.PI / 2;
arrowShaft.position.x = -0.3;
const arrowHead = new THREE.Mesh(
new THREE.ConeGeometry(0.23, 0.56, 7),
arrowMaterial
);
arrowHead.rotation.z = -Math.PI / 2;
arrowHead.position.x = 2.19;
pressureArrow.add(arrowShaft, arrowHead);
pressureArrow.position.set(0, 1.12, 0.7);
scene.add(pressureArrow);
// Moisture particles moving along the simplified surface flow.
const moistureCount = 30;
const moisturePositions = new Float32Array(moistureCount * 3);
const moistureGeometry = new THREE.BufferGeometry();
moistureGeometry.setAttribute(
"position",
new THREE.BufferAttribute(moisturePositions, 3)
);
const moistureMaterial = new THREE.PointsMaterial({
color: 0xbaf5ff,
size: 0.095,
transparent: true,
opacity: 0.9,
sizeAttenuation: true
});
const moisturePoints = new THREE.Points(
moistureGeometry,
moistureMaterial
);
moisturePoints.frustumCulled = false;
scene.add(moisturePoints);
// Rising-air arrow over the heated land.
const updraftMaterial = new THREE.MeshStandardMaterial({
color: 0xffac67,
emissive: 0x8c3d14,
emissiveIntensity: 0.75,
roughness: 0.4
});
const updraft = new THREE.Group();
const updraftShaft = new THREE.Mesh(
new THREE.CylinderGeometry(0.065, 0.065, 2.05, 7),
updraftMaterial
);
updraftShaft.position.y = 1.025;
const updraftHead = new THREE.Mesh(
new THREE.ConeGeometry(0.22, 0.52, 7),
updraftMaterial
);
updraftHead.position.y = 2.56;
updraft.add(updraftShaft, updraftHead);
updraft.position.set(2.25, 0.64, 0.7);
scene.add(updraft);
// Low-poly monsoon cloud.
const cloudMaterial = new THREE.MeshStandardMaterial({
color: 0xbacbd2,
flatShading: true,
roughness: 1,
transparent: true,
opacity: 0.94
});
const cloud = new THREE.Group();
const cloudGeometry = new THREE.IcosahedronGeometry(0.62, 0);
const cloudPieces = [
[-0.78, 0.0, 0.0, 1.1, 0.72, 0.9],
[-0.15, 0.18, 0.05, 1.25, 0.95, 1.0],
[0.62, 0.02, -0.05, 1.08, 0.74, 0.88],
[0.05, -0.12, 0.3, 1.4, 0.62, 0.78]
];
cloudPieces.forEach(([x, y, z, sx, sy, sz]) => {
const piece = new THREE.Mesh(cloudGeometry, cloudMaterial);
piece.position.set(x, y, z);
piece.scale.set(sx, sy, sz);
piece.castShadow = true;
cloud.add(piece);
});
cloud.position.set(2.25, 4.2, 0.45);
scene.add(cloud);
// Rain streaks.
const rainCount = 74;
const rainState = [];
const rainPositions = new Float32Array(rainCount * 6);
for (let i = 0; i < rainCount; i++) {
rainState.push({
x: 0.8 + random01(i + 1000) * 3.7,
y: 0.8 + random01(i + 1100) * 3.25,
z: -1.75 + random01(i + 1200) * 4.1,
speed: 2.1 + random01(i + 1300) * 1.8
});
}
const rainGeometry = new THREE.BufferGeometry();
rainGeometry.setAttribute(
"position",
new THREE.BufferAttribute(rainPositions, 3)
);
const rainMaterial = new THREE.LineBasicMaterial({
color: 0x9edfff,
transparent: true,
opacity: 0.62
});
const rain = new THREE.LineSegments(rainGeometry, rainMaterial);
rain.frustumCulled = false;
scene.add(rain);
// DOM labels projected from world-space anchors.
const labelElements = {
land: document.getElementById("land-card"),
ocean: document.getElementById("ocean-card"),
flow: document.getElementById("flow-label"),
high: document.getElementById("high-badge"),
low: document.getElementById("low-badge")
};
const labelAnchors = {
land: new THREE.Vector3(2.7, 1.65, -2.95),
ocean: new THREE.Vector3(-2.7, 0.85, -2.95),
flow: new THREE.Vector3(-0.25, 1.72, 0.7),
high: new THREE.Vector3(-2.75, 2.05, 0.7),
low: new THREE.Vector3(2.35, 3.48, 0.7)
};
const winterAnchors = {
high: new THREE.Vector3(2.45, 2.05, 0.7),
low: new THREE.Vector3(-2.7, 1.92, 0.7)
};
const projected = new THREE.Vector3();
function positionLabel(element, worldPosition) {
projected.copy(worldPosition).project(camera);
const width = app.clientWidth;
const height = app.clientHeight;
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
element.style.visibility =
projected.z >= -1 && projected.z <= 1 ? "visible" : "hidden";
}
function updateLabels() {
positionLabel(labelElements.land, labelAnchors.land);
positionLabel(labelElements.ocean, labelAnchors.ocean);
positionLabel(labelElements.flow, labelAnchors.flow);
positionLabel(labelElements.high, labelAnchors.high);
positionLabel(labelElements.low, labelAnchors.low);
}
// Seasonal visual state.
let season = "summer";
const summerColors = {
oceanSurface: new THREE.Color(0xffffff),
oceanBox: new THREE.Color(0x0b5068),
landSurface: new THREE.Color(0xffffff),
landBox: new THREE.Color(0x4b6540),
arrow: new THREE.Color(0x57ddff),
arrowEmissive: new THREE.Color(0x176777),
moisture: new THREE.Color(0xbaf5ff)
};
const winterColors = {
oceanSurface: new THREE.Color(0x92afc5),
oceanBox: new THREE.Color(0x294c60),
landSurface: new THREE.Color(0xaec6ce),
landBox: new THREE.Color(0x4a5b50),
arrow: new THREE.Color(0x83a8c0),
arrowEmissive: new THREE.Color(0x1b3442),
moisture: new THREE.Color(0xa4bed0)
};
const seasonButtons = [
...document.querySelectorAll(".season-button")
];
const temperatureRows = [
...document.querySelectorAll(".temp-row")
];
const landPressure = document.getElementById("land-pressure");
const oceanPressure = document.getElementById("ocean-pressure");
const flowText = document.querySelector("#flow-label strong");
const seasonCaption = document.getElementById("season-caption");
function setSeason(nextSeason) {
season = nextSeason;
seasonButtons.forEach((button) => {
const active = button.dataset.season === season;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
temperatureRows.forEach((row) => {
row.classList.toggle("active", row.dataset.season === season);
});
if (season === "summer") {
landPressure.textContent = "LOW PRESSURE · RISING AIR";
oceanPressure.textContent = "HIGH PRESSURE · MOIST AIR";
flowText.textContent = "OCEAN HIGH → LAND LOW";
seasonCaption.textContent = "SUMMER MONSOON";
labelAnchors.high.set(-2.75, 2.05, 0.7);
labelAnchors.low.set(2.35, 3.48, 0.7);
} else {
landPressure.textContent = "HIGH PRESSURE · COOL AIR";
oceanPressure.textContent = "RELATIVE LOW · COOLING";
flowText.textContent = "LAND HIGH → OCEAN LOW";
seasonCaption.textContent = "WINTER REVERSAL";
labelAnchors.high.copy(winterAnchors.high);
labelAnchors.low.copy(winterAnchors.low);
}
pressureArrow.rotation.y = season === "summer" ? 0 : Math.PI;
}
seasonButtons.forEach((button) => {
button.addEventListener("click", () => {
setSeason(button.dataset.season);
});
});
// Custom camera controls, implemented without external addons.
let dragging = false;
let previousX = 0;
let previousY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
orbit.desiredTheta -= deltaX * 0.006;
orbit.desiredPhi = THREE.MathUtils.clamp(
orbit.desiredPhi - deltaY * 0.006,
0.42,
1.42
);
});
function endDrag(event) {
dragging = false;
renderer.domElement.style.cursor = "grab";
if (
event.pointerId !== undefined &&
renderer.domElement.hasPointerCapture(event.pointerId)
) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.desiredRadius = THREE.MathUtils.clamp(
orbit.desiredRadius + event.deltaY * 0.012,
9,
25
);
},
{ passive: false }
);
renderer.domElement.style.cursor = "grab";
renderer.domElement.addEventListener("keydown", (event) => {
const key = event.key;
if (key === "ArrowLeft") orbit.desiredTheta -= 0.12;
else if (key === "ArrowRight") orbit.desiredTheta += 0.12;
else if (key === "ArrowUp") {
orbit.desiredPhi = Math.max(0.42, orbit.desiredPhi - 0.08);
} else if (key === "ArrowDown") {
orbit.desiredPhi = Math.min(1.42, orbit.desiredPhi + 0.08);
} else if (key === "+" || key === "=") {
orbit.desiredRadius = Math.max(9, orbit.desiredRadius - 1);
} else if (key === "-") {
orbit.desiredRadius = Math.min(25, orbit.desiredRadius + 1);
} else if (key.toLowerCase() === "r") {
resetView();
} else {
return;
}
event.preventDefault();
});
function resetView() {
orbit.desiredTheta = 0.68;
orbit.desiredPhi = 1.02;
orbit.desiredRadius = app.clientWidth < 700 ? 19 : 15;
}
document.getElementById("reset-view").addEventListener("click", resetView);
function updateCamera(delta) {
const damping = 1 - Math.exp(-delta * 10);
orbit.theta += (orbit.desiredTheta - orbit.theta) * damping;
orbit.phi += (orbit.desiredPhi - orbit.phi) * damping;
orbit.radius += (orbit.desiredRadius - orbit.radius) * damping;
const sinPhi = Math.sin(orbit.phi);
const cosPhi = Math.cos(orbit.phi);
camera.position.set(
cameraTarget.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
cameraTarget.y + orbit.radius * cosPhi,
cameraTarget.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(cameraTarget);
camera.updateMatrixWorld();
}
function resize() {
const width = app.clientWidth;
const height = app.clientHeight;
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
if (width < 700 && orbit.radius < 18) {
orbit.radius = orbit.desiredRadius = 19;
} else if (width >= 700 && orbit.radius > 19) {
orbit.radius = orbit.desiredRadius = 15;
}
}
window.addEventListener("resize", resize);
resize();
const clock = new THREE.Clock();
let elapsed = 0;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
elapsed += delta;
updateCamera(delta);
const targets = season === "summer" ? summerColors : winterColors;
const colorDamping = 1 - Math.exp(-delta * 3.2);
oceanSurfaceMaterial.color.lerp(
targets.oceanSurface,
colorDamping
);
oceanBoxMaterial.color.lerp(
targets.oceanBox,
colorDamping
);
landSurfaceMaterial.color.lerp(
targets.landSurface,
colorDamping
);
landBoxMaterial.color.lerp(
targets.landBox,
colorDamping
);
arrowMaterial.color.lerp(
targets.arrow,
colorDamping
);
arrowMaterial.emissive.lerp(
targets.arrowEmissive,
colorDamping
);
moistureMaterial.color.lerp(
targets.moisture,
colorDamping
);
const summerLight = 3.0;
const winterLight = 1.75;
sunLight.intensity +=
(season === "summer" ? summerLight : winterLight) -
sunLight.intensity * colorDamping;
fillLight.intensity +=
(season === "summer" ? 12 : 3.5) -
fillLight.intensity * colorDamping;
updraft.visible = season === "summer";
cloudMaterial.opacity +=
(season === "summer" ? 0.94 : 0.3) -
cloudMaterial.opacity * colorDamping;
rainMaterial.opacity +=
(season === "summer" ? 0.62 : 0.09) -
rainMaterial.opacity * colorDamping;
cloud.position.x = 2.25 + Math.sin(elapsed * 0.22) * 0.16;
cloud.position.z = 0.45 + Math.cos(elapsed * 0.17) * 0.08;
// Moisture particles animate along the pressure-gradient arrow.
for (let i = 0; i < moistureCount; i++) {
const t = (i / moistureCount + elapsed * 0.095) % 1;
const pathT = season === "summer" ? t : 1 - t;
const index = i * 3;
moisturePositions[index] = -2.55 + pathT * 4.55;
moisturePositions[index + 1] =
1.14 + Math.sin(elapsed * 2.2 + i * 0.7) * 0.065;
moisturePositions[index + 2] =
0.7 + Math.sin(pathT * Math.PI * 3 + i) * 0.13;
}
moistureGeometry.attributes.position.needsUpdate = true;
// Animated rain segments.
for (let i = 0; i < rainCount; i++) {
const drop = rainState[i];
drop.y -= drop.speed * delta;
if (drop.y < 0.65) {
drop.y = 3.55 + random01(i + Math.floor(elapsed * 10)) * 0.5;
}
const index = i * 6;
rainPositions[index] = drop.x;
rainPositions[index + 1] = drop.y;
rainPositions[index + 2] = drop.z;
rainPositions[index + 3] = drop.x - 0.035;
rainPositions[index + 4] = drop.y - 0.27;
rainPositions[index + 5] = drop.z + 0.02;
}
rainGeometry.attributes.position.needsUpdate = true;
renderer.render(scene, camera);
updateLabels();
}
setSeason("summer");
animate();
loading.remove();
</script>
</body>
</html>
```