Prompt specification
Build or customize the Three.js 3D scene "Photography studio with lighting and plate handling" 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: Photography studio with lighting and plate handling
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/photography-studio-with-lighting-and-plate-handling-x2511
Scene Description Prompt:
Photography studio with lighting and plate handling. Build a referenced early studio with camera, backdrop, light source, and protected plate area. Separate image formation from the later development stage in the spatial layout. Please build this with Three.js from cdnjs in one self-contained HTML file, using visible voxel blocks.
Working Three.js Starter (photography-studio-with-lighting-and-plate-handling-x2511):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Early Plate Photography Studio</title>
<style>
:root {
--ink: #10171b;
--panel: rgba(14, 21, 25, 0.88);
--line: rgba(230, 219, 190, 0.18);
--cream: #eadfc6;
--muted: #a9aaa1;
--amber: #d9a24e;
--cyan: #69aeb0;
--red: #b74a4c;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #10171b;
color: var(--cream);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
canvas {
position: fixed;
inset: 0;
display: block;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 10;
background: var(--panel);
border: 1px solid var(--line);
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
#title-card {
top: 20px;
left: 20px;
width: min(430px, calc(100vw - 40px));
padding: 18px 20px 16px;
border-radius: 14px;
}
.eyebrow {
margin-bottom: 8px;
color: var(--amber);
font-size: 11px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(25px, 3vw, 37px);
font-weight: 500;
line-height: 1.05;
}
#title-card p {
margin: 10px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
#process-card {
top: 20px;
right: 20px;
width: min(320px, calc(100vw - 40px));
padding: 16px;
border-radius: 14px;
}
.process-title {
margin-bottom: 12px;
color: var(--muted);
font-size: 11px;
font-weight: 750;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.process-step {
display: grid;
grid-template-columns: 27px 1fr;
gap: 10px;
align-items: start;
margin: 0 0 12px;
}
.process-step:last-child {
margin-bottom: 0;
}
.step-number {
display: grid;
width: 27px;
height: 27px;
place-items: center;
border: 1px solid var(--line);
border-radius: 6px;
color: var(--cream);
font-size: 11px;
font-weight: 800;
}
.process-step strong {
display: block;
margin: 1px 0 3px;
font-size: 13px;
}
.process-step span {
display: block;
color: var(--muted);
font-size: 11px;
line-height: 1.45;
}
#view-buttons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 15px;
}
button {
min-height: 38px;
padding: 9px 11px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.035);
color: var(--cream);
font: inherit;
font-size: 11px;
font-weight: 700;
cursor: pointer;
transition:
border-color 160ms ease,
background 160ms ease,
transform 160ms ease;
}
button:hover {
border-color: rgba(234, 223, 198, 0.55);
background: rgba(255, 255, 255, 0.08);
transform: translateY(-1px);
}
button:focus-visible {
outline: 2px solid var(--amber);
outline-offset: 2px;
}
#overview-button {
grid-column: 1 / -1;
}
#legend {
left: 20px;
bottom: 20px;
padding: 12px 15px;
border-radius: 12px;
}
.legend-row {
display: flex;
gap: 15px;
align-items: center;
color: var(--muted);
font-size: 10px;
}
.legend-item {
display: flex;
gap: 6px;
align-items: center;
white-space: nowrap;
}
.swatch {
width: 9px;
height: 9px;
border-radius: 2px;
box-shadow: 0 0 8px currentColor;
}
#controls {
right: 20px;
bottom: 20px;
padding: 11px 12px;
border-radius: 12px;
color: var(--muted);
font-size: 10px;
line-height: 1.5;
}
#controls strong {
color: var(--cream);
font-weight: 650;
}
#zoom-buttons {
display: flex;
gap: 6px;
margin-top: 8px;
}
#zoom-buttons button {
min-height: 31px;
flex: 1;
padding: 5px 10px;
}
#status {
margin-bottom: 3px;
color: var(--amber);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.12em;
text-transform: uppercase;
}
@media (max-width: 760px) {
#process-card {
top: auto;
right: 12px;
bottom: 76px;
width: 235px;
}
#process-card .process-step {
display: none;
}
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
}
#title-card p {
display: none;
}
#legend {
left: 12px;
bottom: 12px;
}
#legend .legend-row {
gap: 8px;
}
#controls {
right: 12px;
bottom: 12px;
max-width: 190px;
}
#controls .desktop-help {
display: none;
}
}
</style>
</head>
<body>
<section id="title-card" class="panel">
<div class="eyebrow">Early photographic studio · protected-plate process</div>
<h1>Exposure &<br>Development</h1>
<p>
A voxel reconstruction of an early wet-plate studio. Image formation occurs
in the amber-lit camera area; the shielded plate is carried through the
light lock to the red-safelight development room.
</p>
</section>
<section id="process-card" class="panel">
<div class="process-title">Spatial workflow</div>
<div class="process-step">
<div class="step-number">01</div>
<div>
<strong>Form the image</strong>
<span>Backdrop, sitter, studio lamp, and plate camera occupy the formation zone.</span>
</div>
</div>
<div class="process-step">
<div class="step-number">02</div>
<div>
<strong>Protect the plate</strong>
<span>The removable plate holder and covered carrier remain shielded from stray light.</span>
</div>
</div>
<div class="process-step">
<div class="step-number">03</div>
<div>
<strong>Develop later</strong>
<span>Chemical trays, rinse sink, safelight, and drying rack are in a separate room.</span>
</div>
</div>
<div id="view-buttons">
<button type="button" data-view="formation">Formation zone</button>
<button type="button" data-view="development">Development zone</button>
<button type="button" data-view="overview" id="overview-button">View complete studio</button>
</div>
</section>
<section id="legend" class="panel">
<div class="legend-row">
<div class="legend-item">
<span class="swatch" style="color:#d9a24e;background:#d9a24e"></span>
Exposure area
</div>
<div class="legend-item">
<span class="swatch" style="color:#69aeb0;background:#69aeb0"></span>
Backdrop
</div>
<div class="legend-item">
<span class="swatch" style="color:#b74a4c;background:#b74a4c"></span>
Safelight
</div>
</div>
</section>
<section id="controls" class="panel">
<div id="status">Complete studio</div>
<div class="desktop-help">
<strong>Drag</strong> to orbit · <strong>Shift/right-drag</strong> to pan<br>
<strong>Wheel</strong> to zoom · <strong>1–3</strong> for views · <strong>L</strong> for labels
</div>
<div id="zoom-buttons">
<button type="button" id="zoom-in" aria-label="Zoom in">+</button>
<button type="button" id="zoom-out" aria-label="Zoom out">−</button>
<button type="button" id="labels-button">Labels</button>
</div>
</section>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer, scene, and lighting
// ------------------------------------------------------------
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.body.prepend(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x11191e);
scene.fog = new THREE.Fog(0x11191e, 30, 58);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const hemisphere = new THREE.HemisphereLight(0xc8dbe0, 0x382b24, 1.7);
scene.add(hemisphere);
const daylight = new THREE.DirectionalLight(0xffedd0, 3.0);
daylight.position.set(9, 15, 11);
daylight.castShadow = true;
daylight.shadow.mapSize.set(2048, 2048);
daylight.shadow.camera.left = -18;
daylight.shadow.camera.right = 18;
daylight.shadow.camera.top = 16;
daylight.shadow.camera.bottom = -14;
daylight.shadow.camera.near = 1;
daylight.shadow.camera.far = 45;
daylight.shadow.bias = -0.0008;
daylight.shadow.normalBias = 0.035;
scene.add(daylight);
const coolFill = new THREE.DirectionalLight(0x91bfd0, 1.0);
coolFill.position.set(-12, 8, -4);
scene.add(coolFill);
// ------------------------------------------------------------
// Block-building utilities
// ------------------------------------------------------------
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const materialCache = new Map();
function getMaterial(color, options = {}) {
const roughness = options.roughness ?? 0.82;
const metalness = options.metalness ?? 0;
const emissive = options.emissive ?? 0x000000;
const emissiveIntensity = options.emissiveIntensity ?? 0;
const transparent = options.transparent ?? false;
const opacity = options.opacity ?? 1;
const key = [
color,
roughness,
metalness,
emissive,
emissiveIntensity,
transparent,
opacity
].join("|");
if (!materialCache.has(key)) {
materialCache.set(
key,
new THREE.MeshStandardMaterial({
color,
roughness,
metalness,
emissive,
emissiveIntensity,
transparent,
opacity,
depthWrite: transparent ? false : true
})
);
}
return materialCache.get(key);
}
function block(
parent,
sx,
sy,
sz,
x,
y,
z,
color,
options = {}
) {
const material = options.material ||
(typeof color === "object" ? color : getMaterial(color, options));
const mesh = new THREE.Mesh(unitBox, material);
mesh.scale.set(sx, sy, sz);
mesh.position.set(x, y, z);
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
parent.add(mesh);
return mesh;
}
function beam(parent, start, end, thickness, color, options = {}) {
const from = new THREE.Vector3(...start);
const to = new THREE.Vector3(...end);
const direction = new THREE.Vector3().subVectors(to, from);
const length = direction.length();
const mesh = block(
parent,
thickness,
length,
thickness,
(from.x + to.x) / 2,
(from.y + to.y) / 2,
(from.z + to.z) / 2,
color,
options
);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
function instanceBlocks(items, castShadow = false) {
const material = new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.88,
metalness: 0
});
const mesh = new THREE.InstancedMesh(unitBox, material, items.length);
const dummy = new THREE.Object3D();
items.forEach((item, index) => {
dummy.position.set(item.x, item.y, item.z);
dummy.scale.set(item.sx, item.sy, item.sz);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
mesh.setColorAt(index, new THREE.Color(item.color));
});
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
let randomSeed = 1861;
function random() {
randomSeed =
(randomSeed * 1664525 + 1013904223) >>> 0;
return randomSeed / 4294967296;
}
// ------------------------------------------------------------
// Palette
// ------------------------------------------------------------
const C = {
wood: 0x6d4932,
darkWood: 0x35251f,
paleWood: 0x9b7249,
brass: 0xc49548,
iron: 0x252b2d,
black: 0x111719,
cream: 0xd9ccb0,
skin: 0xc58e68,
suit: 0x27333c,
curtain: 0x4e7777,
curtainLight: 0x61898a,
curtainDark: 0x3d6264,
brick: 0x756052,
brickDark: 0x51443c,
red: 0x8c252d,
redGlow: 0xff3442,
amber: 0xffbd67,
glass: 0x9bc2c4
};
// ------------------------------------------------------------
// Voxel floor
// ------------------------------------------------------------
const floorItems = [];
for (let row = 0; row < 14; row++) {
for (let col = 0; col < 24; col++) {
const x = -12.65 + col * 1.1;
const z = -7.15 + row * 1.1;
const formation = x < 1.4;
const variation = Math.floor(random() * 4);
let color;
if (formation) {
color = [
0x40545b,
0x465b61,
0x3b4d54,
0x4a5d62
][variation];
} else {
color = [
0x493b3a,
0x51403e,
0x403536,
0x584341
][variation];
}
floorItems.push({
x,
y: -0.08,
z,
sx: 1.04,
sy: 0.16,
sz: 1.04,
color
});
}
}
instanceBlocks(floorItems, false);
// Brass boundary between formation and development areas.
for (let z = -7; z <= 7; z += 0.75) {
block(
scene,
0.08,
0.05,
0.48,
1.38,
0.035,
z,
C.brass,
{ metalness: 0.45, roughness: 0.38 }
);
}
// ------------------------------------------------------------
// Voxel brick walls and partition
// ------------------------------------------------------------
const wallItems = [];
// Back wall.
for (let row = 0; row < 8; row++) {
const offset = row % 2 ? 0.55 : 0;
for (let col = -12; col < 12; col++) {
const color = random() > 0.68 ? C.brickDark : C.brick;
wallItems.push({
x: col * 1.1 + offset,
y: 0.24 + row * 0.48,
z: -7.75,
sx: 1.04,
sy: 0.42,
sz: 0.42,
color
});
}
}
// Low side walls leave the room open like a museum cutaway.
for (let row = 0; row < 4; row++) {
for (let col = 0; col < 14; col++) {
const z = -7.15 + col * 1.1;
wallItems.push({
x: -13.15,
y: 0.24 + row * 0.48,
z,
sx: 0.42,
sy: 0.42,
sz: 1.04,
color: random() > 0.7 ? C.brickDark : C.brick
});
wallItems.push({
x: 13.15,
y: 0.24 + row * 0.48,
z,
sx: 0.42,
sy: 0.42,
sz: 1.04,
color: random() > 0.7 ? C.brickDark : C.brick
});
}
}
// Tall rear portion of the central partition.
for (let row = 0; row < 7; row++) {
for (let z = -7.2; z < -0.1; z += 1.05) {
wallItems.push({
x: 1.48,
y: 0.24 + row * 0.48,
z,
sx: 0.34,
sy: 0.42,
sz: 0.99,
color: random() > 0.7 ? 0x59493f : 0x6b574a
});
}
}
// Lower front portion preserves the view into the exposure room.
for (let row = 0; row < 3; row++) {
for (let z = 4.45; z < 7.5; z += 1.05) {
wallItems.push({
x: 1.48,
y: 0.24 + row * 0.48,
z,
sx: 0.34,
sy: 0.42,
sz: 0.99,
color: random() > 0.7 ? 0x59493f : 0x6b574a
});
}
}
instanceBlocks(wallItems, true);
// Light-lock opening between the two work areas.
block(scene, 0.42, 4.3, 0.42, 1.48, 2.15, -0.08, C.darkWood);
block(scene, 0.42, 4.3, 0.42, 1.48, 2.15, 4.45, C.darkWood);
block(scene, 0.48, 0.34, 4.95, 1.48, 4.25, 2.18, C.darkWood);
block(scene, 0.54, 0.08, 4.6, 1.48, 0.08, 2.18, C.brass, {
metalness: 0.5,
roughness: 0.4
});
// ------------------------------------------------------------
// World-space labels generated locally
// ------------------------------------------------------------
const labelGroup = new THREE.Group();
scene.add(labelGroup);
function makeLabel(
text,
x,
y,
z,
worldWidth = 5.5,
accent = "#d9a24e",
options = {}
) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 160;
const ctx = canvas.getContext("2d");
ctx.fillStyle = options.background || "rgba(13, 20, 24, 0.88)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "rgba(235, 222, 192, 0.28)";
ctx.lineWidth = 3;
ctx.strokeRect(2, 2, canvas.width - 4, canvas.height - 4);
ctx.fillStyle = accent;
ctx.fillRect(0, 0, 14, canvas.height);
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = options.color || "#eadfc6";
const fontSize = text.length > 31 ? 38 : text.length > 23 ? 43 : 49;
ctx.font = `700 ${fontSize}px system-ui, sans-serif`;
ctx.fillText(text, 520, 82, 950);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthWrite: false,
depthTest: options.depthTest ?? false
});
const sprite = new THREE.Sprite(material);
sprite.position.set(x, y, z);
sprite.scale.set(worldWidth, worldWidth * (160 / 1024), 1);
sprite.renderOrder = 10;
labelGroup.add(sprite);
return sprite;
}
makeLabel(
"01 · IMAGE FORMATION",
-6.5,
6.05,
-1.7,
7.3,
"#d9a24e"
);
makeLabel(
"02 · LATER DEVELOPMENT",
7.1,
6.05,
-1.8,
7.3,
"#b74a4c"
);
makeLabel(
"PORTRAIT BACKDROP",
-7.1,
5.25,
-5.45,
4.8,
"#69aeb0"
);
makeLabel(
"PLATE CAMERA",
-7.0,
4.45,
2.45,
3.8,
"#d9a24e"
);
makeLabel(
"STUDIO LAMP",
-2.55,
4.45,
-2.15,
3.5,
"#d9a24e"
);
makeLabel(
"COVERED PLATE HOLDER",
-10.3,
2.75,
1.55,
4.8,
"#d9a24e"
);
makeLabel(
"LIGHT LOCK",
1.45,
4.95,
2.2,
3.2,
"#d9a24e"
);
makeLabel(
"RED SAFELIGHT",
9.35,
4.7,
-0.75,
4.0,
"#b74a4c"
);
makeLabel(
"CHEMICAL TRAYS",
6.6,
2.85,
-1.75,
4.4,
"#b74a4c"
);
makeLabel(
"SAFE PLATE STORE",
10.9,
3.55,
-5.6,
4.7,
"#b74a4c"
);
makeLabel(
"PLATE DRYING RACK",
7.4,
4.0,
4.3,
5.0,
"#b74a4c"
);
// ------------------------------------------------------------
// Image-formation zone: portrait backdrop
// ------------------------------------------------------------
// Uprights.
block(scene, 0.18, 5.9, 0.18, -9.55, 2.95, -5.45, C.darkWood);
block(scene, 0.18, 5.9, 0.18, -4.05, 2.95, -5.45, C.darkWood);
block(scene, 5.8, 0.18, 0.18, -6.8, 5.78, -5.45, C.darkWood);
// Cloth represented by many narrow voxel folds.
for (let i = 0; i < 18; i++) {
const colors = [C.curtain, C.curtainLight, C.curtainDark];
const z = -5.45 + Math.sin(i * 1.45) * 0.075;
block(
scene,
0.31,
5.48,
0.16,
-9.45 + i * 0.32,
2.85,
z,
colors[i % colors.length]
);
}
// Backdrop feet.
block(scene, 1.0, 0.16, 0.18, -9.55, 0.08, -5.45, C.darkWood);
block(scene, 1.0, 0.16, 0.18, -4.05, 0.08, -5.45, C.darkWood);
// ------------------------------------------------------------
// Voxel sitter and chair
// ------------------------------------------------------------
const sitter = new THREE.Group();
sitter.position.set(-6.8, 0, -3.35);
scene.add(sitter);
// Chair.
block(sitter, 1.25, 0.18, 1.2, 0, 1.05, -0.2, C.darkWood);
block(sitter, 1.25, 1.8, 0.16, 0, 1.8, -0.72, C.wood);
block(sitter, 0.16, 1.1, 0.16, -0.48, 0.55, -0.2, C.darkWood);
block(sitter, 0.16, 1.1, 0.16, 0.48, 0.55, -0.2, C.darkWood);
block(sitter, 0.16, 1.1, 0.16, -0.48, 0.55, -0.62, C.darkWood);
block(sitter, 0.16, 1.1, 0.16, 0.48, 0.55, -0.62, C.darkWood);
// Torso and clothing.
block(sitter, 1.12, 1.35, 0.68, 0, 2.02, -0.02, C.suit);
block(sitter, 0.36, 0.78, 0.12, 0, 2.04, 0.39, C.cream);
block(sitter, 0.24, 0.7, 0.1, 0, 2.03, 0.47, C.darkWood);
block(sitter, 0.32, 0.3, 0.09, 0, 2.46, 0.42, C.brass, {
metalness: 0.35
});
// Head, hair, nose, and ears.
block(sitter, 0.72, 0.78, 0.68, 0, 3.08, 0.01, C.skin);
block(sitter, 0.78, 0.24, 0.72, 0, 3.43, 0, 0x302824);
block(sitter, 0.2, 0.18, 0.18, 0, 3.04, 0.39, C.skin);
block(sitter, 0.12, 0.25, 0.16, -0.41, 3.08, 0.0, C.skin);
block(sitter, 0.12, 0.25, 0.16, 0.41, 3.08, 0.0, C.skin);
// Eyes as small dark voxels.
block(sitter, 0.09, 0.07, 0.04, -0.17, 3.18, 0.36, C.black);
block(sitter, 0.09, 0.07, 0.04, 0.17, 3.18, 0.36, C.black);
// Arms.
block(sitter, 0.28, 1.02, 0.34, -0.66, 2.0, 0.02, C.suit);
block(sitter, 0.28, 1.02, 0.34, 0.66, 2.0, 0.02, C.suit);
block(sitter, 0.27, 0.25, 0.3, -0.66, 1.46, 0.05, C.skin);
block(sitter, 0.27, 0.25, 0.3, 0.66, 1.46, 0.05, C.skin);
// Seated legs.
block(sitter, 0.36, 0.34, 1.05, -0.29, 1.27, 0.33, C.suit);
block(sitter, 0.36, 0.34, 1.05, 0.29, 1.27, 0.33, C.suit);
block(sitter, 0.34, 0.9, 0.34, -0.29, 0.73, 0.78, C.suit);
block(sitter, 0.34, 0.9, 0.34, 0.29, 0.73, 0.78, C.suit);
block(sitter, 0.38, 0.24, 0.72, -0.29, 0.22, 0.95, C.black);
block(sitter, 0.38, 0.24, 0.72, 0.29, 0.22, 0.95, C.black);
// ------------------------------------------------------------
// Image-formation zone: historical plate camera
// ------------------------------------------------------------
const cameraX = -6.8;
const cameraZ = 2.4;
// Tripod.
beam(
scene,
[cameraX, 1.95, cameraZ],
[cameraX - 1.05, 0.12, cameraZ + 0.45],
0.16,
C.darkWood
);
beam(
scene,
[cameraX, 1.95, cameraZ],
[cameraX + 1.05, 0.12, cameraZ + 0.45],
0.16,
C.darkWood
);
beam(
scene,
[cameraX, 1.95, cameraZ],
[cameraX, 0.12, cameraZ - 1.05],
0.16,
C.darkWood
);
block(scene, 0.26, 1.2, 0.26, cameraX, 1.55, cameraZ, C.wood);
block(scene, 0.6, 0.18, 0.6, cameraX, 2.1, cameraZ, C.darkWood);
const studioCamera = new THREE.Group();
studioCamera.position.set(cameraX, 2.72, cameraZ);
studioCamera.rotation.y = Math.PI;
scene.add(studioCamera);
// Main wooden camera body.
block(studioCamera, 1.65, 1.38, 0.88, 0, 0, 0, C.wood);
block(studioCamera, 1.76, 0.14, 0.98, 0, 0.66, 0, C.darkWood);
block(studioCamera, 1.76, 0.14, 0.98, 0, -0.66, 0, C.darkWood);
block(studioCamera, 0.12, 1.1, 0.98, -0.75, 0, 0, C.paleWood);
block(studioCamera, 0.12, 1.1, 0.98, 0.75, 0, 0, C.paleWood);
// Focus rails.
block(studioCamera, 0.11, 0.12, 1.42, -0.38, -0.58, 0.75, C.brass, {
metalness: 0.45,
roughness: 0.4
});
block(studioCamera, 0.11, 0.12, 1.42, 0.38, -0.58, 0.75, C.brass, {
metalness: 0.45,
roughness: 0.4
});
// Stepped bellows.
for (let i = 0; i < 6; i++) {
const z = 0.46 + i * 0.18;
const width = 1.28 - i * 0.035;
const height = 1.08 - i * 0.025;
block(studioCamera, width, height, 0.12, 0, 0, z, C.black);
block(
studioCamera,
width + 0.08,
0.055,
0.13,
0,
height / 2,
z,
C.wood
);
block(
studioCamera,
width + 0.08,
0.055,
0.13,
0,
-height / 2,
z,
C.wood
);
}
// Lens board and square voxel lens.
block(studioCamera, 1.22, 1.1, 0.16, 0, 0, 1.62, C.darkWood);
block(studioCamera, 0.68, 0.68, 0.24, 0, 0, 1.79, C.brass, {
metalness: 0.55,
roughness: 0.3
});
block(studioCamera, 0.48, 0.48, 0.12, 0, 0, 1.96, C.iron);
block(
studioCamera,
0.34,
0.34,
0.06,
0,
0,
2.05,
C.glass,
{
roughness: 0.12,
metalness: 0.25,
emissive: 0x17383c,
emissiveIntensity: 0.45
}
);
// Plate holder and focus knobs.
block(studioCamera, 1.25, 1.08, 0.16, 0, 0, -0.52, C.iron);
block(studioCamera, 0.28, 0.28, 0.2, 1.0, -0.14, -0.1, C.brass, {
metalness: 0.55,
roughness: 0.32
});
block(studioCamera, 0.18, 0.72, 0.18, 0.78, 0.3, 0.0, C.darkWood);
// ------------------------------------------------------------
// Protected plate area beside the camera
// ------------------------------------------------------------
// Small work table.
block(scene, 2.8, 0.18, 1.7, -10.25, 1.15, 1.55, C.wood);
block(scene, 0.18, 1.1, 0.18, -11.45, 0.55, 0.95, C.darkWood);
block(scene, 0.18, 1.1, 0.18, -9.05, 0.55, 0.95, C.darkWood);
block(scene, 0.18, 1.1, 0.18, -11.45, 0.55, 2.15, C.darkWood);
block(scene, 0.18, 1.1, 0.18, -9.05, 0.55, 2.15, C.darkWood);
// Opaque plate carrier box.
block(scene, 1.7, 0.48, 1.05, -10.55, 1.48, 1.55, C.darkWood);
block(scene, 1.82, 0.12, 1.16, -10.55, 1.77, 1.55, C.wood);
block(scene, 0.16, 0.35, 0.08, -10.55, 1.49, 1.03, C.brass, {
metalness: 0.5
});
// Hooded storage rack behind the covered box.
block(scene, 1.7, 0.15, 0.9, -9.45, 1.25, 1.55, C.darkWood);
block(scene, 0.15, 1.65, 0.9, -10.28, 2.05, 1.55, C.darkWood);
block(scene, 0.15, 1.65, 0.9, -8.62, 2.05, 1.55, C.darkWood);
block(scene, 1.8, 0.15, 0.9, -9.45, 2.82, 1.55, C.darkWood);
block(scene, 1.5, 0.1, 0.65, -9.45, 2.88, 1.55, C.black);
// Guard rail around the protected area.
for (const z of [0.35, 2.65]) {
block(scene, 3.4, 0.08, 0.08, -10.25, 0.08, z, C.brass, {
metalness: 0.5
});
}
block(scene, 0.08, 0.08, 2.38, -11.9, 0.08, 1.5, C.brass, {
metalness: 0.5
});
// ------------------------------------------------------------
// Image-formation zone: studio lamp
// ------------------------------------------------------------
const lampX = -2.55;
const lampZ = -2.15;
const lampTarget = new THREE.Vector3(-6.8, 1.8, -3.35);
// Lamp stand.
block(scene, 1.25, 0.15, 1.05, lampX, 0.1, lampZ, C.iron);
block(scene, 0.2, 2.95, 0.2, lampX, 1.48, lampZ, C.iron);
block(scene, 0.5, 0.18, 0.5, lampX, 2.95, lampZ, C.brass, {
metalness: 0.5
});
const lampHead = new THREE.Group();
lampHead.position.set(lampX, 3.15, lampZ);
lampHead.rotation.y = Math.atan2(
lampTarget.x - lampX,
lampTarget.z - lampZ
);
scene.add(lampHead);
// Stepped square reflector.
block(lampHead, 1.1, 1.1, 0.65, 0, 0, 0, C.iron);
block(lampHead, 1.36, 0.12, 0.62, 0, 0.56, 0.05, C.darkWood);
block(lampHead, 1.36, 0.12, 0.62, 0, -0.56, 0.05, C.darkWood);
block(lampHead, 0.12, 1.12, 0.62, 0.56, 0, 0.05, C.darkWood);
block(lampHead, 0.12, 1.12, 0.62, -0.56, 0, 0.05, C.darkWood);
block(lampHead, 0.95, 0.95, 0.08, 0, 0, 0.39, C.amber, {
emissive: C.amber,
emissiveIntensity: 2.8,
roughness: 0.35
});
const studioSpot = new THREE.SpotLight(
0xffc978,
330,
18,
Math.PI / 6,
0.48,
1.35
);
studioSpot.position.set(lampX, 3.15, lampZ);
studioSpot.target.position.copy(lampTarget);
studioSpot.castShadow = true;
studioSpot.shadow.mapSize.set(1024, 1024);
studioSpot.shadow.bias = -0.001;
scene.add(studioSpot);
scene.add(studioSpot.target);
// ------------------------------------------------------------
// Development zone: chemical bench
// ------------------------------------------------------------
// Bench top.
block(scene, 7.5, 0.24, 2.25, 7.1, 1.52, -1.8, C.darkWood);
// Bench legs.
for (const x of [3.75, 6.95, 10.45]) {
block(scene, 0.22, 1.45, 0.22, x, 0.72, -2.65, C.wood);
block(scene, 0.22, 1.45, 0.22, x, 0.72, -0.95, C.wood);
}
// Lower shelf.
block(scene, 6.9, 0.14, 1.75, 7.1, 0.45, -1.8, C.wood);
function openTray(x, z, width, depth, liquidColor) {
const y = 1.68;
block(scene, width, 0.08, depth, x, y, z, C.iron);
block(scene, width, 0.28, 0.09, x, y + 0.13, z - depth / 2, C.iron);
block(scene, width, 0.28, 0.09, x, y + 0.13, z + depth / 2, C.iron);
block(scene, 0.09, 0.28, depth, x - width / 2, y + 0.13, z, C.iron);
block(scene, 0.09, 0.28, depth, x + width / 2, y + 0.13, z, C.iron);
block(
scene,
width - 0.16,
0.035,
depth - 0.16,
x,
y + 0.19,
z,
liquidColor,
{
roughness: 0.18,
metalness: 0.08,
emissive: liquidColor,
emissiveIntensity: 0.08
}
);
}
openTray(4.9, -1.8, 1.7, 1.35, 0x7c6d3f);
openTray(7.0, -1.8, 1.7, 1.35, 0x74515a);
openTray(9.1, -1.8, 1.7, 1.35, 0x53686a);
// Rinse sink and water.
block(scene, 1.8, 0.18, 1.55, 11.0, 1.48, -1.8, C.iron);
block(scene, 1.48, 0.08, 1.2, 11.0, 1.59, -1.8, 0x516b70, {
roughness: 0.15,
metalness: 0.25
});
block(scene, 0.12, 0.85, 0.12, 11.75, 1.95, -2.35, C.brass, {
metalness: 0.55
});
block(scene, 0.55, 0.12, 0.12, 11.5, 2.35, -2.35, C.brass, {
metalness: 0.55
});
// Chemical bottles on the rear of the bench.
function bottle(x, z, bodyColor, capColor, height = 0.55) {
block(scene, 0.34, height, 0.34, x, 1.82 + height / 2, z, bodyColor);
block(scene, 0.17, 0.18, 0.17, x, 1.86 + height, z, capColor);
block(scene, 0.24, 0.2, 0.02, x, 1.86 + height * 0.48, z + 0.18, C.cream);
}
bottle(4.25, -2.55, 0x765b2c, 0x2b2420, 0.6);
bottle(4.75, -2.55, 0x4d3138, 0x2b2420, 0.48);
bottle(9.85, -2.55, 0x3f5558, 0x2b2420, 0.66);
// ------------------------------------------------------------
// Development zone: red safelight
// ------------------------------------------------------------
// Stand beside the bench.
block(scene, 0.18, 3.75, 0.18, 10.05, 1.87, -0.35, C.iron);
block(scene, 0.95, 0.14, 0.85, 10.05, 0.09, -0.35, C.iron);
block(scene, 1.35, 0.2, 0.18, 9.65, 3.65, -0.35, C.iron);
// Red shade and luminous blocks.
block(scene, 0.9, 0.65, 0.85, 8.95, 3.65, -0.35, C.darkWood);
block(scene, 0.72, 0.52, 0.72, 8.95, 3.38, -0.35, C.redGlow, {
emissive: C.redGlow,
emissiveIntensity: 3.2,
roughness: 0.3
});
const safelight = new THREE.PointLight(0xff2638, 95, 9, 1.7);
safelight.position.set(8.95, 3.35, -0.35);
scene.add(safelight);
// Red spill blocks on the bench.
block(
scene,
4.8,
0.025,
1.3,
8.0,
1.655,
-1.8,
0xff2638,
{
transparent: true,
opacity: 0.075,
emissive: 0xff2638,
emissiveIntensity: 0.7,
castShadow: false
}
);
// ------------------------------------------------------------
// Safe plate store
// ------------------------------------------------------------
const cabinet = new THREE.Group();
cabinet.position.set(10.95, 0, -5.75);
scene.add(cabinet);
block(cabinet, 2.6, 2.65, 1.35, 0, 1.325, 0, C.darkWood);
block(cabinet, 2.72, 0.16, 1.48, 0, 2.68, 0, C.wood);
block(cabinet, 0.14, 2.35, 0.12, 0, 1.3, 0.74, C.wood);
block(cabinet, 0.1, 0.3, 0.12, -0.24, 1.25, 0.82, C.brass, {
metalness: 0.55
});
block(cabinet, 0.1, 0.3, 0.12, 0.24, 1.25, 0.82, C.brass, {
metalness: 0.55
});
// Small red inspection windows.
block(cabinet, 0.58, 0.48, 0.05, -0.68, 1.85, 0.72, C.red, {
emissive: C.red,
emissiveIntensity: 0.55
});
block(cabinet, 0.58, 0.48, 0.05, 0.68, 1.85, 0.72, C.red, {
emissive: C.red,
emissiveIntensity: 0.55
});
// ------------------------------------------------------------
// Development zone: plate drying rack
// ------------------------------------------------------------
const rack = new THREE.Group();
rack.position.set(7.2, 0, 4.3);
scene.add(rack);
block(rack, 0.18, 3.3, 0.18, -2.0, 1.65, 0, C.wood);
block(rack, 0.18, 3.3, 0.18, 2.0, 1.65, 0, C.wood);
block(rack, 4.2, 0.18, 0.18, 0, 3.2, 0, C.wood);
block(rack, 4.2, 0.14, 0.14, 0, 2.35, 0, C.wood);
block(rack, 0.65, 0.12, 0.8, -2.0, 0.08, 0, C.darkWood);
block(rack, 0.65, 0.12, 0.8, 2.0, 0.08, 0, C.darkWood);
for (let i = 0; i < 6; i++) {
const x = -1.65 + i * 0.66;
block(
rack,
0.42,
0.72,
0.07,
x,
1.84,
0,
0x7c8c89,
{
roughness: 0.25,
metalness: 0.18,
emissive: 0x162322,
emissiveIntensity: 0.15
}
);
block(rack, 0.08, 0.12, 0.1, x, 2.24, 0, C.brass, {
metalness: 0.5
});
}
// ------------------------------------------------------------
// Small historical details
// ------------------------------------------------------------
// Wooden step platform beneath the portrait setup.
block(scene, 3.2, 0.18, 2.2, -6.8, 0.09, -3.45, C.wood);
block(scene, 3.05, 0.08, 2.05, -6.8, 0.22, -3.45, C.paleWood);
// A stack of covered plates near the camera.
for (let i = 0; i < 3; i++) {
block(
scene,
0.85,
0.12,
0.85,
-9.3,
0.27 + i * 0.14,
2.65,
i === 2 ? C.darkWood : C.iron
);
}
// Small clock or exposure timer on the camera wall.
block(scene, 0.8, 0.8, 0.18, -2.8, 3.0, -7.48, C.darkWood);
block(scene, 0.58, 0.58, 0.08, -2.8, 3.0, -7.36, C.cream);
block(scene, 0.08, 0.36, 0.08, -2.8, 3.12, -7.29, C.iron);
block(scene, 0.3, 0.08, 0.08, -2.68, 3.0, -7.29, C.iron);
// ------------------------------------------------------------
// Custom orbit, pan, and zoom controls
// ------------------------------------------------------------
const orbit = {
target: new THREE.Vector3(0, 1.4, 0),
radius: 29,
theta: 0.56,
phi: 1.01
};
let desiredOrbit = null;
let dragging = false;
let panning = false;
let lastX = 0;
let lastY = 0;
const canvas = renderer.domElement;
function updateCamera() {
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);
}
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("pointerdown", event => {
dragging = true;
panning = event.button === 2 || event.shiftKey;
lastX = event.clientX;
lastY = event.clientY;
desiredOrbit = null;
canvas.setPointerCapture(event.pointerId);
});
canvas.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 forward = camera.getWorldDirection(new THREE.Vector3());
const right = new THREE.Vector3()
.crossVectors(forward, camera.up)
.normalize();
const cameraUp = new THREE.Vector3()
.crossVectors(right, forward)
.normalize();
const scale = orbit.radius * 0.00145;
orbit.target
.addScaledVector(right, -dx * scale)
.addScaledVector(cameraUp, dy * scale);
orbit.target.x = THREE.MathUtils.clamp(orbit.target.x, -11, 11);
orbit.target.y = THREE.MathUtils.clamp(orbit.target.y, 0.5, 4.5);
orbit.target.z = THREE.MathUtils.clamp(orbit.target.z, -6, 6);
} else {
orbit.theta -= dx * 0.005;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - dy * 0.005,
0.28,
1.43
);
}
updateCamera();
});
function stopDragging(event) {
dragging = false;
if (event && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
desiredOrbit = null;
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
9,
46
);
updateCamera();
},
{ passive: false }
);
function zoom(factor) {
desiredOrbit = null;
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * factor,
9,
46
);
updateCamera();
}
document.getElementById("zoom-in").addEventListener("click", () => zoom(0.83));
document.getElementById("zoom-out").addEventListener("click", () => zoom(1.2));
// ------------------------------------------------------------
// View buttons and keyboard shortcuts
// ------------------------------------------------------------
const status = document.getElementById("status");
function focusView(name) {
if (name === "formation") {
desiredOrbit = {
target: new THREE.Vector3(-6.6, 1.75, -1.2),
radius: 17.2,
theta: 0.34,
phi: 1.02
};
status.textContent = "Image formation zone";
} else if (name === "development") {
desiredOrbit = {
target: new THREE.Vector3(7.0, 1.75, -0.8),
radius: 16.5,
theta: 0.66,
phi: 1.02
};
status.textContent = "Later development zone";
} else {
desiredOrbit = {
target: new THREE.Vector3(0, 1.45, 0),
radius: 29,
theta: 0.56,
phi: 1.01
};
status.textContent = "Complete studio";
}
}
document.querySelectorAll("[data-view]").forEach(button => {
button.addEventListener("click", () => {
focusView(button.dataset.view);
});
});
function toggleLabels() {
labelGroup.visible = !labelGroup.visible;
document.getElementById("labels-button").textContent =
labelGroup.visible ? "Labels" : "Hide labels";
}
document.getElementById("labels-button").addEventListener("click", toggleLabels);
window.addEventListener("keydown", event => {
if (event.key === "1") focusView("formation");
if (event.key === "2") focusView("development");
if (event.key === "3") focusView("overview");
if (event.key.toLowerCase() === "l") toggleLabels();
if (event.key.toLowerCase() === "r") focusView("overview");
});
// ------------------------------------------------------------
// Resize and animation
// ------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
if (desiredOrbit) {
const easing = 0.075;
orbit.target.lerp(desiredOrbit.target, easing);
orbit.radius += (desiredOrbit.radius - orbit.radius) * easing;
orbit.theta += (desiredOrbit.theta - orbit.theta) * easing;
orbit.phi += (desiredOrbit.phi - orbit.phi) * easing;
if (
orbit.target.distanceTo(desiredOrbit.target) < 0.015 &&
Math.abs(orbit.radius - desiredOrbit.radius) < 0.015 &&
Math.abs(orbit.theta - desiredOrbit.theta) < 0.002 &&
Math.abs(orbit.phi - desiredOrbit.phi) < 0.002
) {
desiredOrbit = null;
}
}
safelight.intensity = 95 + Math.sin(elapsed * 2.2) * 4;
studioSpot.intensity = 330 + Math.sin(elapsed * 5.5) * 5;
updateCamera();
renderer.render(scene, camera);
}
updateCamera();
animate();
</script>
</body>
</html>
```