Prompt specification
Build or customize the Three.js 3D scene "Community Hall Across Three Climates" 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: Community Hall Across Three Climates
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/community-hall-across-three-climates-x3283
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing architectural expression through form, light, and gathering spaces. Compare three schematic halls serving the same program in different climate assumptions. Explain roof, opening, and shading choices without claiming universal regional architectural rules. Voxel style.
Working Three.js Starter (community-hall-across-three-climates-x3283):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<title>One Program, Three Climate Propositions</title>
<style>
:root {
--paper: #f4f0e7;
--paper-deep: #e8e1d5;
--ink: #26312d;
--muted: #6f746e;
--line: rgba(38, 49, 45, 0.17);
--yellow: #d9ad3f;
--coral: #d7684d;
--teal: #3f7f74;
--blue: #60799b;
--white: #fffdf7;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
.layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
width: 100%;
height: 100vh;
overflow: hidden;
}
#viewport {
position: relative;
min-width: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.55), transparent 55%),
var(--paper-deep);
}
#viewport canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
outline: none;
}
#viewport canvas:active {
cursor: grabbing;
}
.title-block {
position: absolute;
z-index: 4;
top: 25px;
left: 28px;
width: min(610px, calc(100% - 340px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 29px;
height: 2px;
background: var(--ink);
}
h1 {
max-width: 580px;
margin: 0;
font-size: clamp(29px, 3.3vw, 51px);
line-height: 0.98;
letter-spacing: -0.055em;
font-weight: 760;
}
.subtitle {
max-width: 520px;
margin: 13px 0 0;
color: #555f59;
font-size: 12px;
line-height: 1.5;
}
.controls {
position: absolute;
z-index: 6;
top: 24px;
right: 22px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
width: 274px;
}
.control-button {
border: 1px solid var(--line);
border-radius: 3px;
padding: 8px 10px;
background: rgba(255, 253, 247, 0.84);
backdrop-filter: blur(9px);
cursor: pointer;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.055em;
text-transform: uppercase;
transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.control-button:hover {
transform: translateY(-1px);
background: var(--white);
}
.control-button[aria-pressed="true"] {
color: var(--white);
background: var(--ink);
border-color: var(--ink);
}
.sun-control {
position: absolute;
z-index: 6;
right: 22px;
bottom: 24px;
width: 190px;
padding: 10px 12px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(255, 253, 247, 0.88);
backdrop-filter: blur(10px);
}
.sun-control label {
display: flex;
justify-content: space-between;
margin-bottom: 7px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.sun-control input {
width: 100%;
accent-color: var(--ink);
}
.legend {
position: absolute;
z-index: 5;
left: 25px;
bottom: 24px;
display: flex;
flex-wrap: wrap;
gap: 10px 15px;
max-width: min(620px, calc(100% - 260px));
padding: 10px 12px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(255, 253, 247, 0.86);
backdrop-filter: blur(10px);
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 6px;
color: #59615c;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.swatch {
width: 10px;
height: 10px;
border-radius: 1px;
background: var(--swatch);
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.compass {
position: absolute;
z-index: 5;
left: 27px;
top: 173px;
width: 33px;
height: 50px;
color: rgba(38, 49, 45, 0.62);
pointer-events: none;
font-size: 9px;
font-weight: 900;
text-align: center;
}
.compass::after {
content: "";
display: block;
width: 0;
height: 0;
margin: 4px auto 0;
border-right: 6px solid transparent;
border-left: 6px solid transparent;
border-bottom: 22px solid currentColor;
}
aside {
position: relative;
z-index: 8;
height: 100vh;
overflow-y: auto;
padding: 28px 25px 24px;
background: var(--paper);
border-left: 1px solid var(--line);
scrollbar-width: thin;
}
.brief {
padding-bottom: 18px;
border-bottom: 1px solid var(--line);
}
.section-label {
margin: 0 0 9px;
color: var(--muted);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.brief h2 {
margin: 0;
font-size: 22px;
line-height: 1.12;
letter-spacing: -0.035em;
}
.brief p {
margin: 10px 0 0;
color: #68706a;
font-size: 11px;
line-height: 1.55;
}
.program-line {
display: flex;
flex-wrap: wrap;
gap: 5px;
margin-top: 13px;
}
.program-chip {
border: 1px solid var(--line);
border-radius: 2px;
padding: 5px 6px;
color: #535d57;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.cards {
display: grid;
gap: 9px;
padding-top: 18px;
}
.climate-card {
width: 100%;
padding: 14px 14px 13px;
border: 1px solid var(--line);
border-left: 4px solid var(--accent);
border-radius: 2px;
background: rgba(255, 253, 247, 0.54);
text-align: left;
cursor: pointer;
transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.climate-card:hover {
transform: translateX(-2px);
background: var(--white);
}
.climate-card.active {
color: var(--white);
background: var(--ink);
box-shadow: 0 9px 24px rgba(38, 49, 45, 0.12);
}
.card-top {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.card-title {
font-size: 15px;
font-weight: 790;
letter-spacing: -0.025em;
}
.card-index {
color: var(--muted);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.1em;
}
.climate-card.active .card-index {
color: rgba(255, 255, 255, 0.6);
}
.assumption {
margin-bottom: 10px;
color: #737a74;
font-size: 10px;
line-height: 1.4;
}
.climate-card.active .assumption {
color: rgba(255, 255, 255, 0.67);
}
.strategy {
display: grid;
grid-template-columns: 48px 1fr;
gap: 4px 8px;
margin-top: 5px;
font-size: 10px;
line-height: 1.38;
}
.strategy strong {
color: var(--accent);
font-size: 8px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.climate-card.active .strategy strong {
color: #e6c873;
}
.caveat {
margin-top: 18px;
padding: 14px;
border: 1px solid rgba(38, 49, 45, 0.12);
border-radius: 3px;
background: #ebe5da;
}
.caveat h3 {
margin: 0 0 7px;
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.caveat p {
margin: 0;
color: #626a64;
font-size: 10px;
line-height: 1.55;
}
.instructions {
margin-top: 15px;
color: #7b807b;
font-size: 9px;
line-height: 1.5;
}
@media (max-width: 1050px) {
.layout {
grid-template-columns: minmax(0, 1fr) 340px;
}
.title-block {
width: calc(100% - 260px);
}
.controls {
width: 220px;
}
}
@media (max-width: 820px) {
.layout {
display: block;
height: auto;
overflow: visible;
}
#viewport {
height: 68vh;
min-height: 520px;
}
aside {
height: auto;
overflow: visible;
border-top: 1px solid var(--line);
border-left: 0;
}
.title-block {
width: calc(100% - 40px);
top: 19px;
left: 20px;
}
.subtitle {
max-width: 390px;
}
.controls {
top: auto;
right: 14px;
bottom: 14px;
width: 190px;
}
.sun-control {
right: 14px;
bottom: 112px;
}
.legend {
left: 14px;
bottom: 14px;
max-width: calc(100% - 225px);
}
.compass {
display: none;
}
}
@media (max-width: 540px) {
#viewport {
min-height: 560px;
}
.title-block {
width: calc(100% - 28px);
left: 14px;
}
h1 {
font-size: 33px;
}
.subtitle {
display: none;
}
.controls {
width: 172px;
}
.control-button {
padding: 7px 8px;
font-size: 8px;
}
.legend {
right: 14px;
max-width: none;
}
.sun-control {
left: 14px;
right: auto;
bottom: 104px;
}
aside {
padding: 23px 18px;
}
}
</style>
</head>
<body>
<main class="layout">
<section id="viewport" aria-label="Interactive voxel comparison of three architectural hall proposals">
<header class="title-block">
<div class="eyebrow">Common brief / changing environments</div>
<h1>One program,<br>three atmospheric propositions.</h1>
<p class="subtitle">
The same civic hall is tested as a seasonal, high-solar, and warm-humid
building. Cut away the roofs to compare the shared gathering spaces.
</p>
</header>
<nav class="controls" aria-label="Model controls">
<button class="control-button" id="cutaway" aria-pressed="true">Cutaway</button>
<button class="control-button" id="airflow" aria-pressed="false">Airflow</button>
<button class="control-button" id="sun" aria-pressed="false">Sun study</button>
<button class="control-button" id="top">Plan</button>
<button class="control-button" id="reset">Reset</button>
</nav>
<div class="compass" aria-hidden="true">N</div>
<div class="legend" aria-label="Program color key">
<div class="legend-item"><span class="swatch" style="--swatch:#d9ae3f"></span>Forum</div>
<div class="legend-item"><span class="swatch" style="--swatch:#d7684d"></span>Stage</div>
<div class="legend-item"><span class="swatch" style="--swatch:#3f7f74"></span>Gallery</div>
<div class="legend-item"><span class="swatch" style="--swatch:#60799b"></span>Workshop</div>
<div class="legend-item"><span class="swatch" style="--swatch:#91877c"></span>Services</div>
</div>
<div class="sun-control">
<label for="time">
<span>Sun position</span>
<output id="time-value">13:00</output>
</label>
<input id="time" type="range" min="8" max="18" value="13" step="0.25">
</div>
</section>
<aside>
<section class="brief">
<p class="section-label">Shared program</p>
<h2>An adaptable public hall for collective use.</h2>
<p>
Each model contains the same forum, stage, gallery, workshop, foyer,
and service zones. Only the environmental proposition changes.
Colored floor plates and furniture identify the common brief.
</p>
<div class="program-line">
<span class="program-chip">Assembly forum</span>
<span class="program-chip">Small stage</span>
<span class="program-chip">Gallery</span>
<span class="program-chip">Workshop</span>
<span class="program-chip">Foyer</span>
<span class="program-chip">Services</span>
</div>
</section>
<section class="cards" aria-label="Climate propositions">
<button class="climate-card" style="--accent:#d9ad3f" data-hall="0">
<div class="card-top">
<span class="card-title">A / Variable-season</span>
<span class="card-index">01</span>
</div>
<div class="assumption">
Assumption: four-season operation, cool winters, mild-to-moderate summers,
and useful daylight in shoulder periods.
</div>
<div class="strategy">
<strong>Roof</strong><span>Stepped sawtooth bays give the hall a rhythmic, inhabited silhouette.</span>
<strong>Opening</strong><span>Tall controlled clerestories admit diffuse light while limiting uncontrolled loss.</span>
<strong>Shade</strong><span>Narrow vertical fins temper low-angle sun without closing the view out.</span>
</div>
</button>
<button class="climate-card" style="--accent:#d7684d" data-hall="1">
<div class="card-top">
<span class="card-title">B / High-solar</span>
<span class="card-index">02</span>
</div>
<div class="assumption">
Assumption: strong solar exposure, dusty glare, cool nights, and a
managed, relatively compact occupied period.
</div>
<div class="strategy">
<strong>Roof</strong><span>A thick stepped canopy creates a protected perimeter and a central light court.</span>
<strong>Opening</strong><span>Few, small high-level slots reduce direct heat gain and glare.</span>
<strong>Shade</strong><span>Deep eaves and a porous screen make the threshold progressively cooler and darker.</span>
</div>
</button>
<button class="climate-card" style="--accent:#3f7f74" data-hall="2">
<div class="card-top">
<span class="card-title">C / Warm-humid</span>
<span class="card-index">03</span>
</div>
<div class="assumption">
Assumption: warm humid air, frequent rain, and outdoor breezes that
remain useful only when sheltered and directed.
</div>
<div class="strategy">
<strong>Roof</strong><span>A lifted butterfly canopy raises the outer edges and leaves high ventilation pockets.</span>
<strong>Opening</strong><span>Large sheltered perimeter slots establish cross-ventilation paths through the forum.</span>
<strong>Shade</strong><span>Layered eaves shade walls and rain while preserving sheltered air movement.</span>
</div>
</button>
</section>
<section class="caveat">
<h3>A comparison, not a regional rulebook</h3>
<p>
These labels describe specific design assumptions, not universal
architectural rules for geographic regions. Orientation, material
properties, occupancy, vegetation, wind, rain, solar access, codes,
and operation can reverse the performance of any proposition.
The airflow is diagrammatic rather than CFD analysis, and the model
is not a code or environmental simulation.
</p>
</section>
<p class="instructions">
Drag to orbit · Scroll or pinch to zoom · Select a proposition to focus it.
All three halls use the same scale and schematic orientation for comparison.
</p>
</aside>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, scene, and camera
// -------------------------------------------------------------------------
const viewport = document.getElementById("viewport");
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.setAttribute(
"aria-label",
"Three voxel hall models with architectural climate strategies"
);
viewport.prepend(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe8e2d7);
scene.fog = new THREE.Fog(0xe8e2d7, 145, 245);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 320);
const cameraState = {
theta: 0.18,
phi: 0.83,
radius: 126,
target: new THREE.Vector3(0, 2.5, 0)
};
const cameraGoal = {
theta: cameraState.theta,
phi: cameraState.phi,
radius: cameraState.radius,
target: cameraState.target.clone()
};
const hemi = new THREE.HemisphereLight(0xfff7e9, 0x918878, 2.15);
scene.add(hemi);
const sunLight = new THREE.DirectionalLight(0xfff0cf, 3.15);
sunLight.position.set(0, 60, 55);
sunLight.castShadow = true;
sunLight.shadow.mapSize.set(2048, 2048);
sunLight.shadow.camera.left = -72;
sunLight.shadow.camera.right = 72;
sunLight.shadow.camera.top = 48;
sunLight.shadow.camera.bottom = -48;
sunLight.shadow.camera.near = 1;
sunLight.shadow.camera.far = 180;
sunLight.shadow.bias = -0.00035;
sunLight.shadow.normalBias = 0.025;
scene.add(sunLight);
const fillLight = new THREE.DirectionalLight(0xc7dce4, 0.55);
fillLight.position.set(-45, 30, -30);
scene.add(fillLight);
// -------------------------------------------------------------------------
// Shared materials and voxel helpers
// -------------------------------------------------------------------------
function material(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
...options
});
}
const M = {
ground: material(0xe8e2d7),
plinth: material(0xc8bfb1),
floor: material(0xeee8dc),
wall: material(0xd5cec2),
wallDark: material(0xaaa396),
structure: material(0x706e65),
wood: material(0xc88d59),
stage: material(0xd7684d),
gallery: material(0x3f7f74),
forum: material(0xd9ae3f),
workshop: material(0x60799b),
service: material(0x91877c),
shade: material(0xb9a47e),
glass: material(0x8eb8b1, {
transparent: true,
opacity: 0.52,
depthWrite: false,
roughness: 0.3
}),
personA: material(0x394d54),
personB: material(0xa75442),
personC: material(0x496f65),
personD: material(0xc09a42)
};
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0x4b514b,
transparent: true,
opacity: 0.38
});
function box(parent, w, h, d, mat, x = 0, y = 0, z = 0, withEdges = false) {
const geometry = new THREE.BoxGeometry(w, h, d);
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.set(x, y, z);
mesh.castShadow = !mat.transparent || mat.opacity > 0.6;
mesh.receiveShadow = true;
parent.add(mesh);
if (withEdges) {
const edge = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry, 24),
edgeMaterial
);
edge.position.copy(mesh.position);
parent.add(edge);
}
return mesh;
}
function makeLabel(title, subtitle, accent) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 160;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "rgba(255,253,247,0.94)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = accent;
ctx.fillRect(0, 0, 15, canvas.height);
ctx.strokeStyle = "rgba(38,49,45,0.18)";
ctx.strokeRect(0.5, 0.5, canvas.width - 1, canvas.height - 1);
ctx.fillStyle = "#26312d";
ctx.font = "800 36px Arial";
ctx.textBaseline = "middle";
ctx.fillText(title, 43, 58);
ctx.fillStyle = "#6f746e";
ctx.font = "700 21px Arial";
ctx.fillText(subtitle, 44, 108);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(17.5, 3.65, 1);
sprite.renderOrder = 30;
return sprite;
}
// -------------------------------------------------------------------------
// Site plane and background grid
// -------------------------------------------------------------------------
box(scene, 155, 0.3, 78, M.ground, 0, -0.57, 0);
const grid = new THREE.GridHelper(150, 75, 0x8f918a, 0xa8a69d);
grid.position.y = -0.405;
grid.material.transparent = true;
grid.material.opacity = 0.18;
scene.add(grid);
box(scene, 110, 0.08, 2.1, M.floor, 0, 0.32, 11.25);
// -------------------------------------------------------------------------
// Shared program: identical in all three proposals
// -------------------------------------------------------------------------
function addPerson(parent, x, z, mat, rotation = 0) {
const person = new THREE.Group();
person.position.set(x, 0, z);
person.rotation.y = rotation;
box(person, 0.31, 0.62, 0.23, mat, 0, 0.83, 0);
box(person, 0.24, 0.24, 0.24, M.wall, 0, 1.25, 0);
box(person, 0.12, 0.25, 0.12, M.structure, -0.09, 0.39, 0);
box(person, 0.12, 0.25, 0.12, M.structure, 0.09, 0.39, 0);
parent.add(person);
}
function addProgram(parent) {
// Stage zone at the rear left.
box(parent, 5.1, 0.42, 4.2, M.stage, -7, 0.71, -4.45, true);
box(parent, 4.75, 2.65, 0.18, M.stage, -7, 1.82, -6.42);
box(parent, 1.45, 0.82, 0.7, M.wood, -7.65, 1.33, -4.9);
box(parent, 0.7, 0.72, 0.7, M.structure, -5.65, 1.36, -5.35);
// Gallery zone at the rear right.
box(parent, 6.1, 0.08, 4.35, M.gallery, 7, 0.55, -4.45);
box(parent, 5.9, 2.45, 0.14, M.gallery, 7, 1.73, -6.42);
box(parent, 0.68, 0.78, 0.68, M.wall, 5, 0.92, -5.2);
box(parent, 0.68, 1.05, 0.68, M.wall, 6.5, 1.05, -3.85);
box(parent, 0.68, 0.68, 0.68, M.wall, 8.2, 0.87, -5.25);
box(parent, 0.68, 0.92, 0.68, M.wall, 9.4, 1, -3.65);
// Central gathering forum.
box(parent, 8.2, 0.08, 6.25, M.forum, -2.15, 0.55, 0.65);
box(parent, 3.35, 0.32, 1.05, M.wood, -2.15, 1.02, 0.65, true);
const seatPositions = [
[-4.7, -1.25], [-3.45, -1.25], [-2.15, -1.25], [-0.85, -1.25],
[-4.55, 2.55], [-3.3, 2.55], [-2.05, 2.55], [-0.8, 2.55],
[-5.55, 0.15], [-5.55, 1.35], [1.25, 0.05], [1.25, 1.35]
];
seatPositions.forEach(([x, z], i) => {
box(
parent,
0.72,
0.42,
0.72,
i % 3 === 0 ? M.wallDark : M.wood,
x,
0.8,
z
);
});
// Workshop zone.
box(parent, 6.1, 0.08, 5.05, M.workshop, 7.05, 0.55, 1.05);
box(parent, 2.7, 0.23, 1.05, M.wood, 5.55, 1.03, 0.05);
box(parent, 2.7, 0.23, 1.05, M.wood, 8.55, 1.03, 0.05);
box(parent, 2.7, 0.23, 1.05, M.wood, 5.55, 1.03, 2.15);
box(parent, 2.7, 0.23, 1.05, M.wood, 8.55, 1.03, 2.15);
// Foyer and service zone.
box(parent, 4.8, 0.08, 4.0, M.service, -8.1, 0.55, 2.75);
box(parent, 2.25, 1.05, 0.7, M.wood, -8.4, 1.08, 1.25, true);
box(parent, 1.0, 0.8, 1.0, M.service, -9.7, 0.95, 4);
box(parent, 1.0, 0.8, 1.0, M.service, -8.4, 0.95, 4);
// Low partitions preserve legibility of the shared plan.
box(parent, 0.16, 1.05, 4.2, M.wall, 3.7, 1.05, -0.55);
box(parent, 0.16, 1.05, 3.25, M.wall, 3.7, 1.05, -3.9);
box(parent, 4.15, 1.05, 0.16, M.wall, 7.7, 1.05, -2.25);
box(parent, 0.16, 1.05, 3.4, M.wall, -5.45, 1.05, -0.25);
// People establish the scale and emphasize gathering.
addPerson(parent, -7.4, -4.1, M.personB);
addPerson(parent, -5.9, -4.2, M.personD);
addPerson(parent, -4.4, 0.1, M.personA);
addPerson(parent, -1.5, 0.6, M.personC);
addPerson(parent, -3.2, 1.1, M.personB);
addPerson(parent, 0.5, -1.2, M.personA);
addPerson(parent, 5.5, 0.1, M.personD);
addPerson(parent, 8.6, 2.1, M.personC);
addPerson(parent, 6.0, -4.9, M.personB);
addPerson(parent, 8.8, -4.3, M.personA);
addPerson(parent, -7.8, 2.4, M.personC);
addPerson(parent, -6.6, 3.8, M.personD);
}
function addFloorGrid(parent) {
const positions = [];
for (let x = -12; x <= 12; x += 1) {
positions.push(x, 0.513, -7, x, 0.513, 7);
}
for (let z = -7; z <= 7; z += 1) {
positions.push(-12, 0.513, z, 12, 0.513, z);
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(positions, 3)
);
const lines = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
color: 0x8d8a80,
transparent: true,
opacity: 0.17
})
);
parent.add(lines);
}
// -------------------------------------------------------------------------
// Envelopes: all use the same footprint and program
// -------------------------------------------------------------------------
function addEnvelope(parent, type) {
const front = new THREE.Group();
parent.add(front);
if (type === 0) {
// A: controlled clerestory envelope.
box(parent, 24, 3.2, 0.25, M.wall, 0, 2.1, -7);
box(parent, 24, 1.2, 0.14, M.glass, 0, 4.3, -7);
box(parent, 24, 0.42, 0.32, M.structure, 0, 5.12, -7);
box(parent, 0.25, 2.8, 14, M.wall, -12, 1.9, 0);
box(parent, 0.14, 0.95, 13.9, M.glass, -12, 3.8, 0);
box(parent, 0.3, 0.38, 14, M.structure, -12, 4.68, 0);
box(parent, 0.25, 2.8, 14, M.wall, 12, 1.9, 0);
box(parent, 0.14, 0.95, 13.9, M.glass, 12, 3.8, 0);
box(parent, 0.3, 0.38, 14, M.structure, 12, 4.68, 0);
box(front, 10.45, 2.35, 0.28, M.wall, -6.78, 1.68, 7);
box(front, 10.45, 2.35, 0.28, M.wall, 6.78, 1.68, 7);
box(front, 3.3, 0.5, 0.35, M.structure, 0, 5.1, 7);
box(front, 0.28, 4.55, 0.35, M.structure, -1.65, 2.78, 7);
box(front, 0.28, 4.55, 0.35, M.structure, 1.65, 2.78, 7);
}
if (type === 1) {
// B: compact wall with small high-level slots.
box(parent, 24, 4.4, 0.42, M.wall, 0, 2.7, -7);
box(parent, 24, 0.5, 0.5, M.structure, 0, 5.15, -7);
[-7.2, -2.4, 2.4, 7.2].forEach((x) => {
box(parent, 2.1, 0.42, 0.13, M.glass, x, 4.75, -6.76);
box(parent, 2.3, 0.12, 0.2, M.structure, x, 5.01, -6.72);
});
box(parent, 0.42, 4.4, 14, M.wall, -12, 2.7, 0);
box(parent, 0.42, 4.4, 14, M.wall, 12, 2.7, 0);
box(front, 9.3, 4.25, 0.48, M.wall, -7.35, 2.63, 7);
box(front, 9.3, 4.25, 0.48, M.wall, 7.35, 2.63, 7);
box(front, 5.1, 0.5, 0.5, M.structure, 0, 5.1, 7);
box(front, 0.42, 4.5, 0.55, M.structure, -2.55, 2.75, 7);
box(front, 0.42, 4.5, 0.55, M.structure, 2.55, 2.75, 7);
}
if (type === 2) {
// C: open perimeter beneath a lifted roof.
box(parent, 24, 1.0, 0.28, M.wall, 0, 1.0, -7);
for (let x = -10.5; x <= 10.5; x += 3) {
box(parent, 0.34, 4.45, 0.42, M.structure, x, 2.73, -7);
}
box(parent, 24, 0.42, 0.48, M.structure, 0, 5.05, -7);
[-12, 12].forEach((x) => {
box(parent, 0.26, 0.9, 14, M.wall, x, 0.95, 0);
[-5, 0, 5].forEach((z) => {
box(parent, 0.38, 4.45, 0.42, M.structure, x, 2.73, z);
});
});
box(front, 6.3, 0.72, 0.32, M.wall, -8.85, 0.86, 7);
box(front, 6.3, 0.72, 0.32, M.wall, 8.85, 0.86, 7);
box(front, 0.4, 4.6, 0.5, M.structure, -5.65, 2.8, 7);
box(front, 0.4, 4.6, 0.5, M.structure, 5.65, 2.8, 7);
}
// Common entrance steps.
box(parent, 5.2, 0.2, 1.1, M.floor, 0, 0.39, 7.55);
box(parent, 5.2, 0.16, 0.8, M.floor, 0, 0.22, 8.05);
return front;
}
// -------------------------------------------------------------------------
// Climate-specific roof and shading expressions
// -------------------------------------------------------------------------
function addRoof(parent, type) {
const roof = new THREE.Group();
parent.add(roof);
const roofColors = [0x8f897a, 0x9b806a, 0x75867e];
const roofMaterial = material(roofColors[type], {
transparent: true,
opacity: 0.25,
depthWrite: false
});
if (type === 0) {
// Four stepped sawtooth bays.
for (let bay = 0; bay < 4; bay++) {
const baseX = -12 + bay * 6;
for (let step = 0; step < 6; step++) {
const top = 5.82 + step * 0.285;
box(
roof,
1.04,
0.3,
14.8,
roofMaterial,
baseX + 0.52 + step,
top - 0.15,
0
);
}
if (bay < 3) {
box(
roof,
0.16,
1.45,
13.95,
M.glass,
baseX + 5.96,
6.78,
0
);
box(
roof,
0.22,
0.18,
14.25,
M.structure,
baseX + 5.96,
7.48,
0
);
}
}
// Vertical front fins remain visible in cutaway.
for (let x = -10.5; x <= 10.5; x += 1.5) {
box(parent, 0.12, 2.25, 1.55, M.shade, x, 3.45, 7.55);
}
}
if (type === 1) {
// A thick ring-shaped canopy around a central court-light aperture.
box(roof, 8.5, 0.66, 15.8, roofMaterial, -7.75, 6.18, 0, true);
box(roof, 8.5, 0.66, 15.8, roofMaterial, 7.75, 6.18, 0, true);
box(roof, 7, 0.66, 5.3, roofMaterial, 0, 6.18, -5.25, true);
box(roof, 7, 0.66, 5.3, roofMaterial, 0, 6.18, 5.25, true);
// Raised plenum around the opening.
box(roof, 0.65, 0.65, 5.4, roofMaterial, -3.55, 6.77, 0);
box(roof, 0.65, 0.65, 5.4, roofMaterial, 3.55, 6.77, 0);
box(roof, 7.7, 0.65, 0.65, roofMaterial, 0, 6.77, -2.55);
box(roof, 7.7, 0.65, 0.65, roofMaterial, 0, 6.77, 2.55);
// Deep entrance canopy and porous screen.
box(parent, 25.2, 0.32, 3.5, roofMaterial, 0, 5.52, 8.05, true);
for (let x = -11.5; x <= 11.5; x += 1.15) {
box(parent, 0.16, 2.8, 0.34, M.shade, x, 2.82, 7.55);
}
}
if (type === 2) {
// Stepped butterfly canopy: low at the center, high at both edges.
for (let i = 0; i < 16; i++) {
const x = -11.25 + i * 1.5;
const top = 5.72 + (Math.abs(x) / 12) * 1.72;
box(
roof,
1.54,
0.32,
16.8,
roofMaterial,
x,
top - 0.16,
0
);
}
// High side ventilation pockets.
[-11.72, 11.72].forEach((x) => {
[-5, 0, 5].forEach((z) => {
box(parent, 0.18, 1.2, 3.25, M.glass, x, 6.2, z);
});
});
// Layered eaves and front rain shade.
[-12.7, 12.7].forEach((x) => {
for (let z = -7; z <= 7; z += 1.75) {
box(parent, 1.35, 0.18, 1.15, M.shade, x, 5.25, z);
}
});
box(parent, 25.2, 0.25, 3.1, roofMaterial, 0, 5.3, 8.05, true);
}
return { roof, roofMaterial };
}
// -------------------------------------------------------------------------
// Diagram overlays: indicative airflow and sunlight
// -------------------------------------------------------------------------
const airParticles = [];
function addAirflow(parent, type) {
const group = new THREE.Group();
group.visible = false;
parent.add(group);
const lineMaterial = new THREE.LineDashedMaterial({
color: type === 1 ? 0xe18855 : 0x43a6a0,
transparent: true,
opacity: 0.75,
dashSize: 0.5,
gapSize: 0.28,
depthTest: false
});
const particleMaterial = material(type === 1 ? 0xe18855 : 0x43a6a0, {
emissive: type === 1 ? 0x5a1f08 : 0x073d3a,
emissiveIntensity: 0.28,
depthTest: false
});
let paths;
if (type === 0) {
paths = [
[
[-9, 1.25, 8.7],
[-8, 2.0, 4.5],
[-4, 4.3, 0.5],
[-1.5, 6.5, -5.8]
],
[
[8.8, 1.25, 8.7],
[7, 2.3, 4],
[3, 4.6, 0],
[1.2, 6.7, -5.8]
]
];
} else if (type === 1) {
paths = [
[
[-7.8, 1.2, 8.6],
[-6.5, 2.1, 3.5],
[-4.2, 3.7, -1.5],
[-2.8, 5.0, -6.65]
]
];
} else {
paths = [
[
[-10.5, 1.2, 8.8],
[-7, 2.1, 4.2],
[-3, 4.4, 0.4],
[8.5, 7.0, -6.5]
],
[
[10.2, 1.2, 8.8],
[7, 2.0, 4.2],
[3, 4.2, 0.4],
[-8.8, 7.0, -6.5]
]
];
}
paths.forEach((points, pathIndex) => {
const curve = new THREE.CatmullRomCurve3(
points.map((p) => new THREE.Vector3(...p))
);
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(curve.getPoints(70)),
lineMaterial
);
line.computeLineDistances();
line.renderOrder = 12;
group.add(line);
const count = type === 1 ? 7 : 10;
for (let i = 0; i < count; i++) {
const particle = box(
group,
0.22,
0.22,
0.22,
particleMaterial,
0,
0,
0
);
particle.castShadow = false;
particle.renderOrder = 13;
airParticles.push({
mesh: particle,
curve,
offset: i / count + pathIndex * 0.13,
speed: type === 1 ? 0.065 : type === 0 ? 0.095 : 0.12
});
}
});
return group;
}
function addSunStudy(parent, type) {
const group = new THREE.Group();
group.visible = false;
parent.add(group);
const rayMaterial = new THREE.LineBasicMaterial({
color: 0xe9b93e,
transparent: true,
opacity: 0.86,
depthTest: false
});
function ray(a, b) {
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(...a),
new THREE.Vector3(...b)
]),
rayMaterial
);
line.renderOrder = 15;
group.add(line);
}
if (type === 0) {
[-6, 0, 6].forEach((x) => {
ray([x, 7.4, -1.5], [x + 3.6, 0.55, 1.5]);
ray([x, 7.4, 4], [x + 3.6, 0.55, 6]);
});
}
if (type === 1) {
[-7.2, -2.4, 2.4, 7.2].forEach((x) => {
ray([x, 4.9, -6.65], [x + 1.2, 0.55, -3.4]);
});
}
if (type === 2) {
[-10, 10].forEach((x) => {
ray([x, 6.4, -4.5], [x * 0.72, 0.55, -1.8]);
ray([x, 6.4, 3.2], [x * 0.72, 0.55, 5.2]);
});
}
return group;
}
// -------------------------------------------------------------------------
// Build the three halls
// -------------------------------------------------------------------------
const halls = [];
const hallCenters = [-34, 0, 34];
const hallData = [
{
title: "A / VARIABLE-SEASON",
subtitle: "DIFFUSE LIGHT / CONTROLLED APERTURES",
accent: "#d9ad3f"
},
{
title: "B / HIGH-SOLAR",
subtitle: "MASS / PROTECTED THRESHOLD",
accent: "#d7684d"
},
{
title: "C / WARM-HUMID",
subtitle: "LIFTED CANOPY / CROSS-FLOW",
accent: "#3f7f74"
}
];
hallCenters.forEach((x, index) => {
const hall = new THREE.Group();
hall.position.x = x;
scene.add(hall);
box(hall, 27.4, 0.6, 18.2, M.plinth, 0, 0, 0, true);
box(hall, 24, 0.2, 14, M.floor, 0, 0.4, 0, true);
addFloorGrid(hall);
addProgram(hall);
const front = addEnvelope(hall, index);
const { roof, roofMaterial } = addRoof(hall, index);
const air = addAirflow(hall, index);
const sunlight = addSunStudy(hall, index);
const label = makeLabel(
hallData[index].title,
hallData[index].subtitle,
hallData[index].accent
);
label.position.set(0, 9.85, 0);
hall.add(label);
// Small terrace strips unify the common site.
box(hall, 24.8, 0.08, 1.35, M.floor, 0, 0.35, 8.15);
halls.push({
group: hall,
front,
roof,
roofMaterial,
air,
sunlight,
center: x
});
});
// -------------------------------------------------------------------------
// State and controls
// -------------------------------------------------------------------------
const state = {
cutaway: true,
airflow: false,
sunlight: false
};
function updateCutaway() {
halls.forEach((hall) => {
hall.front.visible = !state.cutaway;
hall.roofMaterial.opacity = state.cutaway ? 0.23 : 1;
hall.roofMaterial.depthWrite = !state.cutaway;
});
document
.getElementById("cutaway")
.setAttribute("aria-pressed", String(state.cutaway));
}
function updateAirflow() {
halls.forEach((hall) => {
hall.air.visible = state.airflow;
});
document
.getElementById("airflow")
.setAttribute("aria-pressed", String(state.airflow));
}
function updateSunlight() {
halls.forEach((hall) => {
hall.sunlight.visible = state.sunlight;
});
document
.getElementById("sun")
.setAttribute("aria-pressed", String(state.sunlight));
}
updateCutaway();
updateAirflow();
updateSunlight();
document.getElementById("cutaway").addEventListener("click", () => {
state.cutaway = !state.cutaway;
updateCutaway();
});
document.getElementById("airflow").addEventListener("click", () => {
state.airflow = !state.airflow;
updateAirflow();
});
document.getElementById("sun").addEventListener("click", () => {
state.sunlight = !state.sunlight;
updateSunlight();
});
const timeInput = document.getElementById("time");
const timeValue = document.getElementById("time-value");
function updateSunPosition() {
const hour = Number(timeInput.value);
const angle = ((hour - 13) / 5) * 1.05;
const height = 53 + Math.cos(angle) * 12;
sunLight.position.set(
Math.sin(angle) * 56,
height,
Math.cos(angle) * 56
);
const minutes = Math.round((hour % 1) * 60);
timeValue.value = `${String(Math.floor(hour)).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
}
timeInput.addEventListener("input", updateSunPosition);
updateSunPosition();
// -------------------------------------------------------------------------
// Custom orbit, zoom, focus, and plan controls — no addons
// -------------------------------------------------------------------------
function fittedRadius() {
const aspect = viewport.clientWidth / Math.max(1, viewport.clientHeight);
return 121 * Math.max(1, 1.16 / aspect);
}
function resetCamera() {
cameraGoal.theta = 0.18;
cameraGoal.phi = 0.83;
cameraGoal.radius = fittedRadius();
cameraGoal.target.set(0, 2.5, 0);
document.querySelectorAll(".climate-card").forEach((card) => {
card.classList.remove("active");
});
}
function planCamera() {
cameraGoal.theta = 0;
cameraGoal.phi = 0.035;
cameraGoal.radius = fittedRadius() * 0.98;
cameraGoal.target.set(0, 2.5, 0);
document.querySelectorAll(".climate-card").forEach((card) => {
card.classList.remove("active");
});
}
function focusHall(index) {
cameraGoal.target.set(hallCenters[index], 2.5, 0);
cameraGoal.theta = 0.12;
cameraGoal.phi = 0.82;
cameraGoal.radius = 77;
document.querySelectorAll(".climate-card").forEach((card, cardIndex) => {
card.classList.toggle("active", cardIndex === index);
});
}
document.getElementById("reset").addEventListener("click", resetCamera);
document.getElementById("top").addEventListener("click", planCamera);
document.querySelectorAll(".climate-card").forEach((card) => {
card.addEventListener("click", () => {
focusHall(Number(card.dataset.hall));
});
});
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0 && event.button !== 2) return;
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;
cameraGoal.theta -= dx * 0.005;
cameraGoal.phi = THREE.MathUtils.clamp(
cameraGoal.phi + dy * 0.0045,
0.035,
1.45
);
});
function endDrag(event) {
dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraGoal.radius = THREE.MathUtils.clamp(
cameraGoal.radius * Math.exp(event.deltaY * 0.001),
43,
190
);
},
{ passive: false }
);
// Pinch-to-zoom support.
const activePointers = new Map();
let pinchDistance = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2) {
const points = [...activePointers.values()];
pinchDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!activePointers.has(event.pointerId)) return;
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2) {
const points = [...activePointers.values()];
const distance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
if (pinchDistance > 0) {
cameraGoal.radius = THREE.MathUtils.clamp(
cameraGoal.radius * (pinchDistance / Math.max(1, distance)),
43,
190
);
}
pinchDistance = distance;
}
});
function removePointer(event) {
activePointers.delete(event.pointerId);
if (activePointers.size < 2) pinchDistance = 0;
}
renderer.domElement.addEventListener("pointerup", removePointer);
renderer.domElement.addEventListener("pointercancel", removePointer);
// -------------------------------------------------------------------------
// Resize and render loop
// -------------------------------------------------------------------------
function resize() {
const width = viewport.clientWidth;
const height = viewport.clientHeight;
renderer.setSize(width, height, false);
camera.aspect = width / Math.max(1, height);
camera.updateProjectionMatrix();
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(viewport);
resize();
cameraGoal.radius = fittedRadius();
cameraState.radius = cameraGoal.radius;
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
const easing = 0.085;
cameraState.theta +=
(cameraGoal.theta - cameraState.theta) * easing;
cameraState.phi +=
(cameraGoal.phi - cameraState.phi) * easing;
cameraState.radius +=
(cameraGoal.radius - cameraState.radius) * easing;
cameraState.target.lerp(cameraGoal.target, easing);
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x +
cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z +
cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
if (state.airflow) {
airParticles.forEach((particle) => {
const t = (elapsed * particle.speed + particle.offset) % 1;
particle.mesh.position.copy(particle.curve.getPointAt(t));
particle.mesh.rotation.y = elapsed * 1.8;
particle.mesh.rotation.x = elapsed * 1.1;
});
}
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```