Prompt specification
Build or customize the Three.js 3D scene "Shade and evaporation courtyard 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: Shade and evaporation courtyard comparison
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/shade-and-evaporation-courtyard-comparison-x1222
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts urban heat islands. Place two identical courtyards with differing tree shade and water availability; illustrate separate cooling mechanisms with labeled arrows while keeping solar input geometry consistent. Stylized solid forms.
Working Three.js Starter (shade-and-evaporation-courtyard-comparison-x1222):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Urban Heat Islands — Cooling Courtyards</title>
<style>
:root {
--ink: #183238;
--muted: #61777b;
--panel: rgba(250, 248, 240, 0.9);
--line: rgba(24, 50, 56, 0.13);
--green: #347a54;
--teal: #178b87;
--blue: #247fc4;
--gold: #e4a52f;
--coral: #dc654e;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d7e3df;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene,
#annotations {
position: absolute;
inset: 0;
}
#scene {
z-index: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
#annotations {
z-index: 2;
pointer-events: none;
overflow: hidden;
}
.annotation {
position: absolute;
padding: 7px 10px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 8px;
background: rgba(250, 248, 240, 0.94);
box-shadow: 0 5px 18px rgba(30, 52, 54, 0.12);
color: var(--ink);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.085em;
line-height: 1;
white-space: nowrap;
transform: translate(-50%, -50%);
backdrop-filter: blur(7px);
}
.annotation::before {
content: "";
display: inline-block;
width: 7px;
height: 7px;
margin-right: 7px;
border-radius: 50%;
background: var(--accent, var(--ink));
vertical-align: 1px;
}
.annotation.green {
--accent: var(--green);
}
.annotation.teal {
--accent: var(--teal);
}
.annotation.blue {
--accent: var(--blue);
}
.annotation.coral {
--accent: var(--coral);
}
.annotation.gold {
--accent: var(--gold);
}
.ui {
position: absolute;
inset: 0;
z-index: 3;
pointer-events: none;
}
.title-card {
position: absolute;
top: 20px;
left: 20px;
width: min(390px, calc(100vw - 40px));
padding: 19px 21px 17px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 12px 38px rgba(30, 52, 54, 0.12);
backdrop-filter: blur(12px);
}
.eyebrow {
margin-bottom: 7px;
color: var(--green);
font-size: 10px;
font-weight: 900;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(25px, 3vw, 38px);
font-weight: 850;
letter-spacing: -0.045em;
line-height: 1;
}
.subtitle {
margin: 11px 0 14px;
color: var(--muted);
font-size: 13px;
line-height: 1.45;
}
.constraint {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 7px 9px;
border-radius: 7px;
background: rgba(228, 165, 47, 0.14);
color: #77520f;
font-size: 9px;
font-weight: 900;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.constraint::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--gold);
box-shadow: 0 0 0 4px rgba(228, 165, 47, 0.17);
}
.legend {
position: absolute;
top: 20px;
right: 20px;
width: 210px;
padding: 15px 16px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 14px;
background: var(--panel);
box-shadow: 0 12px 38px rgba(30, 52, 54, 0.1);
backdrop-filter: blur(12px);
}
.legend-title {
margin-bottom: 10px;
color: var(--muted);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
gap: 9px;
margin: 7px 0;
color: #385256;
font-size: 11px;
font-weight: 650;
}
.swatch {
width: 15px;
height: 5px;
border-radius: 999px;
background: var(--swatch);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch) 14%, transparent);
}
.compare {
position: absolute;
left: 50%;
bottom: 18px;
display: flex;
gap: 12px;
width: min(720px, calc(100vw - 40px));
transform: translateX(-50%);
}
.compare-card {
flex: 1;
min-width: 0;
padding: 13px 15px;
border: 1px solid rgba(255, 255, 255, 0.7);
border-radius: 13px;
background: var(--panel);
box-shadow: 0 10px 30px rgba(30, 52, 54, 0.11);
backdrop-filter: blur(12px);
}
.compare-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 8px;
}
.compare-name {
font-size: 12px;
font-weight: 900;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.chip {
padding: 4px 7px;
border-radius: 999px;
color: #fff;
background: var(--chip-color);
font-size: 8px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
}
.compare-copy {
color: var(--muted);
font-size: 11px;
line-height: 1.4;
}
.heat-track {
height: 5px;
margin-top: 10px;
overflow: hidden;
border-radius: 999px;
background: rgba(24, 50, 56, 0.08);
}
.heat-fill {
height: 100%;
border-radius: inherit;
background: var(--heat);
}
.heat-caption {
display: flex;
justify-content: space-between;
margin-top: 5px;
color: var(--muted);
font-size: 8px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.hint {
position: absolute;
right: 20px;
bottom: 19px;
padding: 7px 10px;
border-radius: 8px;
background: rgba(250, 248, 240, 0.68);
color: var(--muted);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.06em;
text-transform: uppercase;
backdrop-filter: blur(6px);
}
@media (max-width: 900px) {
.legend,
.hint {
display: none;
}
.compare {
width: calc(100vw - 24px);
bottom: 12px;
gap: 8px;
}
.compare-card {
padding: 10px 11px;
}
}
@media (max-width: 620px) {
.title-card {
top: 10px;
left: 10px;
width: calc(100vw - 20px);
padding: 13px 15px;
}
.subtitle {
margin-bottom: 9px;
}
.compare {
flex-direction: column;
}
.compare-card {
padding: 9px 11px;
}
.compare-card:nth-child(2) {
display: none;
}
.annotation {
padding: 5px 7px;
font-size: 8px;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div id="annotations"></div>
<div class="ui">
<header class="title-card">
<div class="eyebrow">Comparative microclimate study</div>
<h1>Urban Heat Islands</h1>
<p class="subtitle">
Two architecturally identical courtyards receive the same solar geometry.
Their cooling outcomes differ because canopy shade and water availability differ.
</p>
<div class="constraint">Solar input held constant</div>
</header>
<aside class="legend">
<div class="legend-title">Process key</div>
<div class="legend-row">
<span class="swatch" style="--swatch:#e4a52f"></span>
Solar radiation
</div>
<div class="legend-row">
<span class="swatch" style="--swatch:#347a54"></span>
Canopy shade
</div>
<div class="legend-row">
<span class="swatch" style="--swatch:#178b87"></span>
Evapotranspiration
</div>
<div class="legend-row">
<span class="swatch" style="--swatch:#247fc4"></span>
Water evaporation
</div>
<div class="legend-row">
<span class="swatch" style="--swatch:#dc654e"></span>
Retained surface heat
</div>
</aside>
<section class="compare">
<article class="compare-card">
<div class="compare-head">
<span class="compare-name">Courtyard A</span>
<span class="chip" style="--chip-color:#347a54">Shade-led</span>
</div>
<div class="compare-copy">
Dense canopy, low water. Cooling comes from intercepted radiation and
evapotranspiration.
</div>
<div class="heat-track">
<div class="heat-fill" style="width:38%;--heat:#4e9872"></div>
</div>
<div class="heat-caption">
<span>Relative heat load</span>
<span>Lower</span>
</div>
</article>
<article class="compare-card">
<div class="compare-head">
<span class="compare-name">Courtyard B</span>
<span class="chip" style="--chip-color:#247fc4">Water-led</span>
</div>
<div class="compare-copy">
Sparse canopy, high water. More paving absorbs heat, while evaporation
supplies direct cooling.
</div>
<div class="heat-track">
<div class="heat-fill" style="width:78%;--heat:#dc654e"></div>
</div>
<div class="heat-caption">
<span>Relative heat load</span>
<span>Higher</span>
</div>
</article>
</section>
<div class="hint">Drag to orbit · Scroll to zoom</div>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneHost = document.getElementById("scene");
const annotationHost = document.getElementById("annotations");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd7e3df);
scene.fog = new THREE.Fog(0xd7e3df, 31, 68);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
sceneHost.appendChild(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraTarget = new THREE.Vector3(0, 2.15, 0);
let cameraYaw = 0.34;
let cameraPitch = 0.58;
let cameraRadius = 32;
function updateCamera() {
const horizontal = Math.cos(cameraPitch);
camera.position.set(
cameraTarget.x + cameraRadius * Math.sin(cameraYaw) * horizontal,
cameraTarget.y + cameraRadius * Math.sin(cameraPitch),
cameraTarget.z + cameraRadius * Math.cos(cameraYaw) * horizontal
);
camera.lookAt(cameraTarget);
}
updateCamera();
// Direct, dependency-free orbit and zoom controls.
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.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
cameraYaw -= dx * 0.005;
cameraPitch = THREE.MathUtils.clamp(
cameraPitch + dy * 0.0035,
0.24,
1.22
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined) {
try {
renderer.domElement.releasePointerCapture(event.pointerId);
} catch (_) {}
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraRadius = THREE.MathUtils.clamp(
cameraRadius + event.deltaY * 0.018,
19,
46
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => {
cameraYaw = 0.34;
cameraPitch = 0.58;
cameraRadius = 32;
updateCamera();
});
const hemisphere = new THREE.HemisphereLight(
0xeaf7f5,
0x83927f,
1.75
);
scene.add(hemisphere);
const sunLight = new THREE.DirectionalLight(0xfff0c5, 2.35);
sunLight.position.set(-10, 18, 10);
sunLight.castShadow = true;
sunLight.shadow.mapSize.set(2048, 2048);
sunLight.shadow.camera.left = -22;
sunLight.shadow.camera.right = 22;
sunLight.shadow.camera.top = 20;
sunLight.shadow.camera.bottom = -16;
sunLight.shadow.camera.near = 1;
sunLight.shadow.camera.far = 55;
sunLight.shadow.bias = -0.00035;
scene.add(sunLight);
const fillLight = new THREE.DirectionalLight(0xc8e8ee, 0.5);
fillLight.position.set(12, 8, -12);
scene.add(fillLight);
const materials = {
ground: new THREE.MeshStandardMaterial({
color: 0xb8c6bb,
roughness: 0.96,
flatShading: true
}),
base: new THREE.MeshStandardMaterial({
color: 0xd9cfbc,
roughness: 0.92,
flatShading: true
}),
plaza: new THREE.MeshStandardMaterial({
color: 0xc7b9a2,
roughness: 0.95,
flatShading: true
}),
wall: new THREE.MeshStandardMaterial({
color: 0xe0d4c1,
roughness: 0.86,
flatShading: true
}),
wallWarm: new THREE.MeshStandardMaterial({
color: 0xcdbba6,
roughness: 0.88,
flatShading: true
}),
roof: new THREE.MeshStandardMaterial({
color: 0x8c9188,
roughness: 0.9,
flatShading: true
}),
window: new THREE.MeshStandardMaterial({
color: 0x355c63,
roughness: 0.45,
metalness: 0.12,
flatShading: true
}),
border: new THREE.MeshStandardMaterial({
color: 0x657274,
roughness: 0.9,
flatShading: true
}),
soil: new THREE.MeshStandardMaterial({
color: 0x857460,
roughness: 1,
flatShading: true
}),
trunk: new THREE.MeshStandardMaterial({
color: 0x74503a,
roughness: 1,
flatShading: true
}),
leafA: new THREE.MeshStandardMaterial({
color: 0x3f7952,
roughness: 0.95,
flatShading: true
}),
leafB: new THREE.MeshStandardMaterial({
color: 0x659261,
roughness: 0.95,
flatShading: true
}),
lowWater: new THREE.MeshStandardMaterial({
color: 0x6b9da2,
roughness: 0.32,
metalness: 0.05,
transparent: true,
opacity: 0.82,
flatShading: true
}),
highWater: new THREE.MeshStandardMaterial({
color: 0x248ac3,
roughness: 0.2,
metalness: 0.08,
transparent: true,
opacity: 0.9,
flatShading: true
}),
shade: new THREE.MeshBasicMaterial({
color: 0x315d46,
transparent: true,
opacity: 0.3,
depthWrite: false
}),
heat: new THREE.MeshBasicMaterial({
color: 0xdf684d,
transparent: true,
opacity: 0.27,
depthWrite: false
}),
sun: new THREE.MeshBasicMaterial({
color: 0xf6bc43,
toneMapped: false
}),
sunHalo: new THREE.MeshBasicMaterial({
color: 0xffdd76,
toneMapped: false
})
};
function addBox(
parent,
width,
height,
depth,
material,
x,
y,
z,
castShadow = true,
receiveShadow = true
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = castShadow;
mesh.receiveShadow = receiveShadow;
parent.add(mesh);
return mesh;
}
function addCylinder(
parent,
radiusTop,
radiusBottom,
height,
material,
x,
y,
z,
segments = 10
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeArrow(
parent,
start,
end,
color,
radius = 0.055,
headLength = 0.4,
headWidth = 0.23
) {
const arrow = new THREE.Group();
const direction = end.clone().sub(start);
const length = direction.length();
const normalized = direction.clone().normalize();
const shaftLength = Math.max(0.001, length - headLength);
const arrowMaterial = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 0.18,
roughness: 0.55,
flatShading: true
});
const shaft = new THREE.Mesh(
new THREE.CylinderGeometry(
radius,
radius,
shaftLength,
8
),
arrowMaterial
);
shaft.position.copy(start).addScaledVector(normalized, shaftLength / 2);
shaft.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
normalized
);
shaft.castShadow = true;
arrow.add(shaft);
const head = new THREE.Mesh(
new THREE.ConeGeometry(headWidth, headLength, 10),
arrowMaterial
);
head.position.copy(end).addScaledVector(normalized, -headLength / 2);
head.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
normalized
);
head.castShadow = true;
arrow.add(head);
parent.add(arrow);
return arrow;
}
function buildArchitecture(group) {
addBox(
group,
10.8,
0.55,
8.3,
materials.base,
0,
0.275,
0
);
addBox(
group,
9.3,
0.18,
6.9,
materials.plaza,
0,
0.64,
0.1
);
// Identical rear building.
addBox(
group,
10.3,
4.6,
1.4,
materials.wall,
0,
3.0,
-3.0
);
addBox(
group,
10.6,
0.25,
1.65,
materials.roof,
0,
5.43,
-3.0
);
// Identical side wings create the same enclosed courtyard geometry.
addBox(
group,
1.35,
3.25,
5.7,
materials.wallWarm,
-4.55,
2.35,
-0.45
);
addBox(
group,
1.35,
3.25,
5.7,
materials.wallWarm,
4.55,
2.35,
-0.45
);
addBox(
group,
1.55,
0.22,
5.9,
materials.roof,
-4.55,
4.08,
-0.45
);
addBox(
group,
1.55,
0.22,
5.9,
materials.roof,
4.55,
4.08,
-0.45
);
// Solid inset windows.
[-3.55, -1.78, 0, 1.78, 3.55].forEach((x) => {
[2.0, 3.65].forEach((y) => {
addBox(
group,
0.82,
0.92,
0.08,
materials.window,
x,
y,
-2.26,
false,
false
);
});
});
addBox(
group,
1.35,
2.15,
0.1,
materials.window,
0,
1.8,
-2.24,
false,
false
);
[-3.8, 3.8].forEach((x) => {
[2.3, 3.35].forEach((y) => {
addBox(
group,
0.08,
0.82,
0.7,
materials.window,
x,
y,
-1.1,
false,
false
);
});
});
}
function buildWaterBasin(group, level) {
const x = 2.75;
const z = 1.65;
addBox(
group,
2.42,
0.08,
1.52,
materials.soil,
x,
0.79,
z,
false
);
addBox(
group,
0.13,
0.24,
1.52,
materials.border,
x - 1.15,
0.87,
z
);
addBox(
group,
0.13,
0.24,
1.52,
materials.border,
x + 1.15,
0.87,
z
);
addBox(
group,
2.42,
0.24,
0.13,
materials.border,
x,
0.87,
z - 0.695
);
addBox(
group,
2.42,
0.24,
0.13,
materials.border,
x,
0.87,
z + 0.695
);
if (level === "low") {
addBox(
group,
1.1,
0.055,
0.58,
materials.lowWater,
x - 0.25,
0.835,
z,
false,
false
);
} else {
addBox(
group,
2.14,
0.12,
1.24,
materials.highWater,
x,
0.9,
z,
false,
false
);
}
}
function addTree(group, x, z, scale) {
const trunkHeight = 2.2 * scale;
const baseY = 0.74;
addCylinder(
group,
0.13 * scale,
0.23 * scale,
trunkHeight,
materials.trunk,
x,
baseY + trunkHeight / 2,
z
);
const shade = new THREE.Mesh(
new THREE.CylinderGeometry(
1.14 * scale,
1.14 * scale,
0.018,
28
),
materials.shade
);
shade.position.set(x, 0.742, z);
shade.receiveShadow = false;
group.add(shade);
const canopyY = baseY + 2.55 * scale;
const lobes = [
[-0.42, 0.02, 0.02, 0.92],
[0.42, 0.05, -0.05, 0.86],
[0.0, 0.43, 0.02, 0.9]
];
lobes.forEach((lobe, index) => {
const canopy = new THREE.Mesh(
new THREE.IcosahedronGeometry(1, 1),
index === 1 ? materials.leafB : materials.leafA
);
canopy.position.set(
x + lobe[0] * scale,
canopyY + lobe[1] * scale,
z + lobe[2] * scale
);
canopy.scale.set(
lobe[3] * scale * 1.12,
lobe[3] * scale * 0.92,
lobe[3] * scale * 1.05
);
canopy.rotation.y = index * 0.8;
canopy.castShadow = true;
canopy.receiveShadow = true;
group.add(canopy);
});
}
function buildSolarGeometry(group) {
const sunPosition = new THREE.Vector3(0, 10.2, -3.2);
const sun = new THREE.Mesh(
new THREE.SphereGeometry(0.66, 24, 16),
materials.sun
);
sun.position.copy(sunPosition);
group.add(sun);
const halo = new THREE.Mesh(
new THREE.TorusGeometry(0.94, 0.045, 8, 42),
materials.sunHalo
);
halo.position.copy(sunPosition);
group.add(halo);
// These target points are copied exactly into both courtyards.
// The only difference is the local courtyard that receives them.
const targets = [
[-3.2, 0.76, -0.7],
[-0.9, 0.76, -2.1],
[1.5, 0.76, -0.4],
[3.0, 0.76, -2.0],
[-1.4, 0.76, 2.1],
[2.1, 0.76, 2.0]
];
targets.forEach((coordinates) => {
const target = new THREE.Vector3(...coordinates);
const direction = target.clone().sub(sunPosition).normalize();
const start = sunPosition.clone().addScaledVector(direction, 0.64);
makeArrow(
group,
start,
target,
0xe5a82f,
0.027,
0.34,
0.13
);
});
}
const vaporParticles = [];
function addMist(group, x, z, color, count) {
const mistMaterial = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.5,
depthWrite: false,
toneMapped: false
});
for (let i = 0; i < count; i++) {
const particle = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.075 + (i % 3) * 0.012, 0),
mistMaterial
);
particle.position.set(
x + Math.sin(i * 2.7) * 0.32,
1.1 + i * 0.13,
z + Math.cos(i * 2.1) * 0.22
);
group.add(particle);
vaporParticles.push({
mesh: particle,
baseY: particle.position.y,
phase: i * 0.73,
speed: 0.13 + (i % 4) * 0.018
});
}
}
function buildCourtyard(x, variant) {
const group = new THREE.Group();
group.position.x = x;
scene.add(group);
buildArchitecture(group);
buildSolarGeometry(group);
if (variant === "A") {
addTree(group, -2.45, -1.15, 1.15);
addTree(group, -0.05, -1.5, 1.05);
addTree(group, 2.65, -1.85, 0.94);
buildWaterBasin(group, "low");
makeArrow(
group,
new THREE.Vector3(-2.45, 3.05, -1.15),
new THREE.Vector3(-2.45, 0.9, -1.15),
0x347a54,
0.065,
0.45,
0.28
);
makeArrow(
group,
new THREE.Vector3(-0.05, 3.7, -1.5),
new THREE.Vector3(-0.05, 6.0, -1.5),
0x178b87,
0.05,
0.42,
0.25
);
addMist(group, -0.05, -1.5, 0x8ed6c2, 7);
} else {
addTree(group, -3.05, -1.35, 0.62);
buildWaterBasin(group, "high");
makeArrow(
group,
new THREE.Vector3(2.75, 1.05, 1.65),
new THREE.Vector3(2.75, 4.85, 1.65),
0x247fc4,
0.065,
0.48,
0.3
);
makeArrow(
group,
new THREE.Vector3(-1.15, 0.9, 0.55),
new THREE.Vector3(-1.15, 3.35, 0.55),
0xdc654e,
0.055,
0.42,
0.26
);
addMist(group, 2.75, 1.65, 0x7ed3ef, 8);
// Stylized hot paving patches reinforce the retained-heat mechanism.
[
[-1.2, 0.45, 0.62],
[0.05, 1.0, 0.48],
[-2.25, 1.75, 0.5]
].forEach((patch) => {
const heatPatch = new THREE.Mesh(
new THREE.CylinderGeometry(
patch[2],
patch[2],
0.018,
24
),
materials.heat
);
heatPatch.position.set(patch[0], 0.744, patch[1]);
group.add(heatPatch);
});
}
return group;
}
const courtyardA = buildCourtyard(-6.2, "A");
const courtyardB = buildCourtyard(6.2, "B");
// Large matte ground plane.
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(80, 55),
materials.ground
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.03;
ground.receiveShadow = true;
scene.add(ground);
// Simplified surrounding urban massing.
const distantBuildings = [
[-16.5, 2.0, -9.5, 4.0, 4.0, 3.6],
[-11.8, 1.45, -11.0, 3.2, 2.9, 3.0],
[13.6, 2.25, -10.0, 4.5, 4.5, 3.7],
[18.2, 1.3, -7.8, 3.1, 2.6, 3.2]
];
distantBuildings.forEach((building) => {
addBox(
scene,
building[3],
building[4],
building[5],
materials.wallWarm,
building[0],
building[1],
building[2]
);
});
const annotations = [];
function addAnnotation(text, position, className = "") {
const element = document.createElement("div");
element.className = `annotation ${className}`;
element.textContent = text;
annotationHost.appendChild(element);
annotations.push({
element,
position: position.clone()
});
}
addAnnotation(
"CANOPY SHADE",
new THREE.Vector3(-8.65, 2.15, -1.15),
"green"
);
addAnnotation(
"EVAPOTRANSPIRATION",
new THREE.Vector3(-6.25, 5.05, -1.5),
"teal"
);
addAnnotation(
"LOW WATER",
new THREE.Vector3(-3.45, 1.25, 1.65),
"teal"
);
addAnnotation(
"WATER-RICH",
new THREE.Vector3(8.95, 1.25, 1.65),
"blue"
);
addAnnotation(
"EVAPORATIVE COOLING",
new THREE.Vector3(8.95, 3.65, 1.65),
"blue"
);
addAnnotation(
"RETAINED SURFACE HEAT",
new THREE.Vector3(5.05, 2.15, 0.55),
"coral"
);
addAnnotation(
"MATCHED SOLAR GEOMETRY",
new THREE.Vector3(0, 11.2, -3.2),
"gold"
);
addAnnotation(
"SHADE-LED COURTYARD",
new THREE.Vector3(-6.2, 6.25, -2.85),
"green"
);
addAnnotation(
"WATER-LED COURTYARD",
new THREE.Vector3(6.2, 6.25, -2.85),
"blue"
);
const projectedPosition = new THREE.Vector3();
function updateAnnotations() {
const width = window.innerWidth;
const height = window.innerHeight;
annotations.forEach((annotation) => {
projectedPosition.copy(annotation.position).project(camera);
const visible =
projectedPosition.z > -1 &&
projectedPosition.z < 1;
annotation.element.style.display = visible ? "block" : "none";
const x = (projectedPosition.x * 0.5 + 0.5) * width;
const y = (-projectedPosition.y * 0.5 + 0.5) * height;
annotation.element.style.left = `${x}px`;
annotation.element.style.top = `${y}px`;
});
}
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
vaporParticles.forEach((particle) => {
const travel = (elapsed * particle.speed + particle.phase) % 1;
particle.mesh.position.y =
particle.baseY + travel * 1.35;
particle.mesh.position.x +=
Math.sin(elapsed * 1.2 + particle.phase) * 0.0008;
particle.mesh.material.opacity =
0.5 * Math.sin(Math.PI * travel);
});
updateAnnotations();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```