Prompt specification
Build or customize the Three.js 3D scene "Early photographic camera on a street corner" 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: Early photographic camera on a street corner
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/early-photographic-camera-on-a-street-corner-x2510
Scene Description Prompt:
Create a historically referenced camera setup facing a stationary subject. Show aperture, image plane, and a visible exposure timer without inventing a specific chemical process. Use Three.js from cdnjs in a single HTML file, with low-poly forms.
Working Three.js Starter (early-photographic-camera-on-a-street-corner-x2510):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Historical Camera Study</title>
<style>
:root {
--ink: #292722;
--muted: #716b60;
--paper: #eee7da;
--brass: #b78948;
--line: rgba(58, 49, 38, 0.22);
--glass: rgba(244, 239, 227, 0.82);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8cfbe;
color: var(--ink);
font-family: Arial, Helvetica, sans-serif;
}
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
z-index: 2;
opacity: 0.13;
background-image:
repeating-linear-gradient(
0deg,
rgba(40, 35, 29, 0.025) 0,
rgba(40, 35, 29, 0.025) 1px,
transparent 1px,
transparent 3px
);
mix-blend-mode: multiply;
}
#stage,
#stage canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
}
#stage canvas {
display: block;
touch-action: none;
cursor: grab;
outline: none;
}
#stage canvas.dragging {
cursor: grabbing;
}
#leaders {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
z-index: 4;
pointer-events: none;
overflow: visible;
}
#leaders line {
stroke: rgba(63, 56, 46, 0.56);
stroke-width: 1;
stroke-dasharray: 3 4;
}
#leaders circle {
fill: var(--paper);
stroke: rgba(63, 56, 46, 0.72);
stroke-width: 1.25;
}
.annotation {
position: fixed;
z-index: 5;
min-width: 145px;
padding: 9px 12px 10px;
transform: translate(-50%, -50%);
border: 1px solid rgba(73, 64, 52, 0.22);
background: rgba(239, 234, 223, 0.9);
box-shadow: 0 8px 24px rgba(50, 42, 32, 0.09);
backdrop-filter: blur(8px);
pointer-events: none;
transition: opacity 160ms ease;
}
.annotation .index {
display: inline-block;
margin-right: 7px;
color: var(--brass);
font: 700 10px/1 Georgia, serif;
letter-spacing: 0.08em;
}
.annotation strong {
display: block;
font: 700 11px/1.2 Arial, Helvetica, sans-serif;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.annotation small {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 11px;
line-height: 1.35;
}
.hero {
position: fixed;
top: 26px;
left: 30px;
z-index: 10;
width: min(440px, calc(100vw - 60px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 11px;
color: #6f604c;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 31px;
height: 1px;
background: var(--brass);
}
.hero h1 {
margin: 0;
max-width: 410px;
font: 400 clamp(29px, 3vw, 46px)/0.98 Georgia, "Times New Roman", serif;
letter-spacing: -0.035em;
}
.hero p {
max-width: 405px;
margin: 14px 0 0;
color: #655f55;
font-size: 12px;
line-height: 1.55;
}
.hero p strong {
color: #4d463d;
font-weight: 700;
}
.timer {
position: fixed;
top: 26px;
right: 30px;
z-index: 10;
width: 218px;
padding: 16px 17px 15px;
border: 1px solid rgba(65, 55, 43, 0.26);
background: rgba(239, 234, 223, 0.86);
box-shadow: 0 14px 36px rgba(48, 40, 30, 0.11);
backdrop-filter: blur(10px);
}
.timer-top {
display: flex;
justify-content: space-between;
align-items: center;
color: #6e6251;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
}
#timerState {
color: var(--brass);
}
.timer-value {
margin: 7px 0 9px;
font: 400 43px/1 Georgia, "Times New Roman", serif;
font-variant-numeric: tabular-nums;
letter-spacing: -0.045em;
}
.timer-value small {
margin-left: 5px;
color: var(--muted);
font: 400 12px/1 Arial, sans-serif;
letter-spacing: 0;
}
.timer-track {
height: 3px;
overflow: hidden;
background: rgba(65, 55, 43, 0.13);
}
#timerProgress {
width: 100%;
height: 100%;
transform-origin: left center;
background: var(--brass);
}
.timer-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 12px;
}
button {
appearance: none;
border: 1px solid rgba(66, 55, 42, 0.28);
border-radius: 0;
padding: 8px 11px;
background: rgba(255, 252, 245, 0.48);
color: #4a4339;
font: 700 9px/1 Arial, Helvetica, sans-serif;
letter-spacing: 0.13em;
text-transform: uppercase;
cursor: pointer;
transition:
background 140ms ease,
border-color 140ms ease,
transform 140ms ease;
}
button:hover {
border-color: rgba(140, 102, 53, 0.66);
background: rgba(255, 252, 245, 0.82);
}
button:active {
transform: translateY(1px);
}
.timer-note {
color: #8a8173;
font-size: 9px;
line-height: 1.35;
}
.controls {
position: fixed;
left: 50%;
bottom: 24px;
z-index: 10;
display: flex;
align-items: center;
gap: 22px;
width: min(760px, calc(100vw - 48px));
padding: 13px 16px;
transform: translateX(-50%);
border: 1px solid rgba(65, 55, 43, 0.23);
background: rgba(239, 234, 223, 0.87);
box-shadow: 0 12px 34px rgba(47, 39, 29, 0.11);
backdrop-filter: blur(10px);
}
.control {
flex: 1 1 190px;
min-width: 0;
}
.control-heading {
display: flex;
justify-content: space-between;
gap: 10px;
margin-bottom: 7px;
color: #655d51;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.control output {
color: #493f32;
font-variant-numeric: tabular-nums;
letter-spacing: 0;
text-transform: none;
}
input[type="range"] {
width: 100%;
height: 3px;
margin: 0;
appearance: none;
background: rgba(65, 55, 43, 0.18);
cursor: pointer;
accent-color: var(--brass);
}
input[type="range"]::-webkit-slider-thumb {
width: 13px;
height: 13px;
appearance: none;
border: 2px solid #eee7da;
border-radius: 50%;
background: #9e753d;
box-shadow: 0 0 0 1px rgba(65, 55, 43, 0.3);
}
input[type="range"]::-moz-range-thumb {
width: 10px;
height: 10px;
border: 2px solid #eee7da;
border-radius: 50%;
background: #9e753d;
box-shadow: 0 0 0 1px rgba(65, 55, 43, 0.3);
}
.control-buttons {
display: flex;
gap: 7px;
flex: 0 0 auto;
}
.help {
position: fixed;
left: 30px;
bottom: 29px;
z-index: 9;
color: rgba(68, 60, 50, 0.72);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1.7;
text-transform: uppercase;
pointer-events: none;
}
@media (max-width: 980px) {
.hero {
width: 350px;
}
.hero p {
max-width: 330px;
}
.help {
display: none;
}
.controls {
gap: 14px;
}
}
@media (max-width: 700px) {
.hero {
top: 16px;
left: 16px;
width: calc(100vw - 32px);
}
.hero h1 {
max-width: 310px;
font-size: 30px;
}
.hero p {
display: none;
}
.timer {
top: 116px;
right: 16px;
width: 174px;
padding: 12px;
}
.timer-value {
font-size: 34px;
}
.timer-note {
display: none;
}
.controls {
bottom: 12px;
width: calc(100vw - 24px);
gap: 12px;
padding: 11px;
}
.control {
flex-basis: 120px;
}
.control-buttons {
display: none;
}
.control-heading {
display: block;
}
.control-heading output {
display: block;
margin-top: 3px;
}
.annotation {
min-width: 115px;
padding: 7px 9px;
}
.annotation small {
font-size: 9px;
}
}
</style>
</head>
<body>
<div id="stage"></div>
<svg id="leaders" aria-hidden="true">
<line id="apertureLeader"></line>
<circle id="apertureDot" r="4"></circle>
<line id="imageLeader"></line>
<circle id="imageDot" r="4"></circle>
<line id="subjectLeader"></line>
<circle id="subjectDot" r="4"></circle>
</svg>
<div id="apertureAnnotation" class="annotation">
<span class="index">01</span>
<strong>Aperture</strong>
<small id="apertureAnnotationValue">Ø 25 mm · f/4.0 equivalent</small>
</div>
<div id="imageAnnotation" class="annotation">
<span class="index">02</span>
<strong>Image plane</strong>
<small>Ground-glass focusing plane<br>8 × 10 in</small>
</div>
<div id="subjectAnnotation" class="annotation">
<span class="index">03</span>
<strong>Stationary subject</strong>
<small>Seated sitter on the optical axis</small>
</div>
<header class="hero">
<div class="eyebrow">Optical reference · late 19th century</div>
<h1>Large-format stand camera</h1>
<p>
<strong>A reference-inspired cutaway</strong> using period-style wooden rails,
leather bellows, brass lens hardware, and a ground-glass image plane.
Optical arrangement only: no film, sensitized plate, or chemical process is implied.
</p>
</header>
<section class="timer" aria-label="Visible exposure timer">
<div class="timer-top">
<span>Exposure timer</span>
<span id="timerState">Ready</span>
</div>
<div class="timer-value">
<span id="timerValue">08.0</span><small>sec</small>
</div>
<div class="timer-track">
<div id="timerProgress"></div>
</div>
<div class="timer-actions">
<button id="timerToggle" type="button">Start</button>
<span class="timer-note">Illustrative duration</span>
</div>
</section>
<section class="controls" aria-label="Camera and exposure controls">
<div class="control">
<div class="control-heading">
<span>Aperture</span>
<output id="apertureValue">Ø 25 mm · f/4.0 eq.</output>
</div>
<input
id="apertureRange"
type="range"
min="12"
max="40"
step="1"
value="25"
aria-label="Aperture diameter in millimeters"
>
</div>
<div class="control">
<div class="control-heading">
<span>Exposure</span>
<output id="exposureValue">8.0 seconds</output>
</div>
<input
id="exposureRange"
type="range"
min="4"
max="20"
step="0.5"
value="8"
aria-label="Exposure duration in seconds"
>
</div>
<div class="control-buttons">
<button id="resetView" type="button">Reset view</button>
<button id="toggleAxis" type="button">Hide axis</button>
</div>
</section>
<div class="help">
Drag to orbit · scroll to zoom<br>
Shift-drag to pan · 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";
// -------------------------------------------------------------------------
// Renderer, scene, lighting
// -------------------------------------------------------------------------
const stage = document.getElementById("stage");
const renderer = new THREE.WebGLRenderer({
antialias: true,
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;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive historical camera scene. Drag to orbit and scroll to zoom."
);
stage.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8cfbe);
scene.fog = new THREE.Fog(0xd8cfbe, 12, 27);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
80
);
const hemisphere = new THREE.HemisphereLight(0xfff5df, 0x766a59, 2.05);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffedcf, 3.5);
keyLight.position.set(-4.5, 8.5, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.bias = -0.00035;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb8d0d8, 1.15);
fillLight.position.set(6, 4.5, -2);
scene.add(fillLight);
const rimLight = new THREE.DirectionalLight(0xffd29a, 1.3);
rimLight.position.set(-5, 4, -6);
scene.add(rimLight);
// -------------------------------------------------------------------------
// Materials
// -------------------------------------------------------------------------
const material = {
walnut: new THREE.MeshStandardMaterial({
color: 0x533421,
roughness: 0.76,
metalness: 0.02,
flatShading: true
}),
walnutLight: new THREE.MeshStandardMaterial({
color: 0x765039,
roughness: 0.72,
flatShading: true
}),
walnutDark: new THREE.MeshStandardMaterial({
color: 0x39261d,
roughness: 0.82,
flatShading: true
}),
leather: new THREE.MeshStandardMaterial({
color: 0x3c332c,
roughness: 0.94,
side: THREE.DoubleSide,
flatShading: true
}),
leatherEdge: new THREE.LineBasicMaterial({
color: 0x171411,
transparent: true,
opacity: 0.72
}),
brass: new THREE.MeshStandardMaterial({
color: 0xb58a45,
roughness: 0.3,
metalness: 0.72,
flatShading: true
}),
brassDark: new THREE.MeshStandardMaterial({
color: 0x74552e,
roughness: 0.42,
metalness: 0.64,
flatShading: true
}),
blackMetal: new THREE.MeshStandardMaterial({
color: 0x20211f,
roughness: 0.44,
metalness: 0.55,
flatShading: true
}),
bladeA: new THREE.MeshStandardMaterial({
color: 0x262a29,
roughness: 0.48,
metalness: 0.62,
side: THREE.DoubleSide,
flatShading: true
}),
bladeB: new THREE.MeshStandardMaterial({
color: 0x323634,
roughness: 0.44,
metalness: 0.66,
side: THREE.DoubleSide,
flatShading: true
}),
glass: new THREE.MeshStandardMaterial({
color: 0x244b58,
roughness: 0.12,
metalness: 0.28,
transparent: true,
opacity: 0.82
}),
floor: new THREE.MeshStandardMaterial({
color: 0xb7aa95,
roughness: 0.95
}),
wall: new THREE.MeshStandardMaterial({
color: 0xd8cdbb,
roughness: 1
}),
rug: new THREE.MeshStandardMaterial({
color: 0x806653,
roughness: 1,
flatShading: true
}),
coat: new THREE.MeshStandardMaterial({
color: 0x30434a,
roughness: 0.92,
flatShading: true
}),
shirt: new THREE.MeshStandardMaterial({
color: 0xb9aa90,
roughness: 0.94,
flatShading: true
}),
skin: new THREE.MeshStandardMaterial({
color: 0xb98769,
roughness: 0.88,
flatShading: true
}),
hair: new THREE.MeshStandardMaterial({
color: 0x39302a,
roughness: 0.96,
flatShading: true
}),
shoe: new THREE.MeshStandardMaterial({
color: 0x292725,
roughness: 0.86,
flatShading: true
}),
chair: new THREE.MeshStandardMaterial({
color: 0x4b3126,
roughness: 0.78,
flatShading: true
})
};
// -------------------------------------------------------------------------
// Geometry helpers
// -------------------------------------------------------------------------
function addMesh(geometry, mat, parent, position = [0, 0, 0]) {
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBox(parent, size, position, mat, rotation = [0, 0, 0]) {
const mesh = addMesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
mat,
parent,
position
);
mesh.rotation.set(rotation[0], rotation[1], rotation[2]);
return mesh;
}
function addCylinder(
parent,
topRadius,
bottomRadius,
height,
segments,
mat,
position,
rotation = [0, 0, 0]
) {
const mesh = addMesh(
new THREE.CylinderGeometry(
topRadius,
bottomRadius,
height,
segments
),
mat,
parent,
position
);
mesh.rotation.set(rotation[0], rotation[1], rotation[2]);
return mesh;
}
function cylinderBetween(parent, start, end, radius, mat, segments = 8) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = b.clone().sub(a);
const midpoint = a.clone().add(b).multiplyScalar(0.5);
const mesh = addMesh(
new THREE.CylinderGeometry(
radius,
radius,
direction.length(),
segments
),
mat,
parent,
midpoint.toArray()
);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
function addEdges(mesh, opacity = 0.28) {
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(mesh.geometry, 28),
new THREE.LineBasicMaterial({
color: 0x241c16,
transparent: true,
opacity
})
);
mesh.add(edges);
return edges;
}
// -------------------------------------------------------------------------
// Studio environment
// -------------------------------------------------------------------------
const floor = addMesh(
new THREE.PlaneGeometry(32, 32),
material.floor,
scene,
[0, -0.01, 0]
);
floor.rotation.x = -Math.PI / 2;
floor.castShadow = false;
const backWall = addMesh(
new THREE.PlaneGeometry(18, 8),
material.wall,
scene,
[0, 3.9, -4.1]
);
backWall.castShadow = false;
const leftWall = addMesh(
new THREE.PlaneGeometry(12, 8),
material.wall,
scene,
[-8.2, 3.9, 0]
);
leftWall.rotation.y = Math.PI / 2;
leftWall.castShadow = false;
const rug = addMesh(
new THREE.CircleGeometry(2.55, 32),
material.rug,
scene,
[2.35, 0.005, -1.5]
);
rug.rotation.x = -Math.PI / 2;
rug.castShadow = false;
// -------------------------------------------------------------------------
// Camera placement and optical axis
// -------------------------------------------------------------------------
const cameraPosition = new THREE.Vector3(-3.0, 1.82, 2.25);
const subjectPosition = new THREE.Vector3(2.35, 0, -1.55);
const subjectAim = new THREE.Vector3(2.35, 1.82, -1.55);
const cameraYaw = Math.atan2(
subjectAim.x - cameraPosition.x,
subjectAim.z - cameraPosition.z
);
const rig = new THREE.Group();
rig.position.copy(cameraPosition);
rig.rotation.y = cameraYaw;
scene.add(rig);
// -------------------------------------------------------------------------
// Wooden camera frame
// -------------------------------------------------------------------------
const rearFrameZ = -0.76;
const frontFrameZ = 0.63;
for (const x of [-0.78, 0.78]) {
const rearRail = addBox(
rig,
[0.11, 1.62, 0.12],
[x, 0, rearFrameZ],
material.walnut
);
addEdges(rearRail);
const frontRail = addBox(
rig,
[0.11, 1.52, 0.12],
[x, 0, frontFrameZ],
material.walnut
);
addEdges(frontRail);
addBox(
rig,
[0.085, 0.085, 1.39],
[x, 0.73, -0.055],
material.walnutLight
);
}
for (const y of [-0.78, 0.78]) {
addBox(
rig,
[1.66, 0.11, 0.12],
[0, y, rearFrameZ],
material.walnut
);
addBox(
rig,
[1.66, 0.11, 0.12],
[0, y, frontFrameZ],
material.walnut
);
addBox(
rig,
[0.085, 0.085, 1.39],
[0, y, -0.055],
material.walnutLight
);
}
// Small brass focusing hardware.
addCylinder(
rig,
0.065,
0.065,
0.12,
8,
material.brass,
[0.86, 0.82, -0.1]
);
addCylinder(
rig,
0.065,
0.065,
0.12,
8,
material.brassDark,
[-0.86, -0.82, -0.1]
);
addBox(
rig,
[0.25, 0.04, 0.16],
[0.86, 0.72, -0.08],
material.brass
);
// -------------------------------------------------------------------------
// Cutaway leather bellows
// -------------------------------------------------------------------------
const bellowsGroup = new THREE.Group();
rig.add(bellowsGroup);
const rearHalfWidth = 0.68;
const rearHalfHeight = 1.02;
const frontHalfWidth = 0.57;
const frontHalfHeight = 0.83;
const bellowsRearZ = -0.63;
const bellowsFrontZ = 0.56;
const corners = [
[-1, -1],
[1, -1],
[1, 1],
[-1, 1]
];
const bellowsPositions = [];
const bellowsIndices = [];
// The near wall is intentionally omitted to form a readable cutaway.
for (let side = 0; side < 4; side++) {
if (side === 3) continue;
const a = corners[side];
const b = corners[(side + 1) % 4];
const base = bellowsPositions.length / 3;
bellowsPositions.push(
a[0] * rearHalfWidth,
a[1] * rearHalfHeight,
bellowsRearZ,
b[0] * rearHalfWidth,
b[1] * rearHalfHeight,
bellowsRearZ,
b[0] * frontHalfWidth,
b[1] * frontHalfHeight,
bellowsFrontZ,
a[0] * frontHalfWidth,
a[1] * frontHalfHeight,
bellowsFrontZ
);
bellowsIndices.push(
base, base + 1, base + 2,
base, base + 2, base + 3
);
}
const bellowsGeometry = new THREE.BufferGeometry();
bellowsGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(bellowsPositions, 3)
);
bellowsGeometry.setIndex(bellowsIndices);
bellowsGeometry.computeVertexNormals();
const bellows = addMesh(
bellowsGeometry,
material.leather,
bellowsGroup
);
bellows.material = material.leather.clone();
bellows.material.side = THREE.DoubleSide;
// Accordion-fold rings.
for (let fold = 0; fold <= 6; fold++) {
const t = fold / 6;
const halfWidth = THREE.MathUtils.lerp(
rearHalfWidth,
frontHalfWidth,
t
);
const halfHeight = THREE.MathUtils.lerp(
rearHalfHeight,
frontHalfHeight,
t
);
const z = THREE.MathUtils.lerp(
bellowsRearZ,
bellowsFrontZ,
t
);
const points = [
new THREE.Vector3(-halfWidth, -halfHeight, z),
new THREE.Vector3(halfWidth, -halfHeight, z),
new THREE.Vector3(halfWidth, halfHeight, z),
new THREE.Vector3(-halfWidth, halfHeight, z),
new THREE.Vector3(-halfWidth, -halfHeight, z)
];
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(points),
material.leatherEdge
);
bellowsGroup.add(line);
}
// -------------------------------------------------------------------------
// Lens, brass barrel, and adjustable polygonal aperture
// -------------------------------------------------------------------------
addCylinder(
rig,
0.37,
0.37,
0.15,
12,
material.brassDark,
[0, 0, 0.69],
[Math.PI / 2, 0, 0]
);
addCylinder(
rig,
0.34,
0.37,
0.28,
12,
material.brass,
[0, 0, 0.88],
[Math.PI / 2, 0, 0]
);
addCylinder(
rig,
0.365,
0.365,
0.045,
12,
material.brassDark,
[0, 0, 1.045],
[Math.PI / 2, 0, 0]
);
const lensGlass = addMesh(
new THREE.CircleGeometry(0.31, 12),
material.glass,
rig,
[0, 0, 1.069]
);
lensGlass.castShadow = false;
const lensRing = addMesh(
new THREE.TorusGeometry(0.337, 0.032, 6, 16),
material.brass,
rig,
[0, 0, 1.105]
);
lensRing.castShadow = false;
const apertureGroup = new THREE.Group();
apertureGroup.position.z = 1.112;
rig.add(apertureGroup);
const apertureBack = addMesh(
new THREE.CircleGeometry(0.31, 12),
material.blackMetal,
apertureGroup
);
apertureBack.castShadow = false;
function rebuildAperture(openingRadius) {
for (const child of [...apertureGroup.children]) {
if (child === apertureBack) continue;
apertureGroup.remove(child);
child.geometry.dispose();
}
const count = 8;
const outerRadius = 0.305;
const step = (Math.PI * 2) / count;
for (let i = 0; i < count; i++) {
const a0 = i * step;
const a1 = (i + 1) * step;
const innerA = new THREE.Vector2(
Math.cos(a0) * openingRadius,
Math.sin(a0) * openingRadius
);
const innerB = new THREE.Vector2(
Math.cos(a1) * openingRadius,
Math.sin(a1) * openingRadius
);
const outerA = new THREE.Vector2(
Math.cos(a0) * outerRadius,
Math.sin(a0) * outerRadius
);
const outerB = new THREE.Vector2(
Math.cos(a1) * outerRadius,
Math.sin(a1) * outerRadius
);
const shape = new THREE.Shape();
shape.moveTo(innerA.x, innerA.y);
shape.lineTo(innerB.x, innerB.y);
shape.lineTo(outerB.x, outerB.y);
shape.lineTo(outerA.x, outerA.y);
shape.closePath();
const blade = new THREE.Mesh(
new THREE.ShapeGeometry(shape),
i % 2 === 0 ? material.bladeA : material.bladeB
);
blade.position.z = i * 0.00045;
blade.castShadow = false;
apertureGroup.add(blade);
}
}
rebuildAperture(0.115);
// -------------------------------------------------------------------------
// Ground-glass image plane
// -------------------------------------------------------------------------
function createGroundGlassTexture() {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 640;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#cbd0c3";
ctx.fillRect(0, 0, canvas.width, canvas.height);
const glow = ctx.createRadialGradient(
256,
300,
30,
256,
300,
340
);
glow.addColorStop(0, "rgba(255,255,245,0.52)");
glow.addColorStop(1, "rgba(83,99,91,0.08)");
ctx.fillStyle = glow;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "rgba(55,67,60,0.16)";
ctx.lineWidth = 1;
for (let x = 0; x <= 512; x += 64) {
ctx.beginPath();
ctx.moveTo(x, 0);
ctx.lineTo(x, 640);
ctx.stroke();
}
for (let y = 0; y <= 640; y += 64) {
ctx.beginPath();
ctx.moveTo(0, y);
ctx.lineTo(512, y);
ctx.stroke();
}
// Faint inverted focusing image, appropriate to a ground-glass view.
ctx.save();
ctx.globalAlpha = 0.28;
ctx.fillStyle = "#596961";
ctx.beginPath();
ctx.moveTo(126, 76);
ctx.lineTo(386, 76);
ctx.lineTo(350, 342);
ctx.lineTo(162, 342);
ctx.closePath();
ctx.fill();
ctx.beginPath();
ctx.ellipse(256, 432, 61, 72, 0, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
ctx.strokeStyle = "rgba(87,77,63,0.45)";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(256, 270);
ctx.lineTo(256, 370);
ctx.moveTo(206, 320);
ctx.lineTo(306, 320);
ctx.stroke();
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
renderer.capabilities.getMaxAnisotropy(),
8
);
return texture;
}
const imagePlaneGroup = new THREE.Group();
imagePlaneGroup.position.set(0, 0, rearFrameZ - 0.025);
rig.add(imagePlaneGroup);
const imagePlane = addMesh(
new THREE.PlaneGeometry(1.08, 1.34),
new THREE.MeshBasicMaterial({
map: createGroundGlassTexture(),
side: THREE.DoubleSide
}),
imagePlaneGroup
);
imagePlane.castShadow = false;
imagePlane.receiveShadow = false;
for (const x of [-0.585, 0.585]) {
addBox(
imagePlaneGroup,
[0.09, 1.48, 0.075],
[x, 0, -0.035],
material.walnutDark
);
}
for (const y of [-0.695, 0.695]) {
addBox(
imagePlaneGroup,
[1.25, 0.09, 0.075],
[0, y, -0.035],
material.walnutDark
);
}
// -------------------------------------------------------------------------
// Tripod and stand
// -------------------------------------------------------------------------
const stand = new THREE.Group();
scene.add(stand);
addCylinder(
stand,
0.055,
0.065,
0.57,
8,
material.brassDark,
[cameraPosition.x, 1.28, cameraPosition.z]
);
addCylinder(
stand,
0.07,
0.09,
0.22,
8,
material.walnutDark,
[cameraPosition.x, 0.92, cameraPosition.z]
);
const legFeet = [];
for (let i = 0; i < 3; i++) {
const angle = i * (Math.PI * 2 / 3) + 0.42;
const foot = [
cameraPosition.x + Math.cos(angle) * 1.35,
0.055,
cameraPosition.z + Math.sin(angle) * 1.35
];
legFeet.push(foot);
cylinderBetween(
stand,
[cameraPosition.x, 1.05, cameraPosition.z],
foot,
0.043,
material.walnut,
7
);
const footMesh = addCylinder(
stand,
0.065,
0.075,
0.08,
8,
material.brassDark,
foot
);
footMesh.castShadow = true;
}
for (let i = 0; i < 3; i++) {
cylinderBetween(
stand,
[cameraPosition.x, 0.57, cameraPosition.z],
legFeet[i].map((value, index) =>
index === 1 ? 0.43 : value
),
0.018,
material.walnutDark,
6
);
}
// -------------------------------------------------------------------------
// Stationary seated subject
// -------------------------------------------------------------------------
const subject = new THREE.Group();
subject.position.copy(subjectPosition);
const subjectYaw = Math.atan2(
cameraPosition.x - subjectPosition.x,
cameraPosition.z - subjectPosition.z
);
subject.rotation.y = subjectYaw;
scene.add(subject);
// Chair.
addBox(subject, [0.78, 0.12, 0.72], [0, 0.65, 0], material.chair);
addBox(subject, [0.78, 0.82, 0.10], [0, 1.04, -0.34], material.chair);
for (const x of [-0.30, 0.30]) {
for (const z of [-0.27, 0.27]) {
addBox(
subject,
[0.075, 0.62, 0.075],
[x, 0.31, z],
material.chair
);
}
}
// Torso and clothing.
addCylinder(
subject,
0.31,
0.38,
0.76,
7,
material.coat,
[0, 1.14, 0]
);
addBox(
subject,
[0.18, 0.45, 0.035],
[0, 1.24, 0.302],
material.shirt
);
addCylinder(
subject,
0.095,
0.105,
0.18,
8,
material.skin,
[0, 1.60, 0]
);
// Head, hair, and minimal facial forms.
const head = addMesh(
new THREE.IcosahedronGeometry(0.245, 1),
material.skin,
subject,
[0, 1.83, 0.035]
);
head.scale.set(0.88, 1.08, 0.92);
const hair = addMesh(
new THREE.IcosahedronGeometry(0.252, 1),
material.hair,
subject,
[0, 1.91, -0.035]
);
hair.scale.set(0.92, 0.77, 0.92);
const nose = addMesh(
new THREE.ConeGeometry(0.048, 0.13, 5),
material.skin,
subject,
[0, 1.82, 0.275]
);
nose.rotation.x = Math.PI / 2;
for (const x of [-0.078, 0.078]) {
const eye = addMesh(
new THREE.IcosahedronGeometry(0.018, 0),
material.blackMetal,
subject,
[x, 1.87, 0.231]
);
eye.castShadow = false;
}
// Arms resting in a fixed pose.
for (const side of [-1, 1]) {
cylinderBetween(
subject,
[side * 0.29, 1.43, 0],
[side * 0.40, 1.08, 0.08],
0.09,
material.coat,
7
);
cylinderBetween(
subject,
[side * 0.40, 1.08, 0.08],
[side * 0.27, 0.87, 0.34],
0.074,
material.coat,
7
);
const hand = addMesh(
new THREE.IcosahedronGeometry(0.09, 0),
material.skin,
subject,
[side * 0.25, 0.855, 0.37]
);
hand.scale.set(0.8, 0.65, 1.15);
}
// Seated legs and shoes.
for (const side of [-1, 1]) {
cylinderBetween(
subject,
[side * 0.18, 0.82, 0.04],
[side * 0.20, 0.67, 0.48],
0.12,
material.coat,
7
);
cylinderBetween(
subject,
[side * 0.20, 0.67, 0.48],
[side * 0.22, 0.13, 0.45],
0.095,
material.coat,
7
);
addBox(
subject,
[0.20, 0.13, 0.34],
[side * 0.22, 0.09, 0.54],
material.shoe
);
}
// -------------------------------------------------------------------------
// Annotation anchors and optical axis
// -------------------------------------------------------------------------
const apertureAnchor = new THREE.Object3D();
apertureAnchor.position.set(0.28, 0.08, 1.14);
rig.add(apertureAnchor);
const imageAnchor = new THREE.Object3D();
imageAnchor.position.set(-0.48, 0.43, rearFrameZ - 0.03);
rig.add(imageAnchor);
const subjectAnchor = new THREE.Object3D();
subjectAnchor.position.set(0.28, 2.16, 0.02);
subject.add(subjectAnchor);
scene.updateMatrixWorld(true);
const apertureWorld = new THREE.Vector3();
apertureGroup.getWorldPosition(apertureWorld);
const axisGeometry = new THREE.BufferGeometry().setFromPoints([
apertureWorld.clone(),
subjectAim.clone()
]);
const opticalAxis = new THREE.Line(
axisGeometry,
new THREE.LineDashedMaterial({
color: 0xa17b42,
dashSize: 0.17,
gapSize: 0.13,
transparent: true,
opacity: 0.62,
depthWrite: false
})
);
opticalAxis.computeLineDistances();
scene.add(opticalAxis);
// -------------------------------------------------------------------------
// Direct camera controls — no Three.js addons
// -------------------------------------------------------------------------
const orbit = {
target: new THREE.Vector3(-0.20, 1.18, 0.20),
radius: 10.8,
theta: 0.38,
phi: 1.16
};
const initialOrbit = {
target: orbit.target.clone(),
radius: orbit.radius,
theta: orbit.theta,
phi: orbit.phi
};
function updateCameraPosition() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
function resetCamera() {
orbit.target.copy(initialOrbit.target);
orbit.radius = initialOrbit.radius;
orbit.theta = initialOrbit.theta;
orbit.phi = initialOrbit.phi;
updateCameraPosition();
}
const pointer = {
active: false,
id: null,
x: 0,
y: 0
};
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", event => {
pointer.active = true;
pointer.id = event.pointerId;
pointer.x = event.clientX;
pointer.y = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.classList.add("dragging");
});
canvas.addEventListener("pointermove", event => {
if (!pointer.active || event.pointerId !== pointer.id) return;
const dx = event.clientX - pointer.x;
const dy = event.clientY - pointer.y;
pointer.x = event.clientX;
pointer.y = event.clientY;
if (event.shiftKey) {
const right = new THREE.Vector3();
const up = new THREE.Vector3();
camera.matrixWorld.extractBasis(right, up, new THREE.Vector3());
const panScale = orbit.radius * 0.0012;
orbit.target.addScaledVector(right, -dx * panScale);
orbit.target.addScaledVector(up, dy * panScale);
} else {
orbit.theta -= dx * 0.0055;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - dy * 0.0045,
0.38,
1.48
);
}
updateCameraPosition();
});
function endPointer(event) {
if (event.pointerId !== pointer.id) return;
pointer.active = false;
pointer.id = null;
canvas.classList.remove("dragging");
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
5.0,
18.0
);
updateCameraPosition();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetCamera);
canvas.addEventListener("keydown", event => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
orbit.theta -= 0.08;
break;
case "ArrowRight":
orbit.theta += 0.08;
break;
case "ArrowUp":
orbit.phi = Math.max(0.38, orbit.phi - 0.06);
break;
case "ArrowDown":
orbit.phi = Math.min(1.48, orbit.phi + 0.06);
break;
case "+":
case "=":
orbit.radius = Math.max(5, orbit.radius * 0.9);
break;
case "-":
orbit.radius = Math.min(18, orbit.radius * 1.1);
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
updateCameraPosition();
}
});
// -------------------------------------------------------------------------
// HTML annotation projection
// -------------------------------------------------------------------------
const annotationDefinitions = [
{
element: document.getElementById("apertureAnnotation"),
line: document.getElementById("apertureLeader"),
dot: document.getElementById("apertureDot"),
anchor: apertureAnchor,
offset: [92, -48]
},
{
element: document.getElementById("imageAnnotation"),
line: document.getElementById("imageLeader"),
dot: document.getElementById("imageDot"),
anchor: imageAnchor,
offset: [-112, 54]
},
{
element: document.getElementById("subjectAnnotation"),
line: document.getElementById("subjectLeader"),
dot: document.getElementById("subjectDot"),
anchor: subjectAnchor,
offset: [96, -38]
}
];
const projectedPoint = new THREE.Vector3();
function updateAnnotations() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const definition of annotationDefinitions) {
definition.anchor.getWorldPosition(projectedPoint);
projectedPoint.project(camera);
const anchorX = (projectedPoint.x * 0.5 + 0.5) * width;
const anchorY = (-projectedPoint.y * 0.5 + 0.5) * height;
const labelX = THREE.MathUtils.clamp(
anchorX + definition.offset[0],
88,
width - 88
);
const labelY = THREE.MathUtils.clamp(
anchorY + definition.offset[1],
112,
height - 130
);
const visible =
projectedPoint.z > -1 &&
projectedPoint.z < 1 &&
anchorX > -30 &&
anchorX < width + 30 &&
anchorY > -30 &&
anchorY < height + 30;
definition.element.style.left = `${labelX}px`;
definition.element.style.top = `${labelY}px`;
definition.element.style.opacity = visible ? "1" : "0";
definition.line.setAttribute("x1", anchorX);
definition.line.setAttribute("y1", anchorY);
definition.line.setAttribute("x2", labelX);
definition.line.setAttribute("y2", labelY);
definition.line.style.opacity = visible ? "1" : "0";
definition.dot.setAttribute("cx", anchorX);
definition.dot.setAttribute("cy", anchorY);
definition.dot.style.opacity = visible ? "1" : "0";
}
}
// -------------------------------------------------------------------------
// Aperture and exposure controls
// -------------------------------------------------------------------------
const apertureRange = document.getElementById("apertureRange");
const apertureValue = document.getElementById("apertureValue");
const apertureAnnotationValue =
document.getElementById("apertureAnnotationValue");
function updateAperture() {
const millimeters = Number(apertureRange.value);
const equivalentFNumber = 100 / millimeters;
const openingRadius = THREE.MathUtils.mapLinear(
millimeters,
12,
40,
0.065,
0.19
);
rebuildAperture(openingRadius);
apertureValue.textContent =
`Ø ${millimeters} mm · f/${equivalentFNumber.toFixed(1)} eq.`;
apertureAnnotationValue.textContent =
`Ø ${millimeters} mm · f/${equivalentFNumber.toFixed(1)} equivalent`;
}
apertureRange.addEventListener("input", updateAperture);
updateAperture();
const exposureRange = document.getElementById("exposureRange");
const exposureValue = document.getElementById("exposureValue");
const timerValue = document.getElementById("timerValue");
const timerProgress = document.getElementById("timerProgress");
const timerState = document.getElementById("timerState");
const timerToggle = document.getElementById("timerToggle");
let exposureDuration = Number(exposureRange.value);
let remainingTime = exposureDuration;
let timerRunning = false;
let previousTime = performance.now();
exposureRange.addEventListener("input", () => {
exposureDuration = Number(exposureRange.value);
remainingTime = exposureDuration;
timerRunning = false;
exposureValue.textContent = `${exposureDuration.toFixed(1)} seconds`;
timerState.textContent = "Ready";
timerToggle.textContent = "Start";
updateTimerDisplay();
});
timerToggle.addEventListener("click", () => {
if (remainingTime <= 0) remainingTime = exposureDuration;
timerRunning = !timerRunning;
timerToggle.textContent = timerRunning ? "Pause" : "Resume";
timerState.textContent = timerRunning ? "Running" : "Paused";
});
function updateTimerDisplay() {
timerValue.textContent = remainingTime.toFixed(1).padStart(4, "0");
timerProgress.style.transform =
`scaleX(${THREE.MathUtils.clamp(remainingTime / exposureDuration, 0, 1)})`;
}
document.getElementById("resetView").addEventListener("click", resetCamera);
const toggleAxisButton = document.getElementById("toggleAxis");
toggleAxisButton.addEventListener("click", () => {
opticalAxis.visible = !opticalAxis.visible;
toggleAxisButton.textContent =
opticalAxis.visible ? "Hide axis" : "Show axis";
});
// -------------------------------------------------------------------------
// Resize and animation loop
// -------------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
updateCameraPosition();
updateTimerDisplay();
function animate(now) {
requestAnimationFrame(animate);
const delta = Math.min((now - previousTime) / 1000, 0.1);
previousTime = now;
if (timerRunning) {
remainingTime = Math.max(0, remainingTime - delta);
if (remainingTime === 0) {
timerRunning = false;
timerState.textContent = "Complete";
timerToggle.textContent = "Restart";
}
updateTimerDisplay();
}
scene.updateMatrixWorld(true);
camera.updateMatrixWorld();
updateAnnotations();
renderer.render(scene, camera);
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```