Prompt specification
Build or customize the Three.js 3D scene "Village Pottery Drying Courtyard" 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: Village Pottery Drying Courtyard
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/village-pottery-drying-courtyard-x3331
Scene Description Prompt:
Create a standalone voxel scene in one HTML file using Three.js from cdnjs. Build a pottery courtyard showing forming, drying, and finished displays as separate stages. Use explanatory labels without claiming one firing process applies to every tradition.
Working Three.js Starter (village-pottery-drying-courtyard-x3331):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Clay Courtyard — A Voxel Pottery Workshop</title>
<style>
:root {
color-scheme: light;
--ink: #38271f;
--paper: #f5ead6;
--paper-strong: #fff8e9;
--clay: #ad6044;
--teal: #2f7772;
--line: rgba(72, 46, 31, 0.2);
--shadow: 0 12px 35px rgba(72, 43, 27, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e6d4b7;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
outline: none;
}
#scene:active {
cursor: grabbing;
}
.hud {
position: fixed;
z-index: 10;
top: 24px;
left: 24px;
width: min(430px, calc(100vw - 48px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 7px;
color: var(--clay);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 25px;
height: 3px;
background: var(--clay);
box-shadow: 8px 0 0 rgba(173, 96, 68, 0.32);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(36px, 5vw, 64px);
font-weight: 500;
line-height: 0.95;
letter-spacing: -0.045em;
text-wrap: balance;
text-shadow: 0 2px 0 rgba(255, 248, 233, 0.35);
}
.subtitle {
margin: 12px 0 0;
max-width: 390px;
color: rgba(56, 39, 31, 0.77);
font-size: 14px;
line-height: 1.5;
}
.scope-note {
margin-top: 14px;
padding: 11px 13px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(255, 248, 233, 0.76);
box-shadow: 0 6px 20px rgba(72, 43, 27, 0.08);
backdrop-filter: blur(12px);
color: rgba(56, 39, 31, 0.78);
font-size: 11px;
line-height: 1.45;
}
.scope-note strong {
color: var(--ink);
}
.stage-nav {
position: fixed;
z-index: 20;
top: 24px;
right: 24px;
display: flex;
gap: 7px;
padding: 7px;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(255, 248, 233, 0.84);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
}
.stage-nav button {
min-width: 42px;
height: 38px;
padding: 0 12px;
border: 0;
border-radius: 9px;
background: transparent;
color: rgba(56, 39, 31, 0.65);
cursor: pointer;
font-size: 12px;
font-weight: 750;
transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.stage-nav button:hover {
background: rgba(173, 96, 68, 0.11);
color: var(--ink);
transform: translateY(-1px);
}
.stage-nav button.active {
background: var(--ink);
color: var(--paper-strong);
}
.stage-nav .nav-index {
opacity: 0.58;
margin-right: 5px;
}
#world-labels {
position: fixed;
inset: 0;
z-index: 8;
overflow: hidden;
pointer-events: none;
}
.world-label {
position: absolute;
display: flex;
align-items: center;
gap: 10px;
min-width: 154px;
padding: 9px 12px 9px 9px;
border: 1px solid rgba(72, 46, 31, 0.19);
border-radius: 12px;
background: rgba(255, 248, 233, 0.9);
box-shadow: 0 8px 22px rgba(72, 43, 27, 0.15);
color: var(--ink);
text-align: left;
white-space: nowrap;
pointer-events: auto;
cursor: pointer;
transform: translate(-50%, -100%);
transition: background 160ms ease, box-shadow 160ms ease;
backdrop-filter: blur(9px);
}
.world-label::after {
content: "";
position: absolute;
left: 50%;
top: 100%;
width: 1px;
height: 22px;
background: rgba(72, 46, 31, 0.42);
}
.world-label:hover,
.world-label.active {
background: #fff9ed;
box-shadow: 0 10px 26px rgba(72, 43, 27, 0.23);
}
.label-number {
display: grid;
place-items: center;
width: 32px;
height: 32px;
flex: 0 0 auto;
border-radius: 9px;
background: var(--clay);
color: #fff8e9;
font-size: 10px;
font-weight: 900;
letter-spacing: 0.08em;
}
.world-label strong,
.world-label small {
display: block;
}
.world-label strong {
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
font-weight: 600;
}
.world-label small {
margin-top: 2px;
color: rgba(56, 39, 31, 0.62);
font-size: 10px;
}
.info-card {
position: fixed;
z-index: 15;
right: 24px;
bottom: 24px;
width: min(355px, calc(100vw - 48px));
padding: 18px 19px 17px;
border: 1px solid var(--line);
border-radius: 16px;
background: rgba(255, 248, 233, 0.9);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
pointer-events: none;
}
.info-kicker {
color: var(--clay);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.info-card h2 {
margin: 5px 0 7px;
font-family: Georgia, "Times New Roman", serif;
font-size: 27px;
font-weight: 500;
letter-spacing: -0.025em;
}
.info-card p {
margin: 0;
color: rgba(56, 39, 31, 0.74);
font-size: 12px;
line-height: 1.55;
}
.info-card .detail {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--line);
color: rgba(56, 39, 31, 0.58);
font-size: 10px;
line-height: 1.5;
}
.control-hint {
position: fixed;
z-index: 10;
left: 24px;
bottom: 24px;
padding: 9px 12px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(255, 248, 233, 0.76);
color: rgba(56, 39, 31, 0.62);
font-size: 10px;
letter-spacing: 0.02em;
pointer-events: none;
backdrop-filter: blur(10px);
}
#error {
position: fixed;
z-index: 100;
inset: 50% auto auto 50%;
width: min(460px, calc(100vw - 40px));
transform: translate(-50%, -50%);
padding: 22px;
border-radius: 16px;
background: #fff8e9;
box-shadow: var(--shadow);
color: var(--ink);
text-align: center;
}
@media (max-width: 760px) {
.hud {
top: 16px;
left: 16px;
width: min(350px, calc(100vw - 32px));
}
h1 {
font-size: 39px;
}
.subtitle {
display: none;
}
.scope-note {
max-width: 330px;
margin-top: 10px;
padding: 9px 10px;
font-size: 9px;
}
.stage-nav {
top: auto;
right: 12px;
bottom: 12px;
}
.stage-nav button {
min-width: 37px;
padding: 0 9px;
}
.stage-nav .nav-label {
display: none;
}
.info-card {
left: 12px;
right: 12px;
bottom: 70px;
width: auto;
padding: 13px 15px;
}
.info-card h2 {
margin: 3px 0 5px;
font-size: 22px;
}
.info-card .detail {
display: none;
}
.control-hint {
display: none;
}
.world-label {
min-width: 0;
padding: 7px;
}
.world-label small {
display: none;
}
.world-label strong {
font-size: 13px;
}
.label-number {
width: 27px;
height: 27px;
}
}
@media (prefers-reduced-motion: reduce) {
* {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<canvas
id="scene"
tabindex="0"
aria-label="Interactive voxel pottery courtyard. Drag to orbit and use the mouse wheel or pinch to zoom."
></canvas>
<div id="world-labels" aria-label="Courtyard stage labels">
<button class="world-label" data-stage="0" aria-label="Focus the forming stage">
<span class="label-number">01</span>
<span>
<strong>Forming</strong>
<small>Preparing and shaping clay</small>
</span>
</button>
<button class="world-label" data-stage="1" aria-label="Focus the drying stage">
<span class="label-number">02</span>
<span>
<strong>Drying</strong>
<small>Ware held while moisture changes</small>
</span>
</button>
<button class="world-label" data-stage="2" aria-label="Focus the finished display">
<span class="label-number">03</span>
<span>
<strong>Finished display</strong>
<small>Examples of completed surfaces</small>
</span>
</button>
</div>
<header class="hud">
<div class="eyebrow">Voxel workshop study</div>
<h1>Clay Courtyard</h1>
<p class="subtitle">
Three neighboring activity zones: a working bench, an airy drying rack,
and a display of completed pots.
</p>
<div class="scope-note">
<strong>Illustrative, not universal.</strong>
Forming methods, drying practices, firing schedules, temperatures, fuels,
surface treatments, and their order vary by clay body, object, workshop,
and tradition. This is not a single universal pottery process.
</div>
</header>
<nav class="stage-nav" aria-label="Scene views">
<button data-stage="-1" title="Overview">
<span class="nav-index">0</span><span class="nav-label">Overview</span>
</button>
<button data-stage="0" title="Forming stage">
<span class="nav-index">1</span><span class="nav-label">Forming</span>
</button>
<button data-stage="1" title="Drying stage">
<span class="nav-index">2</span><span class="nav-label">Drying</span>
</button>
<button data-stage="2" title="Finished display">
<span class="nav-index">3</span><span class="nav-label">Finished</span>
</button>
</nav>
<section class="info-card" aria-live="polite">
<div class="info-kicker" id="info-kicker">Courtyard overview</div>
<h2 id="info-title">A workshop in three parts</h2>
<p id="info-text">
Select a numbered stage to move closer. The labels describe what is
represented in this illustration rather than a prescribed workflow.
</p>
<div class="detail" id="info-detail">
Drag to orbit. Scroll or pinch to zoom. Keyboard: 0–3 for views,
arrow keys to orbit, and +/− to zoom.
</div>
</section>
<div class="control-hint">Drag to orbit · Wheel or pinch to zoom</div>
<div id="error" hidden>
WebGL could not start. Please try a browser with hardware acceleration enabled.
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const errorPanel = document.querySelector("#error");
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let renderer;
try {
renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
} catch (error) {
errorPanel.hidden = false;
throw error;
}
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;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe7d7bd);
scene.fog = new THREE.Fog(0xe7d7bd, 25, 48);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const stageData = [
{
name: "Forming",
x: -7.25,
kicker: "01 · Working area",
title: "Preparing and shaping clay",
text:
"A wheel, hand tools, a worktable, and a potter at work. This stage represents one illustrative workshop arrangement.",
detail:
"Wheel throwing, coiling, pinching, slab building, molds, and other forming methods vary widely among potters and traditions."
},
{
name: "Drying",
x: 0,
kicker: "02 · Holding area",
title: "Ware while moisture changes",
text:
"An airy rack holds clay pieces in different states of work. Their spacing and placement in this scene are illustrative rather than prescribed.",
detail:
"Drying targets, timing, turning, covering, and storage depend on the clay body, climate, object, and local practice."
},
{
name: "Finished display",
x: 7.25,
kicker: "03 · Display area",
title: "Completed forms and surfaces",
text:
"Finished vessels show varied profiles, colors, bands, and surface finishes. These examples are a display, not a claim that every piece follows the same steps.",
detail:
"Some practices fire before glazing; others use different orders or multiple firings. Firing method and surface treatment are not universal."
}
];
const stagePositions = [
new THREE.Vector3(-7.25, 3.35, 0.2),
new THREE.Vector3(0, 3.65, 0.2),
new THREE.Vector3(7.25, 3.45, 0.2)
];
const worldLabels = [...document.querySelectorAll(".world-label")];
const navButtons = [...document.querySelectorAll(".stage-nav button")];
const infoKicker = document.querySelector("#info-kicker");
const infoTitle = document.querySelector("#info-title");
const infoText = document.querySelector("#info-text");
const infoDetail = document.querySelector("#info-detail");
// Materials intentionally use a compact, faceted palette.
const material = (color, roughness = 0.85, metalness = 0, extra = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness,
metalness,
flatShading: true,
...extra
});
const mats = {
adobe: material(0xc9976b),
adobeLight: material(0xd8ad80),
adobeDark: material(0xa97955),
foundation: material(0x8b6652),
clay: material(0xae6247, 0.96),
clayLight: material(0xc88863, 0.96),
clayPale: material(0xd8b38f, 0.96),
raw: material(0xcaa47f, 0.98),
rawLight: material(0xd7b995, 0.98),
wood: material(0x76503a),
woodDark: material(0x4d3529),
woodPale: material(0xa37b54),
teal: material(0x397c76, 0.32, 0.08),
blue: material(0x365e8b, 0.34, 0.08),
ochre: material(0xbf793c, 0.52),
cream: material(0xe8d8b7, 0.68),
charcoal: material(0x3f3933),
green: material(0x62784d),
greenLight: material(0x829255),
skin: material(0xa86649),
shirt: material(0x496d70),
apron: material(0xc7a06a),
lantern: material(0xffd17a, 0.4, 0, {
emissive: 0xff8b32,
emissiveIntensity: 1.8
})
};
function addMesh(parent, geometry, mat, x = 0, y = 0, z = 0, cast = true) {
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.set(x, y, z);
mesh.castShadow = cast;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function box(parent, w, h, d, mat, x = 0, y = 0, z = 0, cast = true) {
return addMesh(parent, new THREE.BoxGeometry(w, h, d), mat, x, y, z, cast);
}
function cylinder(
parent,
topRadius,
bottomRadius,
height,
mat,
x = 0,
y = 0,
z = 0,
segments = 12
) {
return addMesh(
parent,
new THREE.CylinderGeometry(topRadius, bottomRadius, height, segments),
mat,
x,
y,
z
);
}
function sphere(parent, radius, mat, x = 0, y = 0, z = 0, segments = 10) {
return addMesh(
parent,
new THREE.SphereGeometry(radius, segments, Math.max(4, segments >> 1)),
mat,
x,
y,
z
);
}
function beamBetween(parent, a, b, radius, mat) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const midpoint = start.clone().add(end).multiplyScalar(0.5);
const beam = cylinder(
parent,
radius,
radius,
direction.length(),
mat,
midpoint.x,
midpoint.y,
midpoint.z,
8
);
beam.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return beam;
}
// Lighting.
scene.add(new THREE.HemisphereLight(0xfff2d6, 0x765c49, 2.05));
const sun = new THREE.DirectionalLight(0xffe1b2, 3.25);
sun.position.set(-8, 14, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -18;
sun.shadow.camera.right = 18;
sun.shadow.camera.top = 16;
sun.shadow.camera.bottom = -14;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 38;
sun.shadow.bias = -0.00045;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const warmFill = new THREE.DirectionalLight(0xd7e8df, 0.55);
warmFill.position.set(11, 7, -7);
scene.add(warmFill);
// Courtyard foundation and tiled floor.
box(scene, 28, 0.42, 19, mats.foundation, 0, -0.25, 0);
const tileCountX = 28;
const tileCountZ = 19;
const tileGeometry = new THREE.BoxGeometry(0.88, 0.07, 0.88);
const tileMaterial = material(0xffffff, 0.94, 0, { vertexColors: true });
const tiles = new THREE.InstancedMesh(
tileGeometry,
tileMaterial,
tileCountX * tileCountZ
);
tiles.receiveShadow = true;
const dummy = new THREE.Object3D();
let seed = 731;
const random = () => {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
};
let tileIndex = 0;
for (let z = 0; z < tileCountZ; z++) {
for (let x = 0; x < tileCountX; x++) {
dummy.position.set(
(x - (tileCountX - 1) / 2) * 0.97,
0.005 + random() * 0.008,
(z - (tileCountZ - 1) / 2) * 0.97
);
dummy.rotation.y = (random() - 0.5) * 0.025;
dummy.updateMatrix();
tiles.setMatrixAt(tileIndex, dummy.matrix);
const color = new THREE.Color().setHSL(
0.09 + random() * 0.035,
0.22 + random() * 0.12,
0.68 + random() * 0.11
);
tiles.setColorAt(tileIndex, color);
tileIndex++;
}
}
tiles.instanceMatrix.needsUpdate = true;
tiles.instanceColor.needsUpdate = true;
scene.add(tiles);
// Adobe enclosure and shaded colonnade.
box(scene, 27, 4.15, 0.45, mats.adobe, 0, 1.93, -8.55);
box(scene, 0.45, 2.25, 17.8, mats.adobe, -13.55, 1.0, 0);
box(scene, 0.45, 1.4, 17.8, mats.adobe, 13.55, 0.58, 0);
function archShape(width, height) {
const shape = new THREE.Shape();
const radius = width / 2;
shape.moveTo(-radius, 0);
shape.lineTo(radius, 0);
shape.lineTo(radius, height - radius);
shape.absarc(0, height - radius, radius, 0, Math.PI, false);
shape.lineTo(-radius, 0);
return shape;
}
for (const x of [-8.2, 0, 8.2]) {
const niche = addMesh(
scene,
new THREE.ShapeGeometry(archShape(2.65, 3.05), 10),
mats.charcoal,
x,
0.28,
-8.30,
false
);
niche.material = mats.charcoal;
}
for (const x of [-12, -8, -4, 0, 4, 8, 12]) {
box(scene, 0.18, 4.65, 0.18, mats.woodDark, x, 2.25, -7.25);
}
box(scene, 25.2, 0.22, 0.24, mats.woodDark, 0, 4.48, -7.25);
for (let x = -11; x <= 11; x += 2) {
box(scene, 0.12, 0.12, 3.2, mats.wood, x, 4.48, -6.25);
}
for (const x of [-10, 0, 10]) {
const lantern = new THREE.Group();
lantern.position.set(x, 3.92, -6.55);
box(lantern, 0.36, 0.46, 0.36, mats.lantern, 0, 0, 0, false);
box(lantern, 0.46, 0.07, 0.46, mats.woodDark, 0, 0.26, 0);
box(lantern, 0.46, 0.07, 0.46, mats.woodDark, 0, -0.26, 0);
box(lantern, 0.05, 0.52, 0.05, mats.woodDark, -0.19, 0, -0.19);
box(lantern, 0.05, 0.52, 0.05, mats.woodDark, 0.19, 0, -0.19);
scene.add(lantern);
const glow = new THREE.PointLight(0xffb45d, 0.48, 4.8, 2);
glow.position.set(x, 3.9, -6.1);
scene.add(glow);
}
// Low faceted pottery profiles.
const profiles = {
bowl: [
[0, 0], [0.27, 0], [0.48, 0.12], [0.66, 0.42],
[0.69, 0.52], [0.62, 0.52], [0.58, 0.42],
[0.41, 0.15], [0, 0.10]
],
jar: [
[0, 0], [0.35, 0], [0.53, 0.10], [0.62, 0.43],
[0.59, 0.72], [0.47, 0.94], [0.35, 1.07],
[0.32, 1.17], [0.27, 1.17], [0.30, 1.05],
[0.42, 0.90], [0.53, 0.66], [0.54, 0.39],
[0.43, 0.13], [0, 0.09]
],
vase: [
[0, 0], [0.30, 0], [0.47, 0.12], [0.58, 0.44],
[0.52, 0.76], [0.34, 0.97], [0.27, 1.18],
[0.29, 1.31], [0.23, 1.31], [0.22, 1.18],
[0.29, 0.96], [0.45, 0.73], [0.50, 0.42],
[0.38, 0.13], [0, 0.09]
],
bottle: [
[0, 0], [0.33, 0], [0.51, 0.10], [0.55, 0.50],
[0.44, 0.78], [0.23, 0.92], [0.20, 1.25],
[0.25, 1.31], [0.18, 1.31], [0.15, 1.23],
[0.17, 0.93], [0.36, 0.76], [0.47, 0.49],
[0.41, 0.14], [0, 0.08]
]
};
function addPot(
parent,
kind = "jar",
mat = mats.clay,
x = 0,
y = 0,
z = 0,
scale = 1,
bandMat = null
) {
const group = new THREE.Group();
group.position.set(x, y, z);
group.scale.setScalar(scale);
const points = profiles[kind].map(
([px, py]) => new THREE.Vector2(px, py)
);
const geometry = new THREE.LatheGeometry(points, 12);
geometry.computeVertexNormals();
const potMaterial = mat.clone();
potMaterial.side = THREE.DoubleSide;
potMaterial.flatShading = true;
addMesh(group, geometry, potMaterial);
if (bandMat && kind !== "bowl") {
const bands = {
jar: [
[0.34, 0.595],
[0.80, 0.555]
],
vase: [
[0.45, 0.555],
[0.82, 0.415]
],
bottle: [
[0.40, 0.525]
]
}[kind];
for (const [by, radius] of bands) {
const band = addMesh(
group,
new THREE.TorusGeometry(radius, 0.025, 5, 12),
bandMat
);
band.rotation.x = Math.PI / 2;
band.position.y = by;
}
}
parent.add(group);
return group;
}
function addPlant(x, z) {
const group = new THREE.Group();
group.position.set(x, 0.08, z);
addPot(group, "jar", mats.clay, 0, 0, 0, 0.82);
box(group, 0.15, 1.3, 0.15, mats.woodDark, 0, 1.25, 0);
box(group, 0.95, 0.28, 0.48, mats.green, 0, 1.82, 0);
box(group, 0.56, 0.35, 0.68, mats.greenLight, 0.28, 2.08, 0);
box(group, 0.75, 0.30, 0.48, mats.green, -0.32, 1.58, 0.02);
box(group, 0.42, 0.40, 0.42, mats.greenLight, 0.08, 2.30, 0);
scene.add(group);
}
addPlant(-12.2, 4.4);
addPlant(12.0, 4.7);
// Stage 1: forming.
box(scene, 4.9, 0.11, 4.65, mats.adobeDark, -7.25, 0.07, 0.3);
const wheel = new THREE.Group();
wheel.position.set(-7.45, 0.13, 0.55);
cylinder(wheel, 0.82, 0.94, 0.34, mats.woodDark, 0, 0.18, 0);
cylinder(wheel, 0.78, 0.82, 0.12, mats.wood, 0, 0.40, 0);
scene.add(wheel);
const rotor = new THREE.Group();
rotor.position.y = 0.47;
cylinder(rotor, 0.70, 0.70, 0.06, mats.woodPale, 0, 0, 0);
addPot(rotor, "jar", mats.clay, 0, 0.03, 0, 0.57);
wheel.add(rotor);
// Potter figure, assembled from simple blocks and cylinders.
const potter = new THREE.Group();
potter.position.set(-7.45, 0.14, -0.78);
cylinder(potter, 0.28, 0.34, 0.78, mats.shirt, 0, 1.02, 0, 8);
box(potter, 0.49, 0.67, 0.08, mats.apron, 0, 0.92, 0.29);
sphere(potter, 0.25, mats.skin, 0, 1.67, 0.02, 10);
cylinder(potter, 0.25, 0.25, 0.08, mats.woodDark, 0, 1.85, 0.02, 10);
beamBetween(potter, [-0.28, 1.28, 0.04], [-0.46, 0.93, 1.12], 0.085, mats.skin);
beamBetween(potter, [0.28, 1.28, 0.04], [0.40, 0.98, 1.08], 0.085, mats.skin);
beamBetween(potter, [-0.16, 0.65, 0.1], [-0.70, 0.14, 0.42], 0.11, mats.charcoal);
beamBetween(potter, [0.16, 0.65, 0.1], [0.70, 0.14, 0.42], 0.11, mats.charcoal);
box(potter, 0.78, 0.14, 0.62, mats.wood, 0, 0.35, 0.78);
scene.add(potter);
// Worktable and tools.
const workTable = new THREE.Group();
workTable.position.set(-9.65, 0.13, 0.95);
box(workTable, 2.2, 0.14, 1.18, mats.woodPale, 0, 1.15, 0);
for (const x of [-0.85, 0.85]) {
for (const z of [-0.40, 0.40]) {
box(workTable, 0.12, 1.12, 0.12, mats.wood, x, 0.56, z);
}
}
box(workTable, 1.10, 0.08, 0.68, mats.clayLight, -0.25, 1.26, 0);
box(workTable, 0.12, 0.04, 0.54, mats.woodDark, 0.70, 1.26, 0.1);
sphere(workTable, 0.20, mats.clayPale, 0.55, 1.32, -0.27, 8);
scene.add(workTable);
const bucket = new THREE.Group();
bucket.position.set(-5.25, 0.14, 1.55);
cylinder(bucket, 0.42, 0.34, 0.63, mats.wood, 0, 0.32, 0);
cylinder(bucket, 0.36, 0.36, 0.025, mats.charcoal, 0, 0.645, 0);
scene.add(bucket);
// Stage 2: drying rack.
box(scene, 4.85, 0.11, 4.65, mats.adobeDark, 0, 0.07, 0.3);
const rack = new THREE.Group();
rack.position.set(0, 0.13, 0.1);
for (const x of [-1.85, 1.85]) {
for (const z of [-0.70, 0.70]) {
box(rack, 0.13, 3.0, 0.13, mats.wood, x, 1.50, z);
}
}
for (const y of [0.42, 1.39, 2.36]) {
box(rack, 4.0, 0.10, 1.58, mats.woodPale, 0, y, 0);
}
box(rack, 4.1, 0.12, 0.13, mats.woodDark, 0, 3.02, -0.7);
box(rack, 4.1, 0.12, 0.13, mats.woodDark, 0, 3.02, 0.7);
scene.add(rack);
const dryingPots = [
[-1.45, 0.48, -0.30, "bowl", 0.52],
[-0.48, 0.48, 0.22, "jar", 0.55],
[0.52, 0.48, -0.20, "vase", 0.50],
[1.43, 0.48, 0.22, "bowl", 0.58],
[-1.42, 1.45, -0.18, "vase", 0.55],
[-0.47, 1.45, 0.22, "jar", 0.56],
[0.52, 1.45, -0.20, "bowl", 0.54],
[1.43, 1.45, 0.24, "bottle", 0.52],
[-1.42, 2.42, 0.18, "jar", 0.48],
[-0.45, 2.42, -0.23, "bowl", 0.50],
[0.54, 2.42, 0.22, "vase", 0.47],
[1.43, 2.42, -0.15, "jar", 0.49]
];
for (const [x, y, z, kind, scale] of dryingPots) {
addPot(
scene,
kind,
(x + z) % 2 > 0 ? mats.raw : mats.rawLight,
x,
y,
z,
scale
);
}
box(scene, 1.65, 0.08, 1.15, mats.cream, -2.95, 0.94, 0.8);
for (const x of [-3.6, -2.3]) {
box(scene, 0.12, 0.92, 0.12, mats.wood, x, 0.49, 0.8);
}
// Stage 3: finished display.
box(scene, 4.95, 0.11, 4.65, mats.adobeDark, 7.25, 0.07, 0.3);
const displayFrame = new THREE.Group();
displayFrame.position.set(7.25, 0.13, -2.05);
box(displayFrame, 4.85, 3.15, 0.14, mats.woodDark, 0, 1.75, 0);
box(displayFrame, 4.40, 2.72, 0.05, mats.adobeLight, 0, 1.75, 0.10);
for (const y of [0.45, 1.38, 2.31]) {
box(displayFrame, 4.28, 0.10, 0.72, mats.wood, 0, y, 0.42);
}
scene.add(displayFrame);
const displayWare = [
[-1.45, 0.51, 0.42, "jar", mats.teal, 0.58, mats.cream],
[-0.48, 0.51, 0.42, "bowl", mats.ochre, 0.62, null],
[0.52, 0.51, 0.42, "vase", mats.blue, 0.58, mats.cream],
[1.45, 0.51, 0.42, "jar", mats.clay, 0.55, mats.teal],
[-1.42, 1.44, 0.42, "vase", mats.cream, 0.56, mats.blue],
[-0.48, 1.44, 0.42, "jar", mats.ochre, 0.59, mats.charcoal],
[0.53, 1.44, 0.42, "bottle", mats.teal, 0.55, mats.cream],
[1.45, 1.44, 0.42, "bowl", mats.blue, 0.60, null],
[-1.42, 2.37, 0.42, "jar", mats.blue, 0.50, mats.cream],
[-0.45, 2.37, 0.42, "vase", mats.clay, 0.52, mats.teal],
[0.55, 2.37, 0.42, "bottle", mats.cream, 0.52, mats.ochre],
[1.44, 2.37, 0.42, "bowl", mats.teal, 0.54, null]
];
for (const [x, y, z, kind, mat, scale, band] of displayWare) {
addPot(scene, kind, mat, 7.25 + x, y, z, scale, band);
}
// Foreground plinths.
const plinths = [
[-1.95, 1.75, 0.42, 0.88, mats.cream],
[0, 1.75, 0.42, 1.22, mats.teal],
[1.95, 1.75, 0.42, 0.64, mats.ochre]
];
for (const [x, z, h, potH, potMat] of plinths) {
box(scene, 1.28, h, 1.28, mats.adobeLight, 7.25 + x, h / 2 + 0.13, z);
addPot(
scene,
potH > 1 ? "jar" : "bowl",
potMat,
7.25 + x,
h + 0.19,
z,
0.68,
mats.cream
);
}
// A few courtyard props.
addPot(scene, "jar", mats.clayLight, 11.1, 0.05, 2.2, 1.05, mats.charcoal);
box(scene, 1.1, 0.22, 0.7, mats.woodDark, 10.8, 0.16, 3.25);
box(scene, 0.9, 0.22, 0.7, mats.wood, 11.0, 0.37, 3.25);
// A small field of square dust motes catches the warm light.
const dustPositions = new Float32Array(90 * 3);
for (let i = 0; i < 90; i++) {
dustPositions[i * 3] = (random() - 0.5) * 25;
dustPositions[i * 3 + 1] = 0.7 + random() * 7;
dustPositions[i * 3 + 2] = (random() - 0.5) * 14;
}
const dustGeometry = new THREE.BufferGeometry();
dustGeometry.setAttribute(
"position",
new THREE.BufferAttribute(dustPositions, 3)
);
const dust = new THREE.Points(
dustGeometry,
new THREE.PointsMaterial({
color: 0xfff1cf,
size: 0.045,
transparent: true,
opacity: 0.42,
depthWrite: false,
sizeAttenuation: true
})
);
scene.add(dust);
// Camera orbit implemented locally, without camera-control addons.
const orbit = {
theta: 0.48,
phi: 1.02,
radius: 25.5,
target: new THREE.Vector3(0, 1.15, 0)
};
const desired = {
theta: orbit.theta,
phi: orbit.phi,
radius: orbit.radius,
target: orbit.target.clone()
};
function updateCamera(dt) {
const smoothing = 1 - Math.exp(-dt * 8);
orbit.theta = THREE.MathUtils.lerp(orbit.theta, desired.theta, smoothing);
orbit.phi = THREE.MathUtils.lerp(orbit.phi, desired.phi, smoothing);
orbit.radius = THREE.MathUtils.lerp(orbit.radius, desired.radius, smoothing);
orbit.target.lerp(desired.target, smoothing);
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
function showOverview() {
desired.target.set(0, 1.15, 0);
desired.radius = 25.5;
desired.theta = 0.48;
desired.phi = 1.02;
infoKicker.textContent = "Courtyard overview";
infoTitle.textContent = "A workshop in three parts";
infoText.textContent =
"Select a numbered stage to move closer. The labels describe what is represented in this illustration rather than a prescribed workflow.";
infoDetail.textContent =
"Drag to orbit. Scroll or pinch to zoom. Keyboard: 0–3 for views, arrow keys to orbit, and +/− to zoom.";
worldLabels.forEach((label) => label.classList.remove("active"));
navButtons.forEach((button) => button.classList.remove("active"));
}
function focusStage(index) {
const stage = stageData[index];
desired.target.set(stage.x, 1.4, 0.05);
desired.radius = 10.5;
desired.theta = 0.28;
desired.phi = 1.03;
infoKicker.textContent = stage.kicker;
infoTitle.textContent = stage.title;
infoText.textContent = stage.text;
infoDetail.textContent = stage.detail;
worldLabels.forEach((label, i) => {
label.classList.toggle("active", i === index);
});
navButtons.forEach((button, i) => {
button.classList.toggle("active", i === index + 1);
});
}
navButtons.forEach((button) => {
button.addEventListener("click", () => {
const index = Number(button.dataset.stage);
if (index === -1) showOverview();
else focusStage(index);
});
});
worldLabels.forEach((label) => {
label.addEventListener("click", () => {
focusStage(Number(label.dataset.stage));
});
});
const pointers = new Map();
let pinchDistance = 0;
function currentPinchDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
canvas.addEventListener("pointerdown", (event) => {
canvas.focus({ preventScroll: true });
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
pinchDistance = currentPinchDistance();
});
canvas.addEventListener("pointermove", (event) => {
const previous = pointers.get(event.pointerId);
if (!previous) return;
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1) {
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
desired.theta -= dx * 0.006;
desired.phi = THREE.MathUtils.clamp(
desired.phi - dy * 0.005,
0.52,
1.42
);
} else {
const distance = currentPinchDistance();
if (pinchDistance > 0 && distance > 0) {
desired.radius = THREE.MathUtils.clamp(
desired.radius * (pinchDistance / distance),
7.5,
36
);
}
pinchDistance = distance;
}
});
function endPointer(event) {
pointers.delete(event.pointerId);
pinchDistance = currentPinchDistance();
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener("contextmenu", (event) => event.preventDefault());
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius * Math.exp(event.deltaY * 0.001),
7.5,
36
);
},
{ passive: false }
);
window.addEventListener("keydown", (event) => {
if (event.key === "0") showOverview();
if (event.key === "1") focusStage(0);
if (event.key === "2") focusStage(1);
if (event.key === "3") focusStage(2);
if (event.key === "ArrowLeft") desired.theta += 0.12;
if (event.key === "ArrowRight") desired.theta -= 0.12;
if (event.key === "ArrowUp") {
desired.phi = Math.max(0.52, desired.phi - 0.08);
}
if (event.key === "ArrowDown") {
desired.phi = Math.min(1.42, desired.phi + 0.08);
}
if (event.key === "+" || event.key === "=") {
desired.radius = Math.max(7.5, desired.radius - 1.2);
}
if (event.key === "-" || event.key === "_") {
desired.radius = Math.min(36, desired.radius + 1.2);
}
});
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
const projected = new THREE.Vector3();
function updateLabels() {
for (let i = 0; i < worldLabels.length; i++) {
projected.copy(stagePositions[i]).project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.15 &&
Math.abs(projected.y) < 1.15;
worldLabels[i].style.visibility = visible ? "visible" : "hidden";
worldLabels[i].style.left = `${(projected.x * 0.5 + 0.5) * window.innerWidth}px`;
worldLabels[i].style.top = `${(-projected.y * 0.5 + 0.5) * window.innerHeight}px`;
}
}
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
updateCamera(dt);
if (!reduceMotion) {
rotor.rotation.y += dt * 0.42;
dust.rotation.y += dt * 0.012;
dust.position.y = Math.sin(clock.elapsedTime * 0.16) * 0.08;
}
renderer.render(scene, camera);
updateLabels();
}
animate();
</script>
</body>
</html>
```