Prompt specification
Build or customize the Three.js 3D scene "Craft lane with clay preparation and sales" 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: Craft lane with clay preparation and sales
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/craft-lane-with-clay-preparation-and-sales-x2331
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts an early modern pottery district with shared kilns. Build a compact historical pottery district with preparation yard, workshop, firing area, and shopfront. Connect material stages while keeping hot work separate from public circulation. Voxel style.
Working Three.js Starter (craft-lane-with-clay-preparation-and-sales-x2331):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shared Kilns — An Early Modern Pottery District</title>
<style>
:root {
--ink: #29251f;
--paper: #eee3cb;
--paper-dark: #d6c6a8;
--red: #a6503d;
--green: #557b67;
--blue: #52788b;
--gold: #bf8b42;
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #c8bea9;
color: var(--ink);
font-family: Georgia, "Times New Roman", serif;
}
#viewport {
position: fixed;
inset: 0;
cursor: grab;
}
#viewport:active { cursor: grabbing; }
canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
}
.panel {
position: fixed;
z-index: 10;
border: 1px solid rgba(50, 42, 31, 0.35);
background: rgba(238, 227, 203, 0.93);
box-shadow: 0 10px 30px rgba(42, 34, 24, 0.18);
backdrop-filter: blur(8px);
}
#title {
top: 18px;
left: 18px;
width: min(390px, calc(100vw - 36px));
padding: 15px 18px 14px;
border-left: 5px solid var(--red);
}
#title h1 {
margin: 0 0 4px;
font-size: clamp(20px, 2.5vw, 31px);
line-height: 1;
font-weight: 700;
letter-spacing: 0.01em;
}
#title p {
margin: 0;
font: 12px/1.45 system-ui, sans-serif;
color: #655b4d;
}
#info {
left: 18px;
bottom: 18px;
width: min(360px, calc(100vw - 36px));
padding: 15px 17px;
border-left: 5px solid var(--gold);
}
#info .eyebrow {
font: 700 10px/1 system-ui, sans-serif;
letter-spacing: 0.16em;
text-transform: uppercase;
opacity: 0.62;
margin-bottom: 7px;
}
#info h2 {
margin: 0 0 6px;
font-size: 21px;
}
#info p {
margin: 0;
font: 12px/1.55 system-ui, sans-serif;
color: #554d42;
}
#legend {
right: 18px;
bottom: 18px;
width: 235px;
padding: 13px 15px;
font: 11px/1.45 system-ui, sans-serif;
}
#legend strong {
display: block;
margin-bottom: 9px;
font: 700 10px/1 system-ui, sans-serif;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
gap: 9px;
margin: 7px 0;
}
.swatch {
flex: 0 0 24px;
height: 5px;
background: var(--c);
box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
#help {
right: 18px;
top: 18px;
padding: 9px 12px;
font: 10px/1.4 system-ui, sans-serif;
color: #554e43;
}
#controls {
position: fixed;
right: 18px;
top: 62px;
z-index: 12;
display: flex;
gap: 5px;
}
button {
width: 34px;
height: 32px;
border: 1px solid rgba(45,38,28,.35);
background: rgba(238,227,203,.92);
color: var(--ink);
font: 18px/1 Georgia, serif;
cursor: pointer;
box-shadow: 0 3px 12px rgba(42,34,24,.12);
}
button:hover { background: #fff7e7; }
button:active { transform: translateY(1px); }
@media (max-width: 760px) {
#title { top: 10px; left: 10px; }
#help { display: none; }
#controls { top: 10px; right: 10px; }
#legend { display: none; }
#info {
left: 10px;
bottom: 10px;
width: calc(100vw - 20px);
}
}
</style>
</head>
<body>
<div id="viewport" aria-label="Interactive three-dimensional pottery district"></div>
<section id="title" class="panel">
<h1>Shared Kilns</h1>
<p>An early modern pottery district · clay preparation, production, communal firing, and sale</p>
</section>
<section id="info" class="panel">
<div class="eyebrow">District process</div>
<h2 id="infoTitle">Preparation Yard</h2>
<p id="infoText">
Clay is dug, soaked, wedged, and dried here. The yard opens directly onto the
workshop so prepared clay never needs to cross the public street.
</p>
</section>
<section id="legend" class="panel">
<strong>Movement of material</strong>
<div class="legend-row"><span class="swatch" style="--c:#bf8b42"></span>Prepared clay</div>
<div class="legend-row"><span class="swatch" style="--c:#557b67"></span>Greenware to shared kilns</div>
<div class="legend-row"><span class="swatch" style="--c:#52788b"></span>Cooled goods to shop</div>
<div class="legend-row"><span class="swatch" style="--c:#8c877b"></span>Public street</div>
</section>
<div id="help" class="panel">Drag to orbit · Shift/right-drag to pan · Scroll to zoom · Click a district</div>
<div id="controls">
<button id="zoomIn" title="Zoom in">+</button>
<button id="zoomOut" title="Zoom out">−</button>
<button id="reset" title="Reset camera">⌂</button>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ---------------------------------------------------------------------------
// Renderer and scene
// ---------------------------------------------------------------------------
const viewport = document.getElementById("viewport");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc8bea9);
scene.fog = new THREE.Fog(0xc8bea9, 58, 92);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.8));
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;
viewport.appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-25, 25, 18, -18, 0.1, 150);
const cameraState = {
target: new THREE.Vector3(0, 1.2, 0),
radius: 43,
yaw: 0.76,
pitch: 0.72
};
function updateCamera() {
const { target, radius, yaw, pitch } = cameraState;
camera.position.set(
target.x + radius * Math.sin(yaw) * Math.cos(pitch),
target.y + radius * Math.sin(pitch),
target.z + radius * Math.cos(yaw) * Math.cos(pitch)
);
camera.lookAt(target);
const aspect = window.innerWidth / window.innerHeight;
const halfHeight = 17.5;
camera.left = -halfHeight * aspect;
camera.right = halfHeight * aspect;
camera.top = halfHeight;
camera.bottom = -halfHeight;
camera.updateProjectionMatrix();
}
updateCamera();
const hemi = new THREE.HemisphereLight(0xf5ead4, 0x5e5648, 2.15);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe6bc, 3.1);
sun.position.set(-18, 30, 17);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -27;
sun.shadow.camera.right = 27;
sun.shadow.camera.top = 25;
sun.shadow.camera.bottom = -25;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 75;
sun.shadow.bias = -0.00035;
scene.add(sun);
// ---------------------------------------------------------------------------
// Materials and reusable geometry helpers
// ---------------------------------------------------------------------------
const materialCache = new Map();
function material(color, options = {}) {
const key = `${color}-${JSON.stringify(options)}`;
if (!materialCache.has(key)) {
materialCache.set(key, new THREE.MeshStandardMaterial({
color,
roughness: 0.84,
metalness: 0,
...options
}));
}
return materialCache.get(key);
}
const M = {
soil: material(0x75624e),
soilDark: material(0x5c4d3d),
grass: material(0x64724d),
grassLight: material(0x7b8457),
stone: material(0x8f8a7d),
stoneLight: material(0xaaa18e),
street: material(0x8b8579),
plaster: material(0xd8c39c),
plasterWarm: material(0xe1cda7),
timber: material(0x493127),
timberLight: material(0x71503a),
roof: material(0x9d4b3b),
roofLight: material(0xb65b44),
brick: material(0x984d3c),
brickLight: material(0xb45e43),
mortar: material(0xb88b69),
clay: material(0x6d5947),
clayLight: material(0x8a6c51),
water: material(0x5f7f84, { roughness: 0.35 }),
pot: material(0xa95f3c),
potDark: material(0x684434),
potGreen: material(0x536f5e),
potCream: material(0xc6b18b),
wood: material(0x7b5b3d),
dark: material(0x25231f),
fire: material(0xff9d32, {
emissive: 0xff5a0b,
emissiveIntensity: 2.4,
roughness: 0.5
}),
gold: material(0xbf8b42),
green: material(0x557b67),
blue: material(0x52788b),
cloth: material(0x796a55),
skin: material(0xb98560),
leaf: material(0x4d6642),
leafLight: material(0x65794c),
cream: material(0xe7dcc0),
white: material(0xf1ead8)
};
const unitBox = new THREE.BoxGeometry(1, 1, 1);
function box(parent, w, h, d, x, y, z, mat, shadow = true) {
const mesh = new THREE.Mesh(unitBox, mat);
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.castShadow = shadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function group(parent, x = 0, y = 0, z = 0) {
const g = new THREE.Group();
g.position.set(x, y, z);
parent.add(g);
return g;
}
function randomBetween(a, b) {
return a + Math.random() * (b - a);
}
function pathStrip(parent, a, b, width, mat, y = 0.055) {
const dx = b[0] - a[0];
const dz = b[1] - a[1];
const length = Math.hypot(dx, dz);
const strip = box(parent, length, 0.045, width, (a[0] + b[0]) / 2, y, (a[1] + b[1]) / 2, mat, false);
strip.rotation.y = -Math.atan2(dz, dx);
return strip;
}
function dashedPath(parent, points, mat, dash = 0.65, gap = 0.42, width = 0.18) {
for (let i = 0; i < points.length - 1; i++) {
const a = points[i];
const b = points[i + 1];
const dx = b[0] - a[0];
const dz = b[1] - a[1];
const len = Math.hypot(dx, dz);
const nx = dx / len;
const nz = dz / len;
for (let d = 0; d < len; d += dash + gap) {
const part = Math.min(dash, len - d);
const cx = a[0] + nx * (d + part / 2);
const cz = a[1] + nz * (d + part / 2);
const m = box(parent, part, 0.05, width, cx, 0.11, cz, mat, false);
m.rotation.y = -Math.atan2(dz, dx);
}
}
}
function arrow(parent, x, z, angle, mat) {
const g = group(parent, x, 0.13, z);
box(g, 0.9, 0.06, 0.18, -0.08, 0, 0, mat, false);
const left = box(g, 0.42, 0.06, 0.16, 0.3, 0, -0.18, mat, false);
const right = box(g, 0.42, 0.06, 0.16, 0.3, 0, 0.18, mat, false);
left.rotation.y = -0.65;
right.rotation.y = 0.65;
g.rotation.y = angle;
return g;
}
function canvasSign(text, subtitle = "", background = "#3d3027", foreground = "#eadfc6") {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 192;
const ctx = canvas.getContext("2d");
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = foreground;
ctx.globalAlpha = 0.6;
ctx.lineWidth = 7;
ctx.strokeRect(12, 12, canvas.width - 24, canvas.height - 24);
ctx.globalAlpha = 1;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = foreground;
ctx.font = "bold 63px Georgia";
ctx.fillText(text, canvas.width / 2, subtitle ? 76 : 98);
if (subtitle) {
ctx.font = "25px Georgia";
ctx.globalAlpha = 0.8;
ctx.fillText(subtitle, canvas.width / 2, 137);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
return texture;
}
function signSprite(parent, text, subtitle, x, y, z, width = 4.8, bg, fg) {
const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
map: canvasSign(text, subtitle, bg, fg),
transparent: true,
depthTest: false,
depthWrite: false
}));
sprite.position.set(x, y, z);
sprite.scale.set(width, width * 0.25, 1);
sprite.renderOrder = 20;
parent.add(sprite);
return sprite;
}
function signBoard(parent, text, subtitle, x, y, z, width = 4.8, bg, fg) {
const g = group(parent, x, y, z);
const texture = canvasSign(text, subtitle, bg, fg);
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, width * 0.25),
new THREE.MeshStandardMaterial({ map: texture, roughness: 0.9 })
);
mesh.position.z = 0.18;
g.add(mesh);
return g;
}
// ---------------------------------------------------------------------------
// District base, street, boundaries, and landscape
// ---------------------------------------------------------------------------
const district = group(scene);
box(district, 37, 1.15, 29, 0, -0.66, 0, M.soil);
box(district, 36.4, 0.22, 28.4, 0, -0.06, 0, M.soilDark);
box(district, 36.2, 0.12, 28.2, 0, 0.07, 0, M.grass);
// Uneven grass and earth patches.
for (let i = 0; i < 85; i++) {
const x = randomBetween(-17.3, 17.3);
const z = randomBetween(-13.4, 13.4);
if (z > 7.5) continue;
const w = randomBetween(0.45, 1.9);
const d = randomBetween(0.35, 1.35);
box(district, w, 0.045, d, x, 0.16, z, Math.random() > 0.46 ? M.grassLight : M.soil, false);
}
// Public street at the front of the district.
box(district, 35, 0.16, 4.1, 0, 0.18, 9.7, M.street);
box(district, 35, 0.13, 0.18, 0, 0.27, 7.72, M.stoneLight);
for (let row = 0; row < 5; row++) {
for (let col = 0; col < 30; col++) {
const x = -17 + col * 1.16 + (row % 2) * 0.31;
const z = 8.05 + row * 0.78;
const c = Math.random() > 0.5 ? M.stoneLight : M.stone;
box(district, randomBetween(0.72, 1.02), 0.055, randomBetween(0.46, 0.65), x, 0.29, z, c, false);
}
}
// Back and side boundary walls.
box(district, 35, 1.15, 0.48, 0, 0.75, -13.3, M.stone);
box(district, 0.48, 1.15, 25.7, -17.7, 0.75, -0.4, M.stone);
box(district, 0.48, 1.15, 25.7, 17.7, 0.75, -0.4, M.stone);
for (let x = -16.8; x < 17.2; x += 1.5) {
box(district, 1.28, 0.13, 0.55, x, 1.37, -13.3, M.stoneLight);
}
// Blocky perimeter trees.
function tree(x, z, scale = 1) {
const g = group(district, x, 0.2, z);
box(g, 0.55 * scale, 2.6 * scale, 0.55 * scale, 0, 1.3 * scale, 0, M.timber);
box(g, 2.4 * scale, 1.7 * scale, 2.2 * scale, 0, 3.0 * scale, 0, M.leaf);
box(g, 1.6 * scale, 1.2 * scale, 1.8 * scale, 0.65 * scale, 3.85 * scale, 0.2, M.leafLight);
box(g, 1.2 * scale, 1.0 * scale, 1.4 * scale, -0.75 * scale, 3.65 * scale, -0.1, M.leaf);
}
tree(-16.6, -11.6, 1.05);
tree(-12.7, -12.1, 0.9);
tree(-3.4, -12.0, 1.05);
tree(2.6, -12.1, 0.82);
tree(17.0, -11.8, 1.0);
function fence(x1, z1, x2, z2, height = 1.2) {
const length = Math.hypot(x2 - x1, z2 - z1);
const count = Math.ceil(length / 0.65);
for (let i = 0; i <= count; i++) {
const t = i / count;
box(district, 0.12, height, 0.12, x1 + (x2 - x1) * t, height / 2 + 0.2, z1 + (z2 - z1) * t, M.timber);
}
const dx = (x2 - x1) / count;
const dz = (z2 - z1) / count;
for (let h = 0.45; h < height; h += 0.38) {
const rail = box(district, length, 0.09, 0.1, (x1 + x2) / 2, h + 0.2, (z1 + z2) / 2, M.timberLight);
rail.rotation.y = -Math.atan2(dz, dx);
}
}
fence(-16.9, 10.8, -3.0, 10.8, 1.15);
fence(-1.5, 10.8, 5.0, 10.8, 1.15);
// ---------------------------------------------------------------------------
// Reusable district objects
// ---------------------------------------------------------------------------
function pot(parent, x, y, z, size = 1, mat = M.pot, lid = false) {
const g = group(parent, x, y, z);
box(g, 0.62 * size, 0.18 * size, 0.62 * size, 0, 0.09 * size, 0, mat);
box(g, 0.82 * size, 0.47 * size, 0.82 * size, 0, 0.40 * size, 0, mat);
box(g, 0.64 * size, 0.25 * size, 0.64 * size, 0, 0.76 * size, 0, mat);
box(g, 0.78 * size, 0.15 * size, 0.78 * size, 0, 0.96 * size, 0, mat);
box(g, 0.52 * size, 0.035 * size, 0.52 * size, 0, 1.045 * size, 0, M.dark, false);
if (lid) box(g, 0.55 * size, 0.1 * size, 0.55 * size, 0, 1.1 * size, 0, mat);
return g;
}
function crate(parent, x, y, z, size = 1, pottery = true) {
const g = group(parent, x, y, z);
const s = size;
box(g, 1.5 * s, 0.12 * s, 1.2 * s, 0, 0.08 * s, 0, M.wood);
box(g, 1.5 * s, 0.55 * s, 0.1 * s, 0, 0.32 * s, -0.55 * s, M.woodLight);
box(g, 1.5 * s, 0.55 * s, 0.1 * s, 0, 0.32 * s, 0.55 * s, M.woodLight);
box(g, 0.1 * s, 0.55 * s, 1.2 * s, -0.7 * s, 0.32 * s, 0, M.woodLight);
box(g, 0.1 * s, 0.55 * s, 1.2 * s, 0.7 * s, 0.32 * s, 0, M.woodLight);
if (pottery) {
pot(g, -0.32 * s, 0.16 * s, 0, 0.6 * s, M.potCream);
pot(g, 0.3 * s, 0.16 * s, 0, 0.5 * s, M.potGreen);
}
return g;
}
function barrel(parent, x, y, z, size = 1, mat = M.wood) {
const g = group(parent, x, y, z);
box(g, 0.86 * size, 0.18 * size, 0.86 * size, 0, 0.09 * size, 0, M.timber);
box(g, 1.02 * size, 0.63 * size, 1.02 * size, 0, 0.49 * size, 0, mat);
box(g, 0.9 * size, 0.15 * size, 0.9 * size, 0, 0.88 * size, 0, M.timber);
box(g, 1.08 * size, 0.09 * size, 1.08 * size, 0, 0.30 * size, 0, M.dark);
return g;
}
function woodPile(parent, x, y, z, width = 2.8, depth = 1.4) {
const g = group(parent, x, y, z);
for (let layer = 0; layer < 3; layer++) {
const count = 4 - layer;
for (let i = 0; i < count; i++) {
box(
g,
width * 0.25,
0.32,
depth,
(i - (count - 1) / 2) * width * 0.26,
0.18 + layer * 0.34,
(layer % 2) * 0.08,
layer % 2 ? M.timberLight : M.wood
);
}
}
return g;
}
function person(parent, x, z, colors, angle = 0, hat = true) {
const g = group(parent, x, 0.26, z);
const shirt = material(colors.shirt);
const trousers = material(colors.trousers);
box(g, 0.28, 0.8, 0.34, -0.17, 0.42, 0, trousers);
box(g, 0.28, 0.8, 0.34, 0.17, 0.42, 0, trousers);
box(g, 0.72, 0.78, 0.43, 0, 1.18, 0, shirt);
box(g, 0.24, 0.72, 0.24, -0.49, 1.14, 0, shirt);
box(g, 0.24, 0.72, 0.24, 0.49, 1.14, 0, shirt);
box(g, 0.48, 0.48, 0.46, 0, 1.78, 0, M.skin);
if (hat) {
box(g, 0.64, 0.13, 0.62, 0, 2.05, 0, M.timber);
box(g, 0.42, 0.2, 0.4, 0, 2.17, 0, M.timber);
}
g.rotation.y = angle;
return g;
}
// ---------------------------------------------------------------------------
// Preparation yard
// ---------------------------------------------------------------------------
const prep = group(district);
box(prep, 9.2, 0.08, 7.0, -12.8, 0.19, 5.35, M.clayLight, false);
// Clay soaking pit and timber edging.
box(prep, 3.3, 0.12, 2.3, -15.0, 0.27, 5.25, M.clay);
box(prep, 2.9, 0.06, 1.9, -15.0, 0.35, 5.25, M.water, false);
box(prep, 3.5, 0.22, 0.2, -15.0, 0.38, 4.0, M.timber);
box(prep, 3.5, 0.22, 0.2, -15.0, 0.38, 6.5, M.timber);
box(prep, 0.2, 0.22, 2.7, -16.7, 0.38, 5.25, M.timber);
box(prep, 0.2, 0.22, 2.7, -13.3, 0.38, 5.25, M.timber);
// Wedging and preparation tables.
box(prep, 3.0, 0.25, 1.55, -10.3, 1.05, 3.55, M.wood);
for (const x of [-11.5, -9.1]) {
box(prep, 0.22, 0.8, 0.22, x, 0.62, 3.05, M.timber);
box(prep, 0.22, 0.8, 0.22, x, 0.62, 4.05, M.timber);
}
box(prep, 1.4, 0.28, 0.9, -10.5, 1.33, 3.5, M.clay);
box(prep, 0.75, 0.18, 0.6, -9.4, 1.3, 3.5, M.clayLight);
// Drying rack with flat clay slabs.
for (const x of [-16.0, -13.8]) {
box(prep, 0.18, 2.25, 0.18, x, 1.35, 7.25, M.timber);
}
for (let level = 0; level < 3; level++) {
box(prep, 2.5, 0.14, 1.15, -14.9, 0.65 + level * 0.72, 7.25, M.woodLight);
for (let i = 0; i < 3; i++) {
box(prep, 0.58, 0.1, 0.78, -15.75 + i * 0.82, 0.79 + level * 0.72, 7.25, M.clayLight);
}
}
// Lean-to shelter.
box(prep, 4.2, 0.22, 2.5, -10.6, 3.1, 7.35, M.roof);
const leanRoof = box(prep, 4.35, 0.17, 2.7, -10.6, 3.08, 7.35, M.roofLight);
leanRoof.rotation.x = 0.15;
for (const x of [-12.4, -8.8]) {
box(prep, 0.18, 2.9, 0.18, x, 1.65, 6.45, M.timber);
}
barrel(prep, -12.0, 0.25, 8.0, 0.9, M.woodLight);
woodPile(prep, -8.8, 0.25, 8.0, 1.8, 0.8);
signSprite(prep, "CLAY YARD", "dig · soak · wedge · dry", -12.8, 5.5, 8.65, 5.1, "#6d5136", "#f0dfb9");
person(prep, -11.4, 4.9, { shirt: 0x8b6a46, trousers: 0x4c4337 }, 0.5, false);
// ---------------------------------------------------------------------------
// Workshop: an interpretive cutaway so production remains visible
// ---------------------------------------------------------------------------
const workshop = group(district);
const wx = -5.0;
const wz = -3.2;
box(workshop, 13.3, 0.16, 8.2, wx, 0.23, wz, M.woodLight);
// Plaster walls.
box(workshop, 13.0, 4.0, 0.3, wx, 2.2, wz - 4.0, M.plaster);
box(workshop, 0.3, 4.0, 8.0, wx - 6.5, 2.2, wz, M.plasterWarm);
box(workshop, 0.3, 2.0, 8.0, wx + 6.5, 1.2, wz, M.plasterWarm);
box(workshop, 3.0, 1.15, 0.3, wx - 5.0, 0.75, wz + 4.0, M.plaster);
box(workshop, 3.1, 1.15, 0.3, wx + 4.45, 0.75, wz + 4.0, M.plaster);
// Exposed timber frame.
for (const x of [wx - 6.45, wx - 4.3, wx, wx + 4.3, wx + 6.45]) {
box(workshop, 0.24, 4.2, 0.34, x, 2.3, wz + 4.02, M.timber);
}
for (const x of [wx - 6.45, wx + 6.45]) {
box(workshop, 0.24, 4.2, 0.34, x, 2.3, wz - 3.98, M.timber);
}
box(workshop, 13.2, 0.24, 0.38, wx, 4.22, wz + 4.02, M.timber);
box(workshop, 0.24, 0.24, 8.1, wx - 6.46, 4.22, wz, M.timber);
box(workshop, 13.2, 0.22, 0.35, wx, 2.2, wz - 3.98, M.timber);
// Stepped gable roof. The front-right roof section is cut away.
const backRoof = box(workshop, 13.8, 0.28, 4.5, wx, 4.86, wz - 2.15, M.roof);
backRoof.rotation.x = -0.30;
const frontRoof = box(workshop, 4.0, 0.28, 4.5, wx - 4.8, 4.86, wz + 2.15, M.roofLight);
frontRoof.rotation.x = 0.30;
for (let i = 0; i < 7; i++) {
const z = wz - 3.85 + i * 0.55;
const y = 4.32 + (wz - 0.2 - z) * 0.31;
box(workshop, 13.6, 0.10, 0.12, wx, y, z, M.roofLight);
}
box(workshop, 13.8, 0.22, 0.28, wx, 5.22, wz - 0.15, M.timber);
// Potter's wheels.
const wheelGroups = [];
function wheel(parent, x, z, potMat = M.pot) {
const g = group(parent, x, 0.35, z);
box(g, 1.65, 0.2, 1.35, 0, 0.1, 0, M.timber);
box(g, 0.38, 0.95, 0.38, 0, 0.65, 0, M.wood);
const spinner = group(g, 0, 1.14, 0);
box(spinner, 1.35, 0.16, 1.08, 0, 0, 0, M.timberLight);
box(spinner, 0.78, 0.08, 0.78, 0, 0.12, 0, M.stoneLight);
pot(spinner, 0, 0.17, 0, 0.68, potMat);
wheelGroups.push(spinner);
return g;
}
wheel(workshop, -8.7, -3.4, M.pot);
wheel(workshop, -5.0, -3.5, M.potCream);
wheel(workshop, -1.4, -3.2, M.potGreen);
// Workbench and tools.
box(workshop, 4.1, 0.24, 1.25, -6.4, 1.15, -5.8, M.wood);
for (const x of [-8.1, -4.7]) {
box(workshop, 0.22, 0.95, 0.22, x, 0.68, -5.3, M.timber);
box(workshop, 0.22, 0.95, 0.22, x, 0.68, -6.3, M.timber);
}
pot(workshop, -7.3, 1.29, -5.7, 0.65, M.potGreen);
pot(workshop, -5.8, 1.29, -5.75, 0.55, M.pot);
for (let i = 0; i < 4; i++) {
box(workshop, 0.08, 0.75, 0.08, -3.8 + i * 0.22, 2.5, -6.92, M.timber);
}
// Shelves of unfinished greenware.
for (const y of [1.45, 2.65]) {
box(workshop, 4.8, 0.14, 0.9, -1.0, y, -6.5, M.wood);
for (let i = 0; i < 5; i++) {
pot(workshop, -2.8 + i * 0.9, y + 0.08, -6.45, 0.48, M.potGreen);
}
}
crate(workshop, 0.15, 0.32, -1.4, 1.05, false);
pot(workshop, 0.15, 0.52, -1.4, 0.78, M.potGreen);
person(workshop, -5.0, -2.1, { shirt: 0x8b4f38, trousers: 0x4f473b }, 0.2);
person(workshop, -9.7, -4.8, { shirt: 0x5e7366, trousers: 0x514438 }, -0.8);
signSprite(workshop, "POTTER'S WORKSHOP", "forming · drying · inspection", -5.1, 6.3, 0.6, 6.2, "#4a3428", "#efe0bd");
// ---------------------------------------------------------------------------
// Shared firing yard, separated by walls and locked service gates
// ---------------------------------------------------------------------------
const firing = group(district);
box(firing, 13.4, 0.08, 10.3, 10.1, 0.2, -6.0, M.brickLight, false);
function brickWall(x, z, w, d, height = 1.6) {
box(firing, w, height, d, x, 0.25 + height / 2, z, M.brick);
box(firing, w + 0.12, 0.16, d + 0.12, x, 0.25 + height, z, M.mortar);
for (let y = 0.65; y < height; y += 0.42) {
box(firing, w + 0.02, 0.045, d + 0.03, x, y, z, M.brickLight, false);
}
}
brickWall(3.5, -8.55, 0.42, 5.1); // left wall, north segment
brickWall(3.5, -1.75, 0.42, 1.55); // left wall, south segment
brickWall(10.1, -11.0, 13.3, 0.42); // back wall
brickWall(16.6, -6.0, 0.42, 10.3); // right wall
brickWall(5.1, -1.0, 3.2, 0.42); // front wall, west segment
brickWall(12.7, -1.0, 7.7, 0.42); // front wall, east segment
// Greenware gate on west wall.
box(firing, 0.18, 2.1, 0.18, 3.5, 1.3, -5.2, M.timber);
box(firing, 0.18, 2.1, 0.18, 3.5, 1.3, -3.1, M.timber);
box(firing, 0.14, 0.18, 2.25, 3.5, 2.2, -4.15, M.timber);
// Cooled-goods gate on front wall.
box(firing, 0.2, 2.1, 0.2, 6.7, 1.3, -1.0, M.timber);
box(firing, 0.2, 2.1, 0.2, 8.5, 1.3, -1.0, M.timber);
box(firing, 2.0, 0.18, 0.18, 7.6, 2.2, -1.0, M.timber);
box(firing, 1.65, 0.12, 0.12, 7.6, 1.15, -1.0, M.timber);
box(firing, 1.65, 0.12, 0.12, 7.6, 1.72, -1.0, M.timber);
const fireGlows = [];
const smokeParticles = [];
function sharedKiln(x, z, scale = 1) {
const g = group(firing, x, 0.28, z);
g.scale.setScalar(scale);
box(g, 4.7, 0.35, 4.5, 0, 0.18, 0, M.mortar);
box(g, 4.15, 1.3, 4.0, 0, 0.92, 0, M.brick);
box(g, 3.55, 1.25, 3.45, 0, 2.18, 0, M.brickLight);
box(g, 2.95, 1.1, 2.9, 0, 3.35, 0, M.brick);
box(g, 2.25, 0.9, 2.25, 0, 4.35, 0, M.brickLight);
box(g, 1.45, 0.48, 1.45, 0, 5.03, 0, M.brick);
box(g, 0.9, 2.2, 0.9, 0, 6.28, 0, M.brickLight);
// Individual brick courses.
for (let y = 0.55; y < 4.8; y += 0.43) {
const width = y < 1.6 ? 4.18 : y < 2.9 ? 3.58 : y < 4.0 ? 2.98 : 2.28;
box(g, width + 0.02, 0.045, 2.03, 0, y, 0, M.mortar, false);
}
// Fire door and arched-looking stepped lintel.
box(g, 1.35, 1.25, 0.15, 0, 0.83, 2.03, M.dark);
box(g, 1.62, 0.28, 0.24, 0, 1.53, 2.06, M.brickLight);
box(g, 1.2, 0.28, 0.24, 0, 1.79, 2.03, M.brickLight);
const glow = box(g, 1.05, 0.95, 0.08, 0, 0.75, 2.13, M.fire, false);
fireGlows.push(glow);
const light = new THREE.PointLight(0xff6b21, 18, 7, 2);
light.position.set(0, 1.2, 2.5);
g.add(light);
// Smoke marker at chimney.
const smoke = [];
for (let i = 0; i < 7; i++) {
const puff = box(g, 0.5, 0.5, 0.5, 0, 7.8 + i * 0.6, 0, material(0x6c665d, {
transparent: true,
opacity: 0.32,
depthWrite: false
}), false);
puff.userData.offset = i / 7;
smoke.push(puff);
}
smokeParticles.push(...smoke);
return g;
}
sharedKiln(8.1, -6.6, 1.0);
sharedKiln(13.25, -6.4, 0.88);
// Small charcoal kiln.
box(firing, 2.55, 1.0, 2.45, 5.45, 0.78, -8.85, M.brick);
box(firing, 2.0, 0.9, 2.0, 5.45, 1.7, -8.85, M.brickLight);
box(firing, 1.3, 0.8, 1.3, 5.45, 2.55, -8.85, M.brick);
box(firing, 0.7, 1.5, 0.7, 5.45, 3.65, -8.85, M.brickLight);
box(firing, 0.8, 0.9, 0.12, 5.45, 0.73, -7.62, M.fire, false);
woodPile(firing, 5.45, 0.25, -4.25, 2.3, 1.0);
woodPile(firing, 15.2, 0.25, -4.6, 2.0, 1.0);
woodPile(firing, 10.2, 0.25, -9.5, 3.1, 1.0);
// Staging boards for greenware just inside the gate.
box(firing, 2.3, 0.18, 1.4, 4.7, 0.43, -4.0, M.wood);
for (let i = 0; i < 3; i++) {
pot(firing, 4.0 + i * 0.65, 0.54, -4.0, 0.52, M.potGreen);
}
person(firing, 7.0, -3.5, { shirt: 0x8d4f32, trousers: 0x433c32 }, Math.PI);
person(firing, 10.1, -3.2, { shirt: 0x6e5b42, trousers: 0x393832 }, -0.5);
signSprite(firing, "SHARED FIRES", "hot work · authorized keepers only", 10.1, 5.65, -1.0, 6.1, "#7b3f31", "#f2d9b2");
signBoard(firing, "KEEP CLEAR", "locked during firing", 9.1, 1.8, -0.73, 2.8, "#53372b", "#e5cfa6");
// ---------------------------------------------------------------------------
// Shopfront, public entrance, and service-side delivery
// ---------------------------------------------------------------------------
const shop = group(district);
const sx = 10.5;
const sz = 4.0;
box(shop, 10.0, 0.15, 7.2, sx, 0.24, sz, M.stoneLight);
box(shop, 9.8, 3.9, 0.3, sx, 2.15, sz - 3.5, M.plasterWarm);
box(shop, 0.3, 3.9, 7.0, sx - 4.9, 2.15, sz, M.plasterWarm);
box(shop, 0.3, 3.9, 7.0, sx + 4.9, 2.15, sz, M.plasterWarm);
// Front facade with display window and open doorway.
box(shop, 2.45, 3.9, 0.3, sx - 3.7, 2.15, sz + 3.5, M.plaster);
box(shop, 2.0, 3.9, 0.3, sx + 3.5, 2.15, sz + 3.5, M.plaster);
box(shop, 2.7, 0.95, 0.3, sx + 1.45, 0.65, sz + 3.5, M.plaster);
box(shop, 3.9, 0.55, 0.3, sx - 1.1, 3.65, sz + 3.5, M.plaster);
// Timber frame.
for (const x of [sx - 4.85, sx - 2.5, sx + 0.2, sx + 2.5, sx + 4.85]) {
box(shop, 0.22, 4.15, 0.35, x, 2.28, sz + 3.53, M.timber);
}
box(shop, 9.9, 0.22, 0.38, sx, 4.25, sz + 3.53, M.timber);
box(shop, 0.22, 0.22, 7.0, sx - 4.85, 4.25, sz, M.timber);
box(shop, 0.22, 0.22, 7.0, sx + 4.85, 4.25, sz, M.timber);
// Dark recessed display window with visible wares.
box(shop, 3.55, 2.15, 0.16, sx - 1.15, 2.05, sz + 3.52, M.dark);
box(shop, 0.12, 2.2, 0.2, sx - 1.15, 2.05, sz + 3.68, M.timber);
box(shop, 0.12, 2.2, 0.2, sx - 2.9, 2.05, sz + 3.68, M.timber);
box(shop, 3.8, 0.12, 0.2, sx - 1.15, 0.98, sz + 3.68, M.timber);
box(shop, 3.8, 0.12, 0.2, sx - 1.15, 3.12, sz + 3.68, M.timber);
box(shop, 3.8, 0.16, 0.72, sx - 1.15, 1.05, sz + 3.42, M.wood);
pot(shop, sx - 2.35, 1.15, sz + 3.45, 0.78, M.potCream);
pot(shop, sx - 1.2, 1.15, sz + 3.45, 0.9, M.pot);
pot(shop, sx - 0.05, 1.15, sz + 3.45, 0.68, M.potGreen);
// Open doorway.
box(shop, 1.15, 2.85, 0.16, sx + 1.5, 1.63, sz + 3.5, M.dark);
box(shop, 0.15, 3.05, 0.35, sx + 0.88, 1.72, sz + 3.58, M.timber);
box(shop, 0.15, 3.05, 0.35, sx + 2.15, 1.72, sz + 3.58, M.timber);
box(shop, 1.45, 0.18, 0.35, sx + 1.5, 3.17, sz + 3.58, M.timber);
// Shop roof.
const shopBackRoof = box(shop, 10.6, 0.28, 4.0, sx, 4.78, sz - 1.85, M.roof);
shopBackRoof.rotation.x = -0.28;
const shopFrontRoof = box(shop, 10.6, 0.28, 4.0, sx, 4.78, sz + 1.85, M.roofLight);
shopFrontRoof.rotation.x = 0.28;
for (let i = 0; i < 8; i++) {
const z = sz - 3.25 + i * 0.83;
const y = 4.2 + (sz - 0.25 - z) * 0.27;
box(shop, 10.4, 0.10, 0.13, sx, y, z, M.roof);
}
box(shop, 10.6, 0.22, 0.28, sx, 5.08, sz - 0.05, M.timber);
// Striped cloth awning.
for (let i = 0; i < 8; i++) {
const x = sx - 3.5 + i * 0.88;
const mat = i % 2 ? M.cream : M.roof;
const awn = box(shop, 0.88, 0.12, 1.75, x, 3.25, sz + 4.15, mat);
awn.rotation.x = -0.13;
}
signBoard(shop, "POTTERY", "common · pots · household ware", sx - 1.1, 3.72, sz + 3.72, 4.7, "#4a3428", "#efe0bd");
// Public-side wares remain outside the hot-work enclosure.
crate(shop, sx - 3.7, 0.28, sz + 4.25, 1.0, true);
crate(shop, sx - 2.1, 0.28, sz + 4.25, 0.85, true);
barrel(shop, sx + 3.9, 0.28, sz + 4.1, 0.9);
// Bollards clearly keep customers out of the service corridor.
for (const x of [5.7, 8.1, 10.5, 12.9, 15.3]) {
box(shop, 0.18, 0.85, 0.18, x, 0.68, 7.75, M.timber);
box(shop, 0.26, 0.12, 0.26, x, 1.13, 7.75, M.gold);
}
person(shop, 8.8, 9.55, { shirt: 0x7b5260, trousers: 0x4d4338 }, 0.2, false);
person(shop, 11.9, 9.0, { shirt: 0x536c74, trousers: 0x4b4135 }, -0.5, true);
person(shop, 12.9, 8.9, { shirt: 0x8b7048, trousers: 0x4c4336 }, 0.8, false);
signSprite(shop, "SHOPFRONT", "public entrance", sx, 6.4, sz + 3.7, 4.8, "#4a3428", "#efe0bd");
// ---------------------------------------------------------------------------
// Connected material routes and separation of circulation
// ---------------------------------------------------------------------------
// Prepared clay: yard to workshop.
pathStrip(district, [-13.0, 4.6], [-13.0, 2.25], 1.35, M.gold);
pathStrip(district, [-13.0, 2.25], [-8.0, 2.25], 1.35, M.gold);
pathStrip(district, [-8.0, 2.25], [-8.0, 0.55], 1.35, M.gold);
dashedPath(district, [[-12.8, 4.7], [-12.8, 2.25], [-8.0, 2.25], [-8.0, 0.7]], M.wood);
// Greenware: workshop to firing yard.
pathStrip(district, [-0.9, -4.0], [4.6, -4.0], 1.15, M.green);
dashedPath(district, [[-0.8, -4.0], [4.9, -4.0]], M.cream);
arrow(district, 1.7, -4.0, 0, M.green);
// Cooled wares: locked gate to the rear/side of the shop.
pathStrip(district, [7.6, -1.0], [3.0, -0.35], 1.1, M.blue);
pathStrip(district, [3.0, -0.35], [3.0, 2.7], 1.1, M.blue);
pathStrip(district, [3.0, 2.7], [5.7, 2.7], 1.1, M.blue);
dashedPath(district, [[7.6, -1.0], [3.0, -0.35], [3.0, 2.7], [5.8, 2.7]], M.cream);
arrow(district, 3.0, 1.1, Math.PI / 2, M.blue);
// Public street remains physically separate from all service routes.
dashedPath(district, [[-14.8, 9.65], [10.5, 9.65]], M.blue, 0.8, 0.46, 0.16);
pathStrip(district, [10.5, 9.65], [10.5, 7.8], 1.25, M.stoneLight);
dashedPath(district, [[10.5, 9.6], [10.5, 7.85]], M.blue, 0.55, 0.32, 0.16);
arrow(district, 7.8, 9.65, 0, M.blue);
// Low separators between the shop front and public street.
for (const x of [6.2, 7.3, 13.8, 15.0]) {
box(district, 0.32, 0.45, 0.32, x, 0.47, 7.65, M.stone);
}
// A handcart in the clay route.
const cart = group(district, -10.0, 0.26, 2.25);
box(cart, 2.4, 0.25, 1.15, 0, 0.55, 0, M.wood);
box(cart, 2.4, 0.55, 0.12, 0, 0.83, -0.52, M.woodLight);
box(cart, 0.12, 0.55, 1.15, -1.15, 0.83, 0, M.woodLight);
box(cart, 0.15, 0.45, 0.75, 1.55, 0.35, 0, M.timber);
box(cart, 0.45, 0.45, 0.7, -1.55, 0.28, 0, M.timber);
box(cart, 0.45, 0.45, 0.7, 1.55, 0.28, 0, M.timber);
box(cart, 1.45, 0.42, 0.9, -0.25, 0.88, 0, M.clay);
// ---------------------------------------------------------------------------
// Clickable zones and information card
// ---------------------------------------------------------------------------
const zoneInfo = {
prep: {
title: "Preparation Yard",
text: "Clay is dug, soaked, wedged, and dried here. The yard opens directly onto the workshop so prepared clay never needs to cross the public street."
},
workshop: {
title: "Potter's Workshop",
text: "Prepared clay is thrown, trimmed, and inspected. Greenware dries on shelves before being carried east to the communal firing yard."
},
firing: {
title: "Shared Firing Yard",
text: "Multiple potters share costly brick kilns. Greenware enters by the west gate, hot firing stays inside the enclosure, and cooled goods leave through a separate locked gate."
},
shop: {
title: "Public Shopfront",
text: "Finished vessels are delivered from the rear service path. Customers approach only from the street and cannot enter the hot-work yard."
}
};
const infoTitle = document.getElementById("infoTitle");
const infoText = document.getElementById("infoText");
const infoPanel = document.getElementById("info");
const accentColors = {
prep: "#bf8b42",
workshop: "#8b5d3e",
firing: "#a6503d",
shop: "#52788b"
};
function addHitbox(parent, zone, w, h, d, x, y, z) {
const hitMaterial = new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0.001,
depthWrite: false,
colorWrite: false
});
const mesh = new THREE.Mesh(unitBox, hitMaterial);
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.userData.zone = zone;
parent.add(mesh);
}
addHitbox(prep, "prep", 9.4, 5.2, 7.3, -12.8, 2.4, 5.3);
addHitbox(workshop, "workshop", 13.3, 4.8, 8.1, -5.0, 2.3, -3.2);
addHitbox(firing, "firing", 13.4, 5.6, 10.3, 10.1, 2.5, -6.0);
addHitbox(shop, "shop", 10.0, 5.0, 7.2, 10.5, 2.3, 4.0);
function showZone(zone) {
if (!zoneInfo[zone]) return;
infoTitle.textContent = zoneInfo[zone].title;
infoText.textContent = zoneInfo[zone].text;
infoPanel.style.borderLeftColor = accentColors[zone];
}
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
renderer.domElement.addEventListener("pointerdown", event => {
pointer.x = event.clientX / window.innerWidth * 2 - 1;
pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(scene.children, true);
for (const hit of hits) {
let obj = hit.object;
while (obj) {
if (obj.userData.zone) {
showZone(obj.userData.zone);
break;
}
obj = obj.parent;
}
if (obj) break;
}
});
// ---------------------------------------------------------------------------
// Direct camera controls — no external controls addon
// ---------------------------------------------------------------------------
let dragging = false;
let panning = false;
let lastX = 0;
let lastY = 0;
let pointerId = null;
renderer.domElement.addEventListener("contextmenu", event => event.preventDefault());
renderer.domElement.addEventListener("pointerdown", event => {
dragging = true;
panning = event.button === 2 || event.button === 1 || event.shiftKey;
lastX = event.clientX;
lastY = event.clientY;
pointerId = event.pointerId;
renderer.domElement.setPointerCapture(pointerId);
});
renderer.domElement.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
if (panning) {
const right = new THREE.Vector3();
const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
right.crossVectors(forward, camera.up).normalize();
forward.y = 0;
forward.normalize();
const scale = cameraState.radius * 0.0016;
cameraState.target.addScaledVector(right, -dx * scale);
cameraState.target.addScaledVector(forward, -dy * scale);
} else {
cameraState.yaw -= dx * 0.006;
cameraState.pitch = THREE.MathUtils.clamp(cameraState.pitch + dy * 0.005, 0.30, 1.35);
}
updateCamera();
});
function endDrag(event) {
dragging = false;
panning = false;
if (pointerId !== null && renderer.domElement.hasPointerCapture(pointerId)) {
renderer.domElement.releasePointerCapture(pointerId);
}
pointerId = null;
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener("wheel", event => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(cameraState.radius + event.deltaY * 0.025, 20, 68);
updateCamera();
}, { passive: false });
document.getElementById("zoomIn").addEventListener("click", () => {
cameraState.radius = Math.max(20, cameraState.radius - 3);
updateCamera();
});
document.getElementById("zoomOut").addEventListener("click", () => {
cameraState.radius = Math.min(68, cameraState.radius + 3);
updateCamera();
});
document.getElementById("reset").addEventListener("click", () => {
cameraState.target.set(0, 1.2, 0);
cameraState.radius = 43;
cameraState.yaw = 0.76;
cameraState.pitch = 0.72;
updateCamera();
});
window.addEventListener("resize", () => {
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.8));
updateCamera();
});
// ---------------------------------------------------------------------------
// Animation
// ---------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
const t = clock.getElapsedTime();
for (let i = 0; i < wheelGroups.length; i++) {
wheelGroups[i].rotation.y = t * (i % 2 === 0 ? 0.85 : -0.72);
}
for (let i = 0; i < fireGlows.length; i++) {
const flicker = 1 + Math.sin(t * 7.3 + i * 2.2) * 0.12 + Math.sin(t * 13.1 + i) * 0.06;
fireGlows[i].scale.y = 0.95 * flicker;
fireGlows[i].scale.x = 0.95 + Math.sin(t * 9 + i) * 0.07;
}
for (const puff of smokeParticles) {
const offset = puff.userData.offset;
const cycle = (t * 0.10 + offset) % 1;
puff.position.y = 7.45 + cycle * 5.3;
puff.position.x = Math.sin(t * 0.75 + offset * 8) * cycle * 0.9;
puff.position.z = Math.cos(t * 0.55 + offset * 6) * cycle * 0.45;
const scale = 0.45 + cycle * 1.35;
puff.scale.set(scale, scale, scale);
puff.material.opacity = 0.30 * (1 - cycle * 0.7);
}
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```