Prompt specification
Build or customize the Three.js 3D scene "Schedule batches through a shared kiln" 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: Schedule batches through a shared kiln
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/schedule-batches-through-a-shared-kiln-x2332
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing an early modern pottery district with shared kilns. Let users assign fictional workshop batches to one shared kiln with stated capacities. Show queues, drying readiness, and completed wares without assuming an exact historical production schedule. Low-poly.
Working Three.js Starter (schedule-batches-through-a-shared-kiln-x2332):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Common Kiln — Fictional Pottery District</title>
<style>
:root {
--ink: #302a24;
--muted: #73685b;
--paper: #f2ead7;
--paper-dark: #e6d9bd;
--line: rgba(65, 52, 39, 0.18);
--red: #a84f35;
--red-dark: #7c3828;
--green: #58705a;
--gold: #d29a45;
--shadow: 0 16px 50px rgba(55, 40, 25, 0.23);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
color: var(--ink);
background: #d7c5a5;
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button,
select {
font: inherit;
}
button {
cursor: pointer;
}
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
}
.masthead {
position: fixed;
z-index: 5;
top: 20px;
left: 22px;
max-width: min(520px, calc(100vw - 410px));
padding: 15px 18px 14px;
border: 1px solid rgba(255, 255, 255, 0.34);
border-radius: 14px;
background: rgba(44, 37, 29, 0.82);
color: #f8efd9;
box-shadow: var(--shadow);
backdrop-filter: blur(9px);
pointer-events: none;
}
.eyebrow {
margin-bottom: 5px;
color: #e5b86c;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.masthead h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(24px, 3vw, 37px);
font-weight: 500;
line-height: 1;
}
.masthead p {
margin: 8px 0 0;
color: rgba(248, 239, 217, 0.74);
font-size: 12px;
line-height: 1.45;
}
.panel {
position: fixed;
z-index: 10;
top: 18px;
right: 18px;
bottom: 18px;
width: 356px;
overflow: auto;
padding: 18px;
border: 1px solid rgba(255, 255, 255, 0.58);
border-radius: 16px;
background: rgba(246, 239, 222, 0.95);
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
scrollbar-width: thin;
scrollbar-color: #bcae91 transparent;
}
.panel-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 13px;
}
.panel h2 {
margin: 2px 0 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 24px;
font-weight: 500;
}
.model-tag {
padding: 5px 8px;
border-radius: 999px;
background: #ded0b2;
color: #655746;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
}
.notice {
margin: 0 0 15px;
padding: 10px 11px;
border-left: 3px solid var(--gold);
border-radius: 3px 8px 8px 3px;
background: rgba(210, 154, 69, 0.11);
color: #665744;
font-size: 11px;
line-height: 1.48;
}
.section {
margin-top: 15px;
padding-top: 14px;
border-top: 1px solid var(--line);
}
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
font-size: 11px;
font-weight: 850;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.section-title span:last-child {
color: var(--muted);
font-size: 10px;
font-weight: 650;
letter-spacing: 0;
text-transform: none;
}
.capacity-card {
padding: 12px;
border: 1px solid var(--line);
border-radius: 10px;
background: rgba(255, 255, 255, 0.28);
}
.capacity-row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
}
.capacity-row strong {
font-family: Georgia, "Times New Roman", serif;
font-size: 23px;
font-weight: 500;
}
.capacity-row strong small {
color: var(--muted);
font-family: inherit;
font-size: 13px;
}
.capacity-track {
height: 8px;
overflow: hidden;
border-radius: 99px;
background: #d8cbb0;
}
.capacity-fill {
width: 0;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #9a4934, #d0754c);
transition: width 220ms ease;
}
.capacity-note {
margin: 8px 0 0;
color: var(--muted);
font-size: 10px;
line-height: 1.45;
}
.workshop-capacities {
display: grid;
gap: 5px;
margin-top: 9px;
color: var(--muted);
font-size: 10px;
}
.workshop-capacities div {
display: flex;
justify-content: space-between;
gap: 10px;
}
label {
display: block;
margin-bottom: 6px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
select {
width: 100%;
min-height: 39px;
padding: 8px 30px 8px 10px;
border: 1px solid #cbbc9f;
border-radius: 8px;
background: #fffaf0;
color: var(--ink);
font-size: 12px;
outline: none;
}
select:focus {
border-color: var(--red);
box-shadow: 0 0 0 3px rgba(168, 79, 53, 0.1);
}
.primary,
.secondary,
.mini-button {
border-radius: 8px;
font-weight: 750;
transition:
transform 120ms ease,
background 120ms ease,
opacity 120ms ease;
}
.primary:active,
.secondary:active,
.mini-button:active {
transform: translateY(1px);
}
.primary {
width: 100%;
margin-top: 8px;
padding: 10px 12px;
border: 1px solid var(--red-dark);
background: var(--red);
color: #fff7e8;
font-size: 12px;
}
.primary:hover:not(:disabled) {
background: #b95a3d;
}
.primary:disabled {
cursor: not-allowed;
opacity: 0.45;
}
.secondary {
padding: 9px 11px;
border: 1px solid #c9b99b;
background: #eadfc7;
color: #4c4237;
font-size: 11px;
}
.secondary:hover:not(:disabled) {
background: #dfd0b2;
}
.secondary:disabled {
cursor: not-allowed;
opacity: 0.42;
}
.batch-list {
display: grid;
gap: 8px;
}
.batch {
padding: 10px;
border: 1px solid var(--line);
border-radius: 9px;
background: rgba(255, 255, 255, 0.27);
}
.batch.selected {
border-color: rgba(168, 79, 53, 0.62);
box-shadow: inset 3px 0 0 var(--red);
background: rgba(255, 255, 255, 0.48);
}
.batch-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
}
.batch-name {
margin-bottom: 2px;
font-size: 12px;
font-weight: 800;
}
.batch-meta {
color: var(--muted);
font-size: 10px;
line-height: 1.35;
}
.status {
flex: 0 0 auto;
padding: 4px 6px;
border-radius: 999px;
font-size: 8px;
font-weight: 850;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.status.drying {
background: #e7d6ad;
color: #765c2d;
}
.status.ready {
background: #cbd7c2;
color: #425d45;
}
.status.queued {
background: #e4b89f;
color: #713923;
}
.status.completed {
background: #c9c0b4;
color: #4e4942;
}
.batch-bottom {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-top: 8px;
}
.readiness {
flex: 1;
}
.readiness-label {
display: flex;
justify-content: space-between;
margin-bottom: 4px;
color: var(--muted);
font-size: 9px;
}
.readiness-track {
height: 5px;
overflow: hidden;
border-radius: 99px;
background: #ded2ba;
}
.readiness-fill {
height: 100%;
border-radius: inherit;
background: #788b68;
transition: width 180ms ease;
}
.mini-button {
padding: 6px 8px;
border: 1px solid #c9b99b;
background: #f8f0df;
color: #57493b;
font-size: 9px;
}
.mini-button:hover {
background: #eadfc7;
}
.queue-list,
.completed-list {
display: grid;
gap: 7px;
}
.queue-item,
.completed-item {
display: flex;
align-items: center;
gap: 10px;
padding: 9px 10px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.3);
}
.queue-number {
display: grid;
width: 25px;
height: 25px;
place-items: center;
flex: 0 0 auto;
border-radius: 50%;
background: var(--red);
color: white;
font-family: Georgia, "Times New Roman", serif;
font-size: 13px;
}
.item-copy {
min-width: 0;
flex: 1;
}
.item-copy strong {
display: block;
overflow: hidden;
font-size: 11px;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-copy span {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 9px;
}
.empty {
padding: 13px;
border: 1px dashed #c8b99d;
border-radius: 8px;
color: var(--muted);
font-size: 10px;
line-height: 1.45;
text-align: center;
}
.button-row {
display: grid;
grid-template-columns: 1fr auto;
gap: 8px;
margin-top: 10px;
}
.message {
min-height: 31px;
margin: 10px 0 0;
padding: 7px 9px;
border-radius: 7px;
background: rgba(88, 112, 90, 0.1);
color: #4e624f;
font-size: 10px;
line-height: 1.4;
}
.message.warn {
background: rgba(168, 79, 53, 0.1);
color: #793e2d;
}
.controls-hint {
position: fixed;
z-index: 4;
bottom: 18px;
left: 20px;
padding: 9px 12px;
border: 1px solid rgba(255, 255, 255, 0.35);
border-radius: 9px;
background: rgba(44, 37, 29, 0.73);
color: rgba(248, 239, 217, 0.78);
font-size: 10px;
line-height: 1.45;
pointer-events: none;
backdrop-filter: blur(7px);
}
.controls-hint strong {
color: #f6d28e;
}
@media (max-width: 780px) {
.masthead {
top: 10px;
left: 10px;
max-width: calc(100vw - 20px);
padding: 11px 13px;
}
.masthead p {
display: none;
}
.panel {
top: auto;
right: 10px;
bottom: 10px;
left: 10px;
width: auto;
max-height: 51vh;
padding: 14px;
}
.controls-hint {
display: none;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive low-poly pottery district"></canvas>
<header class="masthead">
<div class="eyebrow">Fictional production-planning sketch</div>
<h1>The Common Kiln</h1>
<p>
An early-modern-inspired pottery quarter organized around one shared kiln.
Assign workshop batches, inspect drying readiness, and complete illustrative firings.
</p>
</header>
<aside class="panel">
<div class="panel-header">
<div>
<div class="eyebrow">Shared-fire model</div>
<h2>Kiln ledger</h2>
</div>
<div class="model-tag">Planning only</div>
</div>
<p class="notice">
This is an invented district and bookkeeping exercise. Readiness percentages
are relative states chosen by the user; they do not imply an exact historical
production schedule, firing duration, or labor calendar.
</p>
<section>
<div class="section-title">
<span>One shared kiln</span>
<span id="kilnState">Empty</span>
</div>
<div class="capacity-card">
<div class="capacity-row">
<strong id="capacityText">0 / 12 <small>slots</small></strong>
<span class="status ready" id="remainingText">12 remaining</span>
</div>
<div class="capacity-track">
<div class="capacity-fill" id="capacityFill"></div>
</div>
<p class="capacity-note">
Each finished vessel occupies one slot. A whole batch must fit in the
remaining capacity before it can join the kiln queue.
</p>
<div class="workshop-capacities">
<div><span>Marl & Mettle</span><strong>8-piece drying rack</strong></div>
<div><span>The Copper Pot</span><strong>6-piece drying rack</strong></div>
<div><span>Dyehouse Clay</span><strong>8-piece drying rack</strong></div>
</div>
</div>
</section>
<section>
<div class="section-title">
<span>Assign a batch</span>
<span id="selectedLabel">Selected: Tinted jugs</span>
</div>
<label for="batchSelect">Fictional workshop batch</label>
<select id="batchSelect"></select>
<button class="primary" id="assignButton">Assign to shared kiln</button>
<div class="message" id="message">
Choose a batch that is ready, then add it to the common kiln queue.
</div>
</section>
<section>
<div class="section-title">
<span>Drying & readiness</span>
<span>Relative state</span>
</div>
<div class="batch-list" id="batchList"></div>
</section>
<section>
<div class="section-title">
<span>Shared kiln queue</span>
<span id="queueCount">0 batches</span>
</div>
<div class="queue-list" id="queueList"></div>
<div class="button-row">
<button class="secondary" id="fireButton">Complete next firing</button>
<button class="secondary" id="resetButton">Reset</button>
</div>
</section>
<section>
<div class="section-title">
<span>Completed wares</span>
<span id="completedCount">0 pieces</span>
</div>
<div class="completed-list" id="completedList"></div>
</section>
</aside>
<div class="controls-hint">
<strong>Camera:</strong> drag to orbit · right-drag to pan · scroll to zoom ·
double-click to reset
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// State: all names, batches, capacities, and progress values are fictional.
// -------------------------------------------------------------------------
const KILN_CAPACITY = 12;
const initialBatches = [
{
id: "b1",
workshop: "Marl & Mettle",
ware: "Ash-glazed bowls",
pieces: 4,
drying: 68,
status: "drying",
shape: "bowl"
},
{
id: "b2",
workshop: "The Copper Pot",
ware: "Tinted jugs",
pieces: 3,
drying: 100,
status: "ready",
shape: "jug"
},
{
id: "b3",
workshop: "Dyehouse Clay",
ware: "Red pitchers",
pieces: 5,
drying: 42,
status: "drying",
shape: "jug"
},
{
id: "b4",
workshop: "Dyehouse Clay",
ware: "Small cups",
pieces: 2,
drying: 100,
status: "ready",
shape: "cup"
},
{
id: "b5",
workshop: "Marl & Mettle",
ware: "Wide bowls",
pieces: 4,
drying: 100,
status: "ready",
shape: "bowl"
},
{
id: "b6",
workshop: "The Copper Pot",
ware: "Salt jars",
pieces: 3,
drying: 31,
status: "drying",
shape: "jar"
},
{
id: "c0",
workshop: "The Copper Pot",
ware: "Blue jars",
pieces: 3,
drying: 100,
status: "completed",
shape: "jar"
}
];
const state = {
batches: initialBatches.map(batch => ({ ...batch })),
queue: [],
completed: ["c0"],
selected: "b2"
};
const statusNames = {
drying: "Drying",
ready: "Ready",
queued: "Queued",
completed: "Completed"
};
const workshopColors = {
"Marl & Mettle": 0xb56b48,
"The Copper Pot": 0x8f4a37,
"Dyehouse Clay": 0xa14f3d
};
const batchSelect = document.querySelector("#batchSelect");
const batchList = document.querySelector("#batchList");
const queueList = document.querySelector("#queueList");
const completedList = document.querySelector("#completedList");
const message = document.querySelector("#message");
const assignButton = document.querySelector("#assignButton");
const fireButton = document.querySelector("#fireButton");
// -------------------------------------------------------------------------
// Three.js setup
// -------------------------------------------------------------------------
const canvas = document.querySelector("#scene");
const renderer = new THREE.WebGLRenderer({
canvas,
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;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8c7a6);
scene.fog = new THREE.Fog(0xd8c7a6, 29, 60);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const hemisphere = new THREE.HemisphereLight(0xffeed1, 0x76614a, 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff0cf, 3.1);
sun.position.set(-10, 18, 12);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -24;
sun.shadow.camera.right = 24;
sun.shadow.camera.top = 24;
sun.shadow.camera.bottom = -24;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 50;
sun.shadow.bias = -0.00035;
scene.add(sun);
const material = (color, extra = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
flatShading: true,
...extra
});
function box(width, height, depth, color, x, y, z, parent = scene) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material(color)
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(
topRadius,
bottomRadius,
height,
segments,
color,
x,
y,
z,
parent = scene
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(topRadius, bottomRadius, height, segments),
material(color)
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeLabel(text, accent = "#e4b66e") {
const labelCanvas = document.createElement("canvas");
labelCanvas.width = 640;
labelCanvas.height = 128;
const ctx = labelCanvas.getContext("2d");
ctx.fillStyle = "rgba(45, 37, 29, 0.90)";
ctx.fillRect(0, 0, 640, 128);
ctx.fillStyle = accent;
ctx.fillRect(0, 0, 10, 128);
let size = 31;
ctx.font = `700 ${size}px system-ui, sans-serif`;
while (ctx.measureText(text).width > 595 && size > 17) {
size -= 1;
ctx.font = `700 ${size}px system-ui, sans-serif`;
}
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = "#fff2d8";
ctx.fillText(text, 325, 66);
const texture = new THREE.CanvasTexture(labelCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthWrite: false
})
);
sprite.scale.set(5.4, 1.08, 1);
return sprite;
}
// -------------------------------------------------------------------------
// Direct orbit / pan / zoom controls. No Three.js examples are imported.
// -------------------------------------------------------------------------
const orbit = {
yaw: 0.66,
pitch: 0.58,
distance: 27,
target: new THREE.Vector3(0, 1.1, 0)
};
const homeOrbit = {
yaw: 0.66,
pitch: 0.58,
distance: 27,
target: new THREE.Vector3(0, 1.1, 0)
};
function updateCamera() {
const horizontal = Math.cos(orbit.pitch) * orbit.distance;
camera.position.set(
orbit.target.x + Math.sin(orbit.yaw) * horizontal,
orbit.target.y + Math.sin(orbit.pitch) * orbit.distance,
orbit.target.z + Math.cos(orbit.yaw) * horizontal
);
camera.lookAt(orbit.target);
}
let drag = null;
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("pointerdown", event => {
canvas.setPointerCapture(event.pointerId);
drag = {
id: event.pointerId,
x: event.clientX,
y: event.clientY,
button: event.button
};
});
canvas.addEventListener("pointermove", event => {
if (!drag || drag.id !== event.pointerId) return;
const dx = event.clientX - drag.x;
const dy = event.clientY - drag.y;
if (drag.button === 2) {
orbit.target.x -= dx * 0.025;
orbit.target.z -= dy * 0.025;
orbit.target.x = THREE.MathUtils.clamp(orbit.target.x, -15, 15);
orbit.target.z = THREE.MathUtils.clamp(orbit.target.z, -15, 15);
} else {
orbit.yaw -= dx * 0.006;
orbit.pitch = THREE.MathUtils.clamp(
orbit.pitch + dy * 0.004,
0.2,
1.15
);
}
drag.x = event.clientX;
drag.y = event.clientY;
updateCamera();
});
function endDrag(event) {
if (drag && drag.id === event.pointerId) drag = null;
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
orbit.distance = THREE.MathUtils.clamp(
orbit.distance + event.deltaY * 0.018,
12,
44
);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
orbit.yaw = homeOrbit.yaw;
orbit.pitch = homeOrbit.pitch;
orbit.distance = homeOrbit.distance;
orbit.target.copy(homeOrbit.target);
updateCamera();
});
updateCamera();
// -------------------------------------------------------------------------
// District construction
// -------------------------------------------------------------------------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(54, 46),
material(0xa99a72)
);
ground.rotation.x = -Math.PI / 2;
ground.receiveShadow = true;
scene.add(ground);
// Roads and central plaza.
box(43, 0.08, 4.2, 0x7e6b52, 0, 0.03, 1.2);
box(4.2, 0.09, 35, 0x7e6b52, 0, 0.035, 0);
cylinder(6.5, 6.5, 0.13, 16, 0x9b8968, 0, 0.055, 0);
// Irregular paving in the center.
let seed = 731;
function random() {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
}
for (let i = 0; i < 75; i++) {
const angle = random() * Math.PI * 2;
const radius = Math.sqrt(random()) * 5.8;
const stone = box(
0.35 + random() * 0.45,
0.035,
0.28 + random() * 0.4,
random() > 0.5 ? 0xaa9a7a : 0x8e7d60,
Math.cos(angle) * radius,
0.14,
Math.sin(angle) * radius
);
stone.rotation.y = random() * Math.PI;
}
function makeBuilding(x, z, width, depth, wallColor, roofColor, title, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
scene.add(group);
box(width, 2.65, depth, wallColor, 0, 1.33, 0, group);
const roof = new THREE.Mesh(
new THREE.ConeGeometry(1, 1, 4),
material(roofColor)
);
roof.rotation.y = Math.PI / 4;
roof.scale.set(width * 0.78, 1.65, depth * 0.82);
roof.position.y = 3.45;
roof.castShadow = true;
roof.receiveShadow = true;
group.add(roof);
box(0.58, 1.7, 0.10, 0x4a3728, 0, 0.85, depth / 2 + 0.055, group);
box(0.75, 0.10, 0.13, 0x6d5138, 0, 1.66, depth / 2 + 0.08, group);
box(0.72, 0.63, 0.08, 0x3f4d45, -width * 0.28, 1.65, depth / 2 + 0.06, group);
box(0.72, 0.63, 0.08, 0x3f4d45, width * 0.28, 1.65, depth / 2 + 0.06, group);
box(0.09, 0.66, 0.10, 0x6a5138, -width * 0.28, 1.65, depth / 2 + 0.11, group);
box(0.09, 0.66, 0.10, 0x6a5138, width * 0.28, 1.65, depth / 2 + 0.11, group);
box(0.74, 0.09, 0.10, 0x6a5138, -width * 0.28, 1.65, depth / 2 + 0.11, group);
box(0.74, 0.09, 0.10, 0x6a5138, width * 0.28, 1.65, depth / 2 + 0.11, group);
box(0.52, 1.9, 0.54, 0x75604c, width * 0.28, 3.72, -depth * 0.18, group);
const sign = makeLabel(title);
sign.position.set(0, 4.65, 0);
group.add(sign);
// Timber framing.
box(0.12, 2.67, 0.13, 0x624a35, -width / 2 + 0.08, 1.33, depth / 2 + 0.08, group);
box(0.12, 2.67, 0.13, 0x624a35, width / 2 - 0.08, 1.33, depth / 2 + 0.08, group);
box(width, 0.12, 0.13, 0x624a35, 0, 2.58, depth / 2 + 0.08, group);
return group;
}
makeBuilding(-8.2, -5.8, 4.6, 3.5, 0xc1aa78, 0x744a35, "MARL & METTLE", 0.05);
makeBuilding(8.3, -5.8, 4.5, 3.4, 0xb99769, 0x654634, "THE COPPER POT", -0.08);
makeBuilding(-8.4, 7.4, 4.6, 3.4, 0xc6a36f, 0x7b4532, "DYehOUSE CLAY", 0.02);
// Shared kiln.
const kiln = new THREE.Group();
scene.add(kiln);
cylinder(2.45, 2.85, 3.35, 10, 0x9a5038, 0, 1.68, 0, kiln);
cylinder(0.52, 2.62, 1.12, 10, 0x78412f, 0, 3.88, 0, kiln);
cylinder(0.39, 0.52, 2.55, 8, 0x704735, 1.25, 4.85, -0.55, kiln);
const bandMaterial = material(0x5f3c2c);
for (const height of [0.65, 2.64]) {
const band = new THREE.Mesh(
new THREE.TorusGeometry(2.61, 0.095, 5, 10),
bandMaterial
);
band.rotation.x = Math.PI / 2;
band.position.y = height;
band.castShadow = true;
kiln.add(band);
}
const kilnMouth = new THREE.Mesh(
new THREE.CircleGeometry(0.84, 10),
new THREE.MeshBasicMaterial({ color: 0x24150f })
);
kilnMouth.position.set(0, 1.22, 2.56);
kiln.add(kilnMouth);
const kilnGlow = new THREE.Mesh(
new THREE.CircleGeometry(0.69, 10),
new THREE.MeshBasicMaterial({
color: 0xff8a32,
transparent: true,
opacity: 0.92
})
);
kilnGlow.position.set(0, 1.19, 2.59);
kiln.add(kilnGlow);
const kilnSign = makeLabel("COMMON KILN · 12 SLOTS", "#e89a51");
kilnSign.position.set(0, 6.0, 0);
kiln.add(kilnSign);
// Twelve load markers, filled in queue order.
const loadSlots = new THREE.Group();
loadSlots.position.set(0, 0, 5.6);
scene.add(loadSlots);
const slotMeshes = [];
for (let i = 0; i < KILN_CAPACITY; i++) {
const col = i % 6;
const row = Math.floor(i / 6);
const slot = box(
0.55,
0.10,
0.55,
0x75634a,
-2.55 + col * 1.02,
0.18,
row * 0.9,
loadSlots
);
slotMeshes.push(slot);
}
// Wooden queue pallet.
box(6.1, 0.17, 1.7, 0x705137, 0, 0.20, 3.75);
for (let i = 0; i < 5; i++) {
box(1.05, 0.07, 1.45, 0x856342, -2.35 + i * 1.18, 0.32, 3.75);
}
// Drying racks.
function makeRack(x, z) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
box(0.18, 2.55, 0.18, 0x60472f, -1.55, 1.28, 0, group);
box(0.18, 2.55, 0.18, 0x60472f, 1.55, 1.28, 0, group);
for (const height of [0.35, 1.28, 2.18]) {
box(3.35, 0.12, 1.38, 0x8a6b45, 0, height, 0, group);
}
box(3.5, 0.14, 0.14, 0x705237, 0, 2.52, -0.55, group);
const items = new THREE.Group();
group.add(items);
return { group, items };
}
const racks = {
"Marl & Mettle": makeRack(-5.45, -4.9),
"The Copper Pot": makeRack(5.45, -4.9),
"Dyehouse Clay": makeRack(-5.45, 6.65)
};
// Finished wares display shelf.
const finishedShelf = new THREE.Group();
finishedShelf.position.set(7.8, 0, 7.4);
scene.add(finishedShelf);
for (const x of [-1.45, 1.45]) {
box(0.15, 2.45, 0.15, 0x654a32, x, 1.23, -0.55, finishedShelf);
box(0.15, 2.45, 0.15, 0x654a32, x, 1.23, 0.55, finishedShelf);
}
for (const y of [0.35, 1.25, 2.15]) {
box(3.25, 0.13, 1.45, 0x8b6b43, 0, y, 0, finishedShelf);
}
const finishedItems = new THREE.Group();
finishedShelf.add(finishedItems);
const finishedSign = makeLabel("FINISHED WARES", "#829c73");
finishedSign.position.set(0, 3.45, 0);
finishedShelf.add(finishedSign);
// Decorative district objects.
function makeTree(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
scene.add(group);
cylinder(0.16, 0.23, 1.4, 7, 0x66503a, 0, 0.7, 0, group);
cylinder(0, 0.95, 1.75, 7, 0x586c45, 0, 1.9, 0, group);
cylinder(0, 0.72, 1.45, 7, 0x667a4f, 0, 2.65, 0, group);
}
makeTree(11.5, 4.3, 1.15);
makeTree(-12.8, 2.2, 0.95);
makeTree(12.0, -9.6, 1.0);
makeTree(-13.2, -9.8, 1.15);
function makeBarrel(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
scene.add(group);
cylinder(0.34, 0.42, 0.85, 9, 0x795538, 0, 0.43, 0, group);
const barrelBand = material(0x3e3830);
for (const y of [0.18, 0.68]) {
const band = new THREE.Mesh(
new THREE.TorusGeometry(0.38, 0.035, 4, 9),
barrelBand
);
band.rotation.x = Math.PI / 2;
band.position.y = y;
group.add(band);
}
}
makeBarrel(-3.6, -7.4, 1);
makeBarrel(-2.9, -7.6, 0.8);
makeBarrel(3.6, -7.3, 0.9);
makeBarrel(10.3, 1.0, 1.05);
function makeCrate(x, z, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 0.2, z);
group.rotation.y = rotation;
scene.add(group);
box(1.45, 0.12, 1.05, 0x8a6941, 0, 0, 0, group);
box(1.45, 0.12, 0.12, 0x765638, 0, 0.48, -0.48, group);
box(1.45, 0.12, 0.12, 0x765638, 0, 0.48, 0.48, group);
box(0.12, 0.62, 1.0, 0x765638, -0.67, 0.28, 0, group);
box(0.12, 0.62, 1.0, 0x765638, 0.67, 0.28, 0, group);
}
makeCrate(10.6, -2.4, -0.25);
makeCrate(-10.5, 0.3, 0.2);
makeCrate(4.2, 9.0, 0.5);
// A small water channel gives the district a clearer street edge.
box(2.2, 0.08, 33, 0x6b8e8b, 13.7, 0.02, 0);
box(2.45, 0.18, 0.35, 0x79684e, 12.5, 0.08, 0);
box(2.45, 0.18, 0.35, 0x79684e, 14.9, 0.08, 0);
// -------------------------------------------------------------------------
// Low-poly pottery
// -------------------------------------------------------------------------
function makePot(color, shape = "jar", scale = 1) {
const group = new THREE.Group();
group.scale.setScalar(scale);
const clay = material(color);
let height = 0.54;
let topRadius = 0.23;
let bottomRadius = 0.29;
if (shape === "bowl") {
height = 0.34;
topRadius = 0.38;
bottomRadius = 0.23;
} else if (shape === "cup") {
height = 0.38;
topRadius = 0.24;
bottomRadius = 0.19;
} else if (shape === "jug") {
height = 0.66;
topRadius = 0.18;
bottomRadius = 0.30;
}
const body = new THREE.Mesh(
new THREE.CylinderGeometry(topRadius, bottomRadius, height, 8),
clay
);
body.position.y = height / 2;
body.castShadow = true;
body.receiveShadow = true;
group.add(body);
if (shape === "jug") {
const neck = new THREE.Mesh(
new THREE.CylinderGeometry(0.13, 0.18, 0.22, 8),
clay
);
neck.position.y = height + 0.07;
neck.castShadow = true;
group.add(neck);
const handle = new THREE.Mesh(
new THREE.TorusGeometry(0.14, 0.035, 5, 8, Math.PI * 1.25),
clay
);
handle.position.set(0.2, height * 0.64, 0);
handle.rotation.z = -0.55;
handle.castShadow = true;
group.add(handle);
}
const rim = new THREE.Mesh(
new THREE.TorusGeometry(topRadius, 0.025, 4, 8),
material(new THREE.Color(color).multiplyScalar(0.82))
);
rim.rotation.x = Math.PI / 2;
rim.position.y = height;
group.add(rim);
const foot = new THREE.Mesh(
new THREE.CylinderGeometry(bottomRadius * 0.68, bottomRadius * 0.72, 0.06, 8),
material(new THREE.Color(color).multiplyScalar(0.76))
);
foot.position.y = 0.03;
group.add(foot);
return group;
}
function makeBatchCluster(batch, statusOverride = null) {
const group = new THREE.Group();
const status = statusOverride || batch.status;
const color =
status === "ready"
? 0xc68848
: status === "queued"
? 0xb95f3e
: status === "completed"
? 0x7c4c4b
: workshopColors[batch.workshop];
const visibleCount = Math.min(batch.pieces, 4);
const potScale = batch.shape === "cup" ? 0.72 : 0.78;
for (let i = 0; i < visibleCount; i++) {
const pot = makePot(color, batch.shape, potScale);
pot.position.set(
(i - (visibleCount - 1) / 2) * 0.52,
0,
(i % 2) * 0.14 - 0.07
);
group.add(pot);
}
return group;
}
function clearGroup(group) {
while (group.children.length) {
const child = group.children.pop();
child.traverse(object => {
if (object.geometry) object.geometry.dispose();
if (object.material) {
const materials = Array.isArray(object.material)
? object.material
: [object.material];
materials.forEach(mat => mat.dispose());
}
});
}
}
// Selection halo.
const selectionHalo = new THREE.Mesh(
new THREE.TorusGeometry(0.85, 0.045, 6, 24),
new THREE.MeshBasicMaterial({
color: 0xffdc7c,
transparent: true,
opacity: 0.95,
depthTest: false
})
);
selectionHalo.rotation.x = -Math.PI / 2;
selectionHalo.renderOrder = 20;
scene.add(selectionHalo);
// -------------------------------------------------------------------------
// Scene state rendering
// -------------------------------------------------------------------------
function queueLoad() {
return state.queue.reduce((sum, id) => {
const batch = state.batches.find(item => item.id === id);
return sum + batch.pieces;
}, 0);
}
function refreshScene() {
// Drying racks show only drying and ready batches.
for (const rack of Object.values(racks)) {
clearGroup(rack.items);
}
for (const workshop of Object.keys(racks)) {
const workshopBatches = state.batches.filter(
batch =>
batch.workshop === workshop &&
(batch.status === "drying" || batch.status === "ready")
);
workshopBatches.forEach((batch, index) => {
const cluster = makeBatchCluster(batch);
cluster.position.set(
index % 2 === 0 ? -0.45 : 0.48,
index < 2 ? 0.44 : 1.38,
0
);
racks[workshop].items.add(cluster);
});
}
// Kiln queue.
clearGroup(finishedItems);
const queueItems = new THREE.Group();
scene.add(queueItems);
// Reuse a stable queue group by finding the previous one.
const oldQueue = scene.getObjectByName("queue-items");
if (oldQueue) {
clearGroup(oldQueue);
scene.remove(oldQueue);
}
queueItems.name = "queue-items";
state.queue.forEach((id, index) => {
const batch = state.batches.find(item => item.id === id);
const cluster = makeBatchCluster(batch, "queued");
cluster.position.set(
-1.8 + index * 1.45,
0.38,
index * 0.55
);
cluster.scale.setScalar(0.9);
queueItems.add(cluster);
});
// Completed wares.
clearGroup(finishedItems);
state.completed.forEach((id, index) => {
const batch = state.batches.find(item => item.id === id);
if (!batch) return;
const cluster = makeBatchCluster(batch, "completed");
cluster.position.set(
index % 2 === 0 ? -0.65 : 0.65,
0.44 + Math.floor(index / 2) * 0.9,
index % 2 === 0 ? -0.18 : 0.18
);
cluster.scale.setScalar(0.88);
finishedItems.add(cluster);
});
// Capacity markers.
const used = queueLoad();
slotMeshes.forEach((slot, index) => {
slot.material.color.setHex(index < used ? 0xc46b43 : 0x75634a);
slot.position.y = index < used ? 0.22 : 0.18;
});
// Selected-batch halo.
const selected = state.batches.find(batch => batch.id === state.selected);
if (selected) {
if (racks[selected.workshop] && ["drying", "ready"].includes(selected.status)) {
const position = new THREE.Vector3();
racks[selected.workshop].group.getWorldPosition(position);
selectionHalo.position.set(position.x, 0.17, position.z + 1.08);
} else if (selected.status === "queued") {
selectionHalo.position.set(0, 0.28, 3.8);
} else {
const position = new THREE.Vector3();
finishedShelf.getWorldPosition(position);
selectionHalo.position.set(position.x, 0.18, position.z + 0.9);
}
}
}
// -------------------------------------------------------------------------
// Interface rendering and interactions
// -------------------------------------------------------------------------
function setMessage(text, warning = false) {
message.textContent = text;
message.classList.toggle("warn", warning);
}
function render() {
const used = queueLoad();
const remaining = KILN_CAPACITY - used;
const selected = state.batches.find(batch => batch.id === state.selected);
document.querySelector("#capacityText").innerHTML =
`${used} / ${KILN_CAPACITY} <small>slots</small>`;
document.querySelector("#remainingText").textContent =
`${remaining} remaining`;
document.querySelector("#capacityFill").style.width =
`${(used / KILN_CAPACITY) * 100}%`;
document.querySelector("#kilnState").textContent =
used === 0 ? "Empty" : `${state.queue.length} batch${state.queue.length === 1 ? "" : "es"} waiting`;
document.querySelector("#queueCount").textContent =
`${state.queue.length} batch${state.queue.length === 1 ? "" : "es"}`;
batchSelect.innerHTML = state.batches
.map(batch => {
const disabled = ["queued", "completed"].includes(batch.status)
? "disabled"
: "";
return `
<option value="${batch.id}" ${disabled}>
${batch.workshop} — ${batch.ware} (${batch.pieces} pieces)
</option>
`;
})
.join("");
batchSelect.value = state.selected;
document.querySelector("#selectedLabel").textContent = selected
? `Selected: ${selected.ware}`
: "No batch selected";
assignButton.disabled = !selected || selected.status !== "ready";
assignButton.textContent =
selected && selected.status === "ready"
? "Assign to shared kiln"
: "Select a ready batch";
batchList.innerHTML = state.batches
.map(batch => {
const selectedClass = batch.id === state.selected ? "selected" : "";
const canMarkReady = batch.status === "drying";
const capacityNote =
batch.workshop === "The Copper Pot"
? "6-piece rack"
: "8-piece rack";
return `
<div class="batch ${selectedClass}">
<div class="batch-top">
<div>
<div class="batch-name">${batch.ware}</div>
<div class="batch-meta">
${batch.workshop} · ${batch.pieces} pieces · ${capacityNote}
</div>
</div>
<span class="status ${batch.status}">
${statusNames[batch.status]}
</span>
</div>
<div class="batch-bottom">
<div class="readiness">
<div class="readiness-label">
<span>Illustrative readiness</span>
<span>${batch.drying}%</span>
</div>
<div class="readiness-track">
<div
class="readiness-fill"
style="width: ${batch.drying}%"
></div>
</div>
</div>
${
canMarkReady
? `<button class="mini-button" data-ready="${batch.id}">Mark ready</button>`
: `<button class="mini-button" data-select="${batch.id}">Select</button>`
}
</div>
</div>
`;
})
.join("");
queueList.innerHTML = state.queue.length
? state.queue
.map((id, index) => {
const batch = state.batches.find(item => item.id === id);
return `
<div class="queue-item">
<div class="queue-number">${index + 1}</div>
<div class="item-copy">
<strong>${batch.ware}</strong>
<span>${batch.workshop} · ${batch.pieces} pieces</span>
</div>
<span class="status queued">FIFO</span>
</div>
`;
})
.join("")
: `<div class="empty">The shared kiln is empty. Assign a ready batch to begin the queue.</div>`;
fireButton.disabled = state.queue.length === 0;
const completedBatches = state.batches.filter(
batch => batch.status === "completed"
);
const completedPieces = completedBatches.reduce(
(sum, batch) => sum + batch.pieces,
0
);
document.querySelector("#completedCount").textContent =
`${completedPieces} pieces`;
completedList.innerHTML = completedBatches.length
? completedBatches
.map(batch => `
<div class="completed-item">
<div class="queue-number" style="background:#687762">✓</div>
<div class="item-copy">
<strong>${batch.ware}</strong>
<span>${batch.workshop} · ${batch.pieces} pieces</span>
</div>
<span class="status completed">Shelf</span>
</div>
`)
.join("")
: `<div class="empty">No wares have been moved to the finished shelf.</div>`;
document.querySelectorAll("[data-select]").forEach(button => {
button.addEventListener("click", () => {
state.selected = button.dataset.select;
setMessage("Batch selected.");
render();
});
});
document.querySelectorAll("[data-ready]").forEach(button => {
button.addEventListener("click", () => {
const batch = state.batches.find(
item => item.id === button.dataset.ready
);
batch.status = "ready";
batch.drying = 100;
state.selected = batch.id;
setMessage(
`${batch.ware} is now marked ready. This is a relative planning state, not a dated schedule.`
);
render();
});
});
refreshScene();
}
batchSelect.addEventListener("change", () => {
state.selected = batchSelect.value;
setMessage("Batch selected.");
render();
});
assignButton.addEventListener("click", () => {
const batch = state.batches.find(item => item.id === state.selected);
if (!batch) return;
if (batch.status !== "ready") {
setMessage("Only a ready batch can join the shared kiln.", true);
return;
}
const remaining = KILN_CAPACITY - queueLoad();
if (batch.pieces > remaining) {
setMessage(
`${batch.ware} needs ${batch.pieces} slots, but only ${remaining} remain. Complete a queued firing first.`,
true
);
return;
}
state.queue.push(batch.id);
batch.status = "queued";
setMessage(
`${batch.ware} was added to the shared kiln queue. Its ${batch.pieces} slots are now reserved.`
);
render();
});
fireButton.addEventListener("click", () => {
if (!state.queue.length) {
setMessage("There is no batch waiting in the kiln.", true);
return;
}
const id = state.queue.shift();
const batch = state.batches.find(item => item.id === id);
batch.status = "completed";
if (!state.completed.includes(id)) {
state.completed.push(id);
}
setMessage(
`${batch.ware} was moved to the finished shelf as an illustrative planning action.`
);
render();
});
document.querySelector("#resetButton").addEventListener("click", () => {
state.batches = initialBatches.map(batch => ({ ...batch }));
state.queue = [];
state.completed = ["c0"];
state.selected = "b2";
setMessage("The fictional ledger and district displays have been reset.");
render();
});
render();
// -------------------------------------------------------------------------
// Animation and resizing
// -------------------------------------------------------------------------
function animate(time) {
const pulse = 1 + Math.sin(time * 0.003) * 0.045;
kilnGlow.scale.set(pulse, pulse, 1);
kilnGlow.material.opacity = 0.82 + Math.sin(time * 0.003) * 0.10;
selectionHalo.rotation.z = time * 0.0004;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
requestAnimationFrame(animate);
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", resize);
</script>
</body>
</html>
```