Prompt specification
Build or customize the Three.js 3D scene "Ventilated storehouse opening and grain container" 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: Ventilated storehouse opening and grain container
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/ventilated-storehouse-opening-and-grain-container-x2565
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: Ventilated storehouse opening and grain container. Model a referenced Andean storehouse detail with raised storage surface and ventilation opening. Distinguish the architectural feature from modern assumptions about precise preservation performance. Return one self-contained HTML file.
Working Three.js Starter (ventilated-storehouse-opening-and-grain-container-x2565):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Above the Ground — Interpretive Andean Storehouse</title>
<style>
:root {
--ink: #302820;
--paper: rgba(247, 239, 219, 0.93);
--paper-solid: #f5ecd8;
--ochre: #b76636;
--ochre-dark: #75412c;
--blue: #197b9b;
--line: rgba(65, 48, 35, 0.22);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8c6a4;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#app, #scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active { cursor: grabbing; }
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 50% 42%, transparent 46%, rgba(70, 43, 25, 0.13) 100%),
linear-gradient(180deg, rgba(255, 250, 232, 0.08), transparent 40%);
}
header {
position: fixed;
top: 28px;
left: 30px;
width: min(460px, calc(100vw - 60px));
pointer-events: none;
z-index: 5;
}
.eyebrow {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border: 1px solid rgba(69, 47, 34, 0.25);
border-radius: 999px;
background: rgba(247, 239, 219, 0.74);
backdrop-filter: blur(8px);
color: #6d4935;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--ochre);
box-shadow: 0 0 0 3px rgba(183, 102, 54, 0.15);
}
h1 {
margin: 11px 0 4px;
max-width: 440px;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(34px, 5vw, 62px);
font-weight: 500;
line-height: 0.94;
letter-spacing: -0.035em;
color: #35261e;
text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
header p {
margin: 11px 0 0;
max-width: 400px;
color: rgba(53, 38, 30, 0.76);
font-size: 13px;
line-height: 1.5;
}
.controls {
position: fixed;
top: 28px;
right: 28px;
z-index: 8;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
max-width: 390px;
}
button {
appearance: none;
border: 1px solid rgba(68, 45, 31, 0.24);
border-radius: 999px;
padding: 10px 14px;
background: rgba(249, 242, 225, 0.88);
color: #473126;
font: 700 11px/1 Inter, ui-sans-serif, system-ui, sans-serif;
letter-spacing: 0.035em;
box-shadow: 0 5px 18px rgba(74, 45, 24, 0.08);
backdrop-filter: blur(10px);
cursor: pointer;
transition: transform .15s ease, background .15s ease, color .15s ease;
}
button:hover {
transform: translateY(-1px);
background: #fff8e9;
}
button:focus-visible {
outline: 3px solid rgba(25, 123, 155, 0.3);
outline-offset: 2px;
}
button.active {
border-color: rgba(25, 123, 155, 0.45);
background: #d8eef2;
color: #145c72;
}
.reading {
position: fixed;
left: 28px;
bottom: 28px;
z-index: 7;
width: min(375px, calc(100vw - 56px));
padding: 18px 19px 17px;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--paper);
box-shadow: 0 14px 44px rgba(67, 42, 24, 0.14);
backdrop-filter: blur(14px);
}
.reading h2 {
margin: 0 0 10px;
font-family: Georgia, "Times New Roman", serif;
font-size: 20px;
font-weight: 600;
letter-spacing: -0.01em;
}
.reading p {
margin: 0;
font-size: 12px;
line-height: 1.55;
color: rgba(48, 40, 32, 0.82);
}
.reading strong {
color: #3d2a20;
}
.divider {
height: 1px;
margin: 13px 0 11px;
background: var(--line);
}
.key {
display: flex;
flex-wrap: wrap;
gap: 8px 15px;
margin-top: 12px;
font-size: 10px;
font-weight: 700;
letter-spacing: .035em;
color: #604b3e;
}
.key span {
display: inline-flex;
align-items: center;
gap: 6px;
}
.swatch {
width: 18px;
height: 8px;
border-radius: 99px;
background: #b76636;
}
.swatch.blue {
background: #38a5c0;
opacity: .8;
}
#hypothesis-note {
display: none;
margin-top: 12px;
padding: 10px 11px;
border-left: 3px solid var(--blue);
border-radius: 0 8px 8px 0;
background: rgba(25, 123, 155, 0.09);
color: #24576a;
font-size: 11px;
line-height: 1.45;
}
body.show-hypothesis #hypothesis-note {
display: block;
}
.legend {
position: fixed;
right: 28px;
bottom: 28px;
z-index: 6;
max-width: 235px;
padding: 12px 14px;
border: 1px solid rgba(68, 45, 31, 0.17);
border-radius: 12px;
background: rgba(247, 239, 219, 0.78);
backdrop-filter: blur(10px);
color: rgba(55, 42, 34, 0.7);
font-size: 10px;
line-height: 1.45;
pointer-events: none;
}
.legend b {
display: block;
margin-bottom: 4px;
color: #49352a;
font-size: 10px;
letter-spacing: .08em;
text-transform: uppercase;
}
#leaders {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
z-index: 3;
pointer-events: none;
overflow: visible;
}
.annotation {
position: fixed;
z-index: 4;
width: 174px;
padding: 9px 11px 10px;
border: 1px solid rgba(69, 48, 34, 0.22);
border-radius: 10px;
background: rgba(249, 242, 226, 0.91);
box-shadow: 0 8px 25px rgba(70, 42, 23, 0.12);
backdrop-filter: blur(8px);
pointer-events: none;
transform: translate(-50%, -50%);
transition: opacity .2s ease;
}
.annotation .num {
display: block;
margin-bottom: 3px;
color: var(--ochre-dark);
font-size: 9px;
font-weight: 900;
letter-spacing: .12em;
text-transform: uppercase;
}
.annotation .label {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 14px;
line-height: 1.1;
color: #392820;
}
.annotation .sub {
display: block;
margin-top: 4px;
color: rgba(57, 40, 32, 0.64);
font-size: 9px;
line-height: 1.35;
}
.annotation.hypothesis {
border-color: rgba(25, 123, 155, 0.42);
background: rgba(222, 241, 245, 0.93);
}
.annotation.hypothesis .num,
.annotation.hypothesis .label {
color: #155f76;
}
body.hide-labels .annotation,
body.hide-labels #leaders {
opacity: 0;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #e4d4b6;
color: #5f402d;
font: 700 11px/1 Inter, sans-serif;
letter-spacing: .14em;
text-transform: uppercase;
transition: opacity .5s ease, visibility .5s ease;
}
#loading.done {
opacity: 0;
visibility: hidden;
}
@media (max-width: 820px) {
header {
top: 18px;
left: 18px;
}
h1 { font-size: 38px; }
header p { max-width: 310px; font-size: 11px; }
.controls {
top: 18px;
right: 18px;
max-width: 230px;
}
button {
padding: 9px 11px;
font-size: 9px;
}
.reading {
left: 14px;
bottom: 14px;
width: calc(100vw - 28px);
padding: 14px 15px;
}
.reading .long-copy { display: none; }
.legend { display: none; }
.annotation {
width: 138px;
padding: 7px 9px;
}
.annotation .label { font-size: 12px; }
.annotation .sub { display: none; }
}
@media (max-height: 650px) {
header p, .reading .long-copy, .legend { display: none; }
.reading { padding: 12px 14px; }
.reading h2 { font-size: 17px; }
}
</style>
</head>
<body>
<div id="app">
<div id="scene" aria-label="Interactive three-dimensional interpretation of an Andean storehouse"></div>
<div class="vignette"></div>
<header>
<div class="eyebrow">Interpretive architectural study</div>
<h1>Above the Ground</h1>
<p>
A stylized study of an Andean storehouse detail: a raised storage deck,
a slatted ventilation opening, and a woven grain container.
</p>
</header>
<nav class="controls" aria-label="Scene controls">
<button id="toggle-labels" class="active" aria-pressed="true">Labels on</button>
<button id="toggle-air" aria-pressed="false">Show air-path hypothesis</button>
<button id="reset-view" title="Reset view (R)">Reset view</button>
</nav>
<svg id="leaders" aria-hidden="true"></svg>
<aside class="reading" aria-label="Model interpretation">
<h2>Reading the model</h2>
<p>
<strong>Solid ochre elements</strong> describe the proposed architectural
arrangement: storage lifted above the ground, a deliberate high vent,
and a container separated from the floor.
</p>
<div class="divider"></div>
<p class="long-copy">
This is an interpretive reconstruction, not a surveyed replica. The
blue overlay is a modern explanatory hypothesis—not evidence of a
measured airflow, preserved climate, humidity control, or guaranteed
grain-protection performance.
</p>
<div id="hypothesis-note">
<strong>Hypothesis layer enabled.</strong> The animated blue paths merely
illustrate one possible exchange of air. They are not a simulation and do
not establish the original vent geometry or actual preservation results.
</div>
<div class="key" aria-hidden="true">
<span><i class="swatch"></i> architectural interpretation</span>
<span><i class="swatch blue"></i> modern hypothesis</span>
</div>
</aside>
<div class="legend">
<b>Navigation</b>
Drag to orbit · Scroll or pinch to zoom · Arrow keys to rotate · R to reset.
The cutaway presentation is diagrammatic.
</div>
<div id="loading">Building the study…</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 loading = document.getElementById("loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8c6a4);
scene.fog = new THREE.Fog(0xd8c6a4, 15, 31);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
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 hemi = new THREE.HemisphereLight(0xfff1cf, 0x705039, 2.05);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe6b4, 3.25);
sun.position.set(-7, 11, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -10;
sun.shadow.camera.right = 10;
sun.shadow.camera.top = 11;
sun.shadow.camera.bottom = -8;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 30;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xaac8d1, 0.72);
fill.position.set(7, 5, -8);
scene.add(fill);
const architecture = new THREE.Group();
const hypothesis = new THREE.Group();
hypothesis.visible = false;
scene.add(architecture, hypothesis);
// Seeded texture generator keeps the scene deterministic.
let seed = 1847;
function rnd() {
seed = (seed * 1664525 + 1013904223) >>> 0;
return seed / 4294967296;
}
function makeTexture(type) {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 256;
const ctx = canvas.getContext("2d");
if (type === "adobe") {
ctx.fillStyle = "#b8794f";
ctx.fillRect(0, 0, 256, 256);
for (let i = 0; i < 2600; i++) {
const c = rnd();
ctx.fillStyle = c > .5
? `rgba(255,225,175,${rnd() * .12})`
: `rgba(77,42,26,${rnd() * .10})`;
const s = 1 + rnd() * 4;
ctx.fillRect(rnd() * 256, rnd() * 256, s, s);
}
ctx.strokeStyle = "rgba(82,45,28,.08)";
ctx.lineWidth = 2;
for (let y = 18; y < 256; y += 43) {
ctx.beginPath();
ctx.moveTo(0, y + rnd() * 7);
ctx.lineTo(256, y + rnd() * 7);
ctx.stroke();
}
}
if (type === "wood") {
ctx.fillStyle = "#885337";
ctx.fillRect(0, 0, 256, 256);
for (let i = 0; i < 90; i++) {
const y = rnd() * 256;
ctx.strokeStyle = rnd() > .5
? "rgba(55,30,19,.22)"
: "rgba(226,166,100,.16)";
ctx.lineWidth = 1 + rnd() * 3;
ctx.beginPath();
ctx.moveTo(0, y);
ctx.bezierCurveTo(75, y + rnd() * 8, 170, y - rnd() * 8, 256, y);
ctx.stroke();
}
}
if (type === "weave") {
ctx.fillStyle = "#c49353";
ctx.fillRect(0, 0, 256, 256);
const cell = 16;
for (let y = 0; y < 256; y += cell) {
for (let x = 0; x < 256; x += cell) {
const horizontal = ((x / cell + y / cell) % 2) === 0;
ctx.fillStyle = horizontal ? "#d2a662" : "#a97842";
if (horizontal) ctx.fillRect(x, y, cell, cell * .74);
else ctx.fillRect(x, y, cell * .64, cell);
ctx.strokeStyle = "rgba(75,43,24,.17)";
ctx.strokeRect(x, y, cell, cell);
}
}
}
if (type === "ground") {
ctx.fillStyle = "#aa8d61";
ctx.fillRect(0, 0, 256, 256);
for (let i = 0; i < 2100; i++) {
const c = rnd();
ctx.fillStyle = c > .54
? "rgba(232,205,151,.20)"
: "rgba(76,55,35,.13)";
const r = .5 + rnd() * 2.8;
ctx.beginPath();
ctx.arc(rnd() * 256, rnd() * 256, r, 0, Math.PI * 2);
ctx.fill();
}
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
const adobeTexture = makeTexture("adobe");
const woodTexture = makeTexture("wood");
const weaveTexture = makeTexture("weave");
const groundTexture = makeTexture("ground");
groundTexture.repeat.set(7, 7);
woodTexture.repeat.set(2, 1);
weaveTexture.repeat.set(3, 1);
const mat = {
adobe: new THREE.MeshStandardMaterial({
color: 0xd19a67, map: adobeTexture, roughness: .93, metalness: 0
}),
adobeDark: new THREE.MeshStandardMaterial({
color: 0xb97c4f, map: adobeTexture, roughness: .96, metalness: 0
}),
wood: new THREE.MeshStandardMaterial({
color: 0xb17a4a, map: woodTexture, roughness: .84
}),
woodDark: new THREE.MeshStandardMaterial({
color: 0x64402c, map: woodTexture, roughness: .91
}),
weave: new THREE.MeshStandardMaterial({
color: 0xe0b46f, map: weaveTexture, roughness: .96, side: THREE.DoubleSide
}),
stone: new THREE.MeshStandardMaterial({ color: 0x8c7459, roughness: 1 }),
stoneLight: new THREE.MeshStandardMaterial({ color: 0xa68d6b, roughness: 1 }),
stoneDark: new THREE.MeshStandardMaterial({ color: 0x6e5d49, roughness: 1 }),
grain: new THREE.MeshStandardMaterial({ color: 0xdca842, roughness: .86 }),
grainDark: new THREE.MeshStandardMaterial({ color: 0xa86b24, roughness: .9 }),
roof: new THREE.MeshStandardMaterial({ color: 0x6d7350, roughness: 1 }),
roofEdge: new THREE.MeshStandardMaterial({ color: 0x4f5139, roughness: 1 })
};
function box(parent, size, position, material, cast = true, receive = true) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(...size), material);
mesh.position.set(...position);
mesh.castShadow = cast;
mesh.receiveShadow = receive;
parent.add(mesh);
return mesh;
}
function cylinder(parent, rt, rb, height, position, material, segments = 24) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(rt, rb, height, segments),
material
);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function edgeOutline(mesh, color = 0x5f3c2b, opacity = .22) {
const edges = new THREE.EdgesGeometry(mesh.geometry, 24);
const line = new THREE.LineSegments(
edges,
new THREE.LineBasicMaterial({ color, transparent: true, opacity })
);
line.position.copy(mesh.position);
line.rotation.copy(mesh.rotation);
line.scale.copy(mesh.scale);
mesh.parent.add(line);
return line;
}
// Landscape stage.
const groundMat = new THREE.MeshStandardMaterial({
color: 0xb59668, map: groundTexture, roughness: 1
});
const ground = new THREE.Mesh(new THREE.CylinderGeometry(13, 13.5, .42, 64), groundMat);
ground.position.y = -.25;
ground.receiveShadow = true;
scene.add(ground);
const pathMat = new THREE.MeshStandardMaterial({ color: 0xc1a678, roughness: 1 });
for (let i = 0; i < 13; i++) {
const t = i / 12;
const stone = new THREE.Mesh(
new THREE.DodecahedronGeometry(.36 + rnd() * .16, 0),
i % 3 === 0 ? mat.stoneLight : mat.stone
);
stone.scale.set(1.25, .32, .9);
stone.position.set(
-.18 + Math.sin(t * 7) * .18,
-.015,
3.2 + t * 8.6
);
stone.rotation.y = rnd() * Math.PI;
stone.castShadow = true;
stone.receiveShadow = true;
scene.add(stone);
}
for (let i = 0; i < 30; i++) {
const angle = rnd() * Math.PI * 2;
const radius = 5.5 + rnd() * 6.2;
const rock = new THREE.Mesh(
new THREE.DodecahedronGeometry(.12 + rnd() * .28, 0),
rnd() > .5 ? mat.stoneLight : mat.stoneDark
);
rock.position.set(Math.cos(angle) * radius, -.02, Math.sin(angle) * radius);
rock.scale.y = .55;
rock.rotation.set(rnd(), rnd(), rnd());
rock.castShadow = true;
rock.receiveShadow = true;
scene.add(rock);
}
// Raised stone piers and visible underfloor void.
const pierXs = [-2.45, 0, 2.45];
const pierZs = [-1.72, 1.72];
for (const x of pierXs) {
for (const z of pierZs) {
box(architecture, [.72, .96, .76], [x, .48, z], mat.stoneDark);
box(architecture, [.88, .22, .88], [x, 1.07, z], mat.stoneLight);
const seam = box(architecture, [.76, .035, .79], [x, .67, z], mat.stone);
seam.material = mat.stone;
}
}
box(architecture, [6.35, .19, 4.65], [0, 1.25, 0], mat.woodDark);
// Separate deck boards reveal the raised storage surface.
for (let i = 0; i < 11; i++) {
const z = -2.08 + i * .416;
const plank = box(
architecture,
[6.25, .13, .39],
[0, 1.39, z],
i % 3 === 0 ? mat.woodDark : mat.wood
);
if (i === 0 || i === 5 || i === 10) edgeOutline(plank, 0x4e3022, .15);
}
box(architecture, [6.45, .22, .25], [0, 1.28, 2.3], mat.woodDark);
box(architecture, [6.45, .22, .25], [0, 1.28, -2.3], mat.woodDark);
box(architecture, [.25, .22, 4.75], [-3.12, 1.28, 0], mat.woodDark);
box(architecture, [.25, .22, 4.75], [3.12, 1.28, 0], mat.woodDark);
// Stairs to the raised deck.
for (let i = 0; i < 6; i++) {
const h = 1.08 - i * .17;
const z = 2.63 + i * .36;
box(architecture, [1.65, h, .39], [-.78, h / 2, z], i % 2 ? mat.stone : mat.stoneLight);
}
// Main adobe envelope.
const wallBottom = 1.46;
const wallTop = 4.58;
const wallHeight = wallTop - wallBottom;
box(architecture, [6.18, wallHeight, .34], [0, (wallBottom + wallTop) / 2, -2.18], mat.adobe);
box(architecture, [.34, wallHeight, 4.48], [-3.0, (wallBottom + wallTop) / 2, 0], mat.adobeDark);
// Right wall is assembled around a real aperture.
const openingZ0 = -.20;
const openingZ1 = 1.30;
const openingY0 = 3.27;
const openingY1 = 4.03;
box(
architecture,
[.34, openingY0 - wallBottom, 4.48],
[3.0, (wallBottom + openingY0) / 2, 0],
mat.adobeDark
);
box(
architecture,
[.34, wallTop - openingY1, 4.48],
[3.0, (wallTop + openingY1) / 2, 0],
mat.adobeDark
);
box(
architecture,
[.34, openingY1 - openingY0, openingZ0 + 2.28],
[3.0, (openingY0 + openingY1) / 2, (-2.28 + openingZ0) / 2],
mat.adobeDark
);
box(
architecture,
[.34, openingY1 - openingY0, 2.28 - openingZ1],
[3.0, (openingY0 + openingY1) / 2, (openingZ1 + 2.28) / 2],
mat.adobeDark
);
// Front is intentionally sectioned as a broad access opening.
box(architecture, [1.28, wallHeight, .34], [-2.49, (wallBottom + wallTop) / 2, 2.18], mat.adobe);
box(architecture, [1.08, wallHeight, .34], [2.56, (wallBottom + wallTop) / 2, 2.18], mat.adobe);
box(architecture, [6.18, .98, .34], [0, 4.09, 2.18], mat.adobe);
// Heavy timber posts frame the open bay.
box(architecture, [.24, 2.36, .30], [-1.77, 2.64, 2.22], mat.woodDark);
box(architecture, [.24, 2.36, .30], [1.91, 2.64, 2.22], mat.woodDark);
box(architecture, [3.95, .26, .34], [.07, 3.62, 2.22], mat.woodDark);
// Slatted ventilation opening and a small projecting hood.
box(architecture, [.24, .12, 1.73], [3.19, 3.22, .55], mat.woodDark);
box(architecture, [.24, .12, 1.73], [3.19, 4.08, .55], mat.woodDark);
box(architecture, [.24, .91, .10], [3.19, 3.65, openingZ0], mat.woodDark);
box(architecture, [.24, .91, .10], [3.19, 3.65, openingZ1], mat.woodDark);
for (let i = 0; i < 4; i++) {
const slat = box(
architecture,
[.16, .085, 1.39],
[3.21, 3.40 + i * .17, .55],
mat.wood
);
slat.rotation.x = (i - 1.5) * .035;
}
const brace = box(architecture, [.16, .08, 1.57], [3.22, 3.65, .55], mat.woodDark);
brace.rotation.x = .22;
box(architecture, [.60, .12, 1.78], [3.38, 4.20, .55], mat.roofEdge, true, true);
// Pitched roof: diagrammatic, with a clay/grass-colored skin.
const roofAngle = Math.atan2(.96, 3.12);
const roofLength = Math.hypot(.96, 3.12);
const leftRoof = box(
architecture,
[roofLength, .22, 5.18],
[-1.56, 5.08, 0],
mat.roof
);
leftRoof.rotation.z = roofAngle;
const rightRoof = box(
architecture,
[roofLength, .22, 5.18],
[1.56, 5.08, 0],
mat.roof
);
rightRoof.rotation.z = -roofAngle;
box(architecture, [.23, .20, 5.35], [0, 5.63, 0], mat.roofEdge);
box(architecture, [.25, .25, 5.22], [-3.12, 4.61, 0], mat.woodDark);
box(architecture, [.25, .25, 5.22], [3.12, 4.61, 0], mat.woodDark);
function gableFace(z, material) {
const shape = new THREE.Shape();
shape.moveTo(-3.10, 0);
shape.lineTo(3.10, 0);
shape.lineTo(0, 1.02);
shape.closePath();
const mesh = new THREE.Mesh(new THREE.ShapeGeometry(shape), material);
mesh.position.set(0, 4.58, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
architecture.add(mesh);
}
gableFace(-2.19, mat.adobe);
gableFace(2.19, mat.adobe);
// Woven grain container, raised slightly on a low platform.
box(architecture, [1.64, .12, 1.58], [-.52, 1.51, .05], mat.woodDark);
const basket = new THREE.Group();
basket.position.set(-.52, 1.57, .05);
architecture.add(basket);
const basketBody = new THREE.Mesh(
new THREE.CylinderGeometry(.69, .58, 1.15, 36, 1, true),
mat.weave
);
basketBody.position.y = .58;
basketBody.castShadow = true;
basketBody.receiveShadow = true;
basket.add(basketBody);
const basketBottom = new THREE.Mesh(
new THREE.CylinderGeometry(.585, .585, .07, 36),
mat.woodDark
);
basketBottom.position.y = .035;
basketBottom.castShadow = true;
basket.add(basketBottom);
for (const y of [.12, .39, .67, .93, 1.13]) {
const radius = THREE.MathUtils.lerp(.58, .69, y / 1.15) + .012;
const band = new THREE.Mesh(
new THREE.TorusGeometry(radius, .027, 7, 36),
mat.woodDark
);
band.rotation.x = Math.PI / 2;
band.position.y = y;
band.castShadow = true;
basket.add(band);
}
const grainSurface = new THREE.Mesh(
new THREE.CircleGeometry(.635, 36),
mat.grainDark
);
grainSurface.rotation.x = -Math.PI / 2;
grainSurface.position.y = 1.085;
basket.add(grainSurface);
const kernelGeometry = new THREE.SphereGeometry(.035, 6, 4);
const kernelMaterial = new THREE.MeshStandardMaterial({ color: 0xe1b54d, roughness: .9 });
const kernels = new THREE.InstancedMesh(kernelGeometry, kernelMaterial, 105);
const dummy = new THREE.Object3D();
for (let i = 0; i < 105; i++) {
const a = rnd() * Math.PI * 2;
const r = Math.sqrt(rnd()) * .57;
dummy.position.set(Math.cos(a) * r, 1.105 + rnd() * .035, Math.sin(a) * r);
dummy.scale.set(.8 + rnd() * .8, .48, .65 + rnd() * .7);
dummy.rotation.set(rnd() * Math.PI, rnd() * Math.PI, rnd() * Math.PI);
dummy.updateMatrix();
kernels.setMatrixAt(i, dummy.matrix);
}
kernels.castShadow = true;
basket.add(kernels);
// A small wooden scoop leans against the container.
const scoopHandle = box(
architecture,
[.085, .93, .085],
[.17, 2.02, .55],
mat.woodDark
);
scoopHandle.rotation.z = -.30;
const scoop = new THREE.Mesh(
new THREE.CylinderGeometry(.20, .14, .09, 16, 1, false, 0, Math.PI),
mat.wood
);
scoop.position.set(.02, 2.48, .55);
scoop.rotation.set(Math.PI / 2, 0, -.30);
scoop.castShadow = true;
architecture.add(scoop);
// Modern explanatory layer: intentionally blue and visually separate.
const flowMaterial = new THREE.MeshBasicMaterial({
color: 0x2fa4c2,
transparent: true,
opacity: .40,
depthWrite: false
});
const flowCurves = [];
function addFlow(points, particles = 12) {
const curve = new THREE.CatmullRomCurve3(points, false, "catmullrom", .38);
flowCurves.push({ curve, particles, offset: rnd() });
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 80, .025, 8, false),
flowMaterial
);
hypothesis.add(tube);
const end = curve.getPointAt(.97);
const tangent = curve.getTangentAt(.97).normalize();
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(.105, .32, 10),
new THREE.MeshBasicMaterial({
color: 0x1687aa,
transparent: true,
opacity: .72,
depthWrite: false
})
);
arrow.position.copy(end);
arrow.quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), tangent);
hypothesis.add(arrow);
}
addFlow([
new THREE.Vector3(4.35, 3.66, .55),
new THREE.Vector3(3.15, 3.66, .55),
new THREE.Vector3(2.15, 3.42, .48),
new THREE.Vector3(1.25, 3.06, .25),
new THREE.Vector3(.30, 2.78, .08),
new THREE.Vector3(-.55, 2.38, .02)
], 14);
addFlow([
new THREE.Vector3(.45, 1.64, 1.80),
new THREE.Vector3(.65, 1.22, 2.10),
new THREE.Vector3(.85, .74, 2.35),
new THREE.Vector3(.88, .42, 3.02),
new THREE.Vector3(.62, .24, 3.85)
], 10);
const particleGeometry = new THREE.SphereGeometry(.055, 8, 6);
const particleMaterial = new THREE.MeshBasicMaterial({
color: 0xbdebf4,
transparent: true,
opacity: .9,
depthWrite: false
});
for (const flow of flowCurves) {
flow.meshes = [];
for (let i = 0; i < flow.particles; i++) {
const particle = new THREE.Mesh(particleGeometry, particleMaterial);
hypothesis.add(particle);
flow.meshes.push(particle);
}
}
// Direct camera controls: orbit, wheel/pinch zoom, keyboard support.
const target = new THREE.Vector3(0, 2.35, 0);
const spherical = new THREE.Spherical(12.6, 1.30, .73);
const sphericalGoal = spherical.clone();
const velocity = { theta: 0, phi: 0, radius: 0 };
const pointers = new Map();
let pinchDistance = 0;
function updateCamera() {
spherical.theta += velocity.theta;
spherical.phi += velocity.phi;
spherical.radius += velocity.radius;
spherical.theta += (sphericalGoal.theta - spherical.theta) * .085;
spherical.phi += (sphericalGoal.phi - spherical.phi) * .085;
spherical.radius += (sphericalGoal.radius - spherical.radius) * .085;
spherical.phi = THREE.MathUtils.clamp(spherical.phi, .63, 1.48);
spherical.radius = THREE.MathUtils.clamp(spherical.radius, 8.1, 17.5);
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 2) {
const p = [...pointers.values()];
pinchDistance = Math.hypot(p[0].x - p[1].x, p[0].y - p[1].y);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1) {
velocity.theta = -dx * .005;
velocity.phi = -dy * .005;
sphericalGoal.theta += velocity.theta;
sphericalGoal.phi += velocity.phi;
} else if (pointers.size === 2) {
const p = [...pointers.values()];
const distance = Math.hypot(p[0].x - p[1].x, p[0].y - p[1].y);
if (pinchDistance > 0) {
const delta = (pinchDistance - distance) * .012;
sphericalGoal.radius += delta;
velocity.radius = delta;
}
pinchDistance = distance;
}
});
function releasePointer(event) {
pointers.delete(event.pointerId);
if (pointers.size < 2) pinchDistance = 0;
}
renderer.domElement.addEventListener("pointerup", releasePointer);
renderer.domElement.addEventListener("pointercancel", releasePointer);
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
const delta = event.deltaY * .001;
sphericalGoal.radius += delta;
velocity.radius = delta;
}, { passive: false });
window.addEventListener("keydown", (event) => {
const step = .08;
if (event.key === "ArrowLeft") sphericalGoal.theta += step;
if (event.key === "ArrowRight") sphericalGoal.theta -= step;
if (event.key === "ArrowUp") sphericalGoal.phi -= step;
if (event.key === "ArrowDown") sphericalGoal.phi += step;
if (event.key.toLowerCase() === "r") resetView();
if (event.key === "+" || event.key === "=") sphericalGoal.radius -= .7;
if (event.key === "-") sphericalGoal.radius += .7;
});
function resetView() {
sphericalGoal.set(12.6, 1.30, .73);
velocity.theta = velocity.phi = velocity.radius = 0;
}
document.getElementById("reset-view").addEventListener("click", resetView);
// Projected annotation labels and leader lines.
const annotations = [];
const svgNS = "http://www.w3.org/2000/svg";
const leaders = document.getElementById("leaders");
function addAnnotation({
id, number, label, sub, position, dx, dy, hypothesisClass = false, visible = true
}) {
const element = document.createElement("div");
element.className = `annotation${hypothesisClass ? " hypothesis" : ""}`;
element.id = id;
element.innerHTML = `
<span class="num">${number}</span>
<span class="label">${label}</span>
<span class="sub">${sub}</span>
`;
document.body.appendChild(element);
const line = document.createElementNS(svgNS, "line");
line.setAttribute("stroke", hypothesisClass ? "#268aa7" : "#76513a");
line.setAttribute("stroke-width", "1.2");
line.setAttribute("stroke-dasharray", hypothesisClass ? "4 4" : "2 3");
line.setAttribute("opacity", ".72");
leaders.appendChild(line);
const dot = document.createElementNS(svgNS, "circle");
dot.setAttribute("r", hypothesisClass ? "4" : "3.5");
dot.setAttribute("fill", hypothesisClass ? "#268aa7" : "#a05e35");
dot.setAttribute("stroke", "#f8edda");
dot.setAttribute("stroke-width", "1.5");
leaders.appendChild(dot);
annotations.push({
element, line, dot,
position: new THREE.Vector3(...position),
dx, dy, visible, hypothesisClass
});
}
addAnnotation({
id: "ann-raised",
number: "01 · Architectural form",
label: "Raised storage deck",
sub: "A floor lifted above the ground, leaving a ventilated void below.",
position: [-2.25, 1.43, 2.28],
dx: -132, dy: 57
});
addAnnotation({
id: "ann-vent",
number: "02 · Architectural form",
label: "Slatted high opening",
sub: "A proposed vent within the wall, visually distinct from later overlays.",
position: [3.22, 3.65, .56],
dx: 96, dy: -74
});
addAnnotation({
id: "ann-bin",
number: "03 · Interpretive object",
label: "Grain container",
sub: "A woven vessel form lifted above the storage surface.",
position: [-.52, 2.28, .48],
dx: -126, dy: -71
});
addAnnotation({
id: "ann-void",
number: "04 · Spatial consequence",
label: "Open underfloor zone",
sub: "Separates stored material from damp ground; airflow is not assumed.",
position: [1.52, .76, 2.02],
dx: 107, dy: 27
});
addAnnotation({
id: "ann-hypothesis",
number: "Modern hypothesis only",
label: "Possible air path",
sub: "Illustrative—not measured, simulated, or proven.",
position: [3.33, 3.63, .55],
dx: 118, dy: 26,
hypothesisClass: true,
visible: false
});
function updateAnnotations() {
const w = window.innerWidth;
const h = window.innerHeight;
for (const annotation of annotations) {
const p = annotation.position.clone().project(camera);
const x = (p.x * .5 + .5) * w;
const y = (-p.y * .5 + .5) * h;
const visible = annotation.visible && p.z > -1 && p.z < 1;
annotation.element.style.display = visible ? "block" : "none";
annotation.line.style.display = visible ? "block" : "none";
annotation.dot.style.display = visible ? "block" : "none";
if (!visible) continue;
const mobile = w < 700;
let dx = annotation.dx;
let dy = annotation.dy;
if (mobile) {
dx *= .67;
dy *= .72;
}
annotation.element.style.left = `${x + dx}px`;
annotation.element.style.top = `${y + dy}px`;
const endX = x + dx;
const endY = y + dy;
annotation.line.setAttribute("x1", x);
annotation.line.setAttribute("y1", y);
annotation.line.setAttribute("x2", endX);
annotation.line.setAttribute("y2", endY);
annotation.dot.setAttribute("cx", x);
annotation.dot.setAttribute("cy", y);
}
}
const airButton = document.getElementById("toggle-air");
airButton.addEventListener("click", () => {
const enabled = !hypothesis.visible;
hypothesis.visible = enabled;
document.body.classList.toggle("show-hypothesis", enabled);
airButton.classList.toggle("active", enabled);
airButton.setAttribute("aria-pressed", String(enabled));
airButton.textContent = enabled ? "Hide air-path hypothesis" : "Show air-path hypothesis";
const item = annotations.find(a => a.id === "ann-hypothesis");
if (item) item.visible = enabled;
});
const labelsButton = document.getElementById("toggle-labels");
labelsButton.addEventListener("click", () => {
const hidden = document.body.classList.toggle("hide-labels");
labelsButton.classList.toggle("active", !hidden);
labelsButton.setAttribute("aria-pressed", String(!hidden));
labelsButton.textContent = hidden ? "Labels off" : "Labels on";
});
function onResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", onResize);
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), .05);
const time = clock.elapsedTime;
// Gentle damping for the direct camera controller.
velocity.theta *= .82;
velocity.phi *= .82;
velocity.radius *= .80;
updateCamera();
if (hypothesis.visible) {
for (const flow of flowCurves) {
flow.meshes.forEach((mesh, i) => {
const t = (time * .115 + flow.offset + i / flow.meshes.length) % 1;
mesh.position.copy(flow.curve.getPointAt(t));
});
}
}
updateAnnotations();
renderer.render(scene, camera);
}
updateCamera();
animate();
requestAnimationFrame(() => loading.classList.add("done"));
</script>
</body>
</html>
```