Prompt specification
Build or customize the Three.js 3D scene "Wedge-block arch arrangement" 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: Wedge-block arch arrangement
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/wedge-block-arch-arrangement-x0389
Scene Description Prompt:
Place five wedge-shaped blocks on a curved assembly guide between two supports; the top central block should complete a visibly continuous arch profile. Use Three.js from cdnjs in a single HTML file, with stylized solid shapes.
Working Three.js Starter (wedge-block-arch-arrangement-x0389):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Five-Block Arch Assembly</title>
<style>
:root {
--ink: #20383e;
--muted: #65787a;
--panel: rgba(250, 251, 246, 0.88);
--border: rgba(32, 56, 62, 0.14);
--accent: #e97d4e;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e9eee8;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.info {
position: fixed;
top: 26px;
left: 28px;
z-index: 10;
width: min(350px, calc(100vw - 56px));
padding: 20px 22px;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 14px 42px rgba(35, 54, 54, 0.10);
backdrop-filter: blur(12px);
pointer-events: none;
}
.eyebrow {
margin-bottom: 7px;
color: #839291;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(24px, 3vw, 34px);
font-weight: 720;
letter-spacing: -0.045em;
line-height: 1.05;
}
.info p {
margin: 11px 0 16px;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.legend {
display: flex;
align-items: center;
gap: 9px;
padding-top: 13px;
border-top: 1px solid var(--border);
color: var(--muted);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.swatch {
width: 12px;
height: 12px;
border-radius: 3px;
background: var(--accent);
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.controls {
position: fixed;
right: 24px;
bottom: 22px;
z-index: 10;
display: flex;
gap: 7px;
padding: 7px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--panel);
box-shadow: 0 10px 30px rgba(35, 54, 54, 0.10);
backdrop-filter: blur(12px);
}
button {
width: 38px;
height: 36px;
border: 0;
border-radius: 8px;
background: transparent;
color: var(--ink);
font: 700 18px/1 system-ui, sans-serif;
cursor: pointer;
transition: background 150ms ease, transform 150ms ease;
}
button:hover {
background: rgba(32, 56, 62, 0.08);
}
button:active {
transform: scale(0.94);
}
button.reset {
width: auto;
padding: 0 12px;
font-size: 11px;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.hint {
position: fixed;
left: 28px;
bottom: 26px;
z-index: 10;
color: rgba(32, 56, 62, 0.58);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.04em;
pointer-events: none;
}
@media (max-width: 700px) {
.info {
top: 14px;
left: 14px;
padding: 15px 17px;
}
.info p {
display: none;
}
.legend {
margin-top: 12px;
padding-top: 10px;
}
.controls {
right: 14px;
bottom: 14px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<section class="info">
<div class="eyebrow">Structural study · 05 pieces</div>
<h1>Arch Assembly</h1>
<p>
Five tapered blocks follow a curved assembly guide. The highlighted
central keystone closes the continuous upper profile.
</p>
<div class="legend">
<span class="swatch"></span>
<span>Central keystone</span>
</div>
</section>
<div class="hint">Drag to orbit · Scroll to zoom</div>
<div class="controls" aria-label="Camera controls">
<button id="zoomIn" aria-label="Zoom in">+</button>
<button id="zoomOut" aria-label="Zoom out">−</button>
<button id="reset" class="reset">Reset view</button>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9eee8);
scene.fog = new THREE.Fog(0xe9eee8, 17, 31);
const camera = new THREE.PerspectiveCamera(
38,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
document.body.prepend(renderer.domElement);
// Lighting
scene.add(new THREE.HemisphereLight(0xe8f4f1, 0x766554, 2.25));
const keyLight = new THREE.DirectionalLight(0xfff0d8, 3.8);
keyLight.position.set(-5.5, 10, 7.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -9;
keyLight.shadow.camera.right = 9;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -7;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.normalBias = 0.035;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb9dce4, 1.7);
fillLight.position.set(7, 4, -6);
scene.add(fillLight);
const rimLight = new THREE.DirectionalLight(0xffd0a8, 1.15);
rimLight.position.set(-4, 2, -7);
scene.add(rimLight);
// Materials
const supportMaterial = new THREE.MeshStandardMaterial({
color: 0x294954,
roughness: 0.62,
metalness: 0.16
});
const supportAccentMaterial = new THREE.MeshStandardMaterial({
color: 0xd7a849,
roughness: 0.44,
metalness: 0.48
});
const guideMaterial = new THREE.MeshStandardMaterial({
color: 0x35545c,
roughness: 0.42,
metalness: 0.58
});
const groundMaterial = new THREE.MeshStandardMaterial({
color: 0xd6ddd6,
roughness: 0.92,
metalness: 0
});
const platformMaterial = new THREE.MeshStandardMaterial({
color: 0xcbd5ce,
roughness: 0.86,
metalness: 0.02
});
// Display platform
const platform = new THREE.Mesh(
new THREE.CylinderGeometry(7.15, 7.35, 0.2, 96),
platformMaterial
);
platform.position.y = -1.48;
platform.receiveShadow = true;
scene.add(platform);
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(80, 80),
groundMaterial
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -1.59;
ground.receiveShadow = true;
scene.add(ground);
// Smooth arch guide and the six shared profile nodes.
const archY = (x) => 3.05 - 0.115 * x * x;
const guideY = (x) => archY(x) - 0.84;
const profileNodes = [
new THREE.Vector3(-4.5, archY(-4.5), 0),
new THREE.Vector3(-2.75, archY(-2.75), 0),
new THREE.Vector3(-1.05, archY(-1.05), 0),
new THREE.Vector3(1.05, archY(1.05), 0),
new THREE.Vector3(2.75, archY(2.75), 0),
new THREE.Vector3(4.5, archY(4.5), 0)
];
// Curved front guide rail.
const guidePoints = [];
for (let i = 0; i <= 100; i++) {
const x = -4.75 + 9.5 * (i / 100);
guidePoints.push(new THREE.Vector3(x, guideY(x), 0.79));
}
const guideCurve = new THREE.CatmullRomCurve3(guidePoints);
const frontGuide = new THREE.Mesh(
new THREE.TubeGeometry(guideCurve, 160, 0.105, 10, false),
guideMaterial
);
frontGuide.castShadow = true;
scene.add(frontGuide);
// Rear guide rail gives the assembly track more depth.
const rearGuide = new THREE.Mesh(
new THREE.TubeGeometry(guideCurve, 160, 0.065, 8, false),
supportAccentMaterial
);
rearGuide.position.z = -1.48;
scene.add(rearGuide);
// A fine datum line emphasizes that all five upper edges form one arch.
const datumPath = new THREE.CurvePath();
for (let i = 0; i < profileNodes.length - 1; i++) {
const a = profileNodes[i].clone();
const b = profileNodes[i + 1].clone();
a.z = 0.735;
b.z = 0.735;
datumPath.add(new THREE.LineCurve3(a, b));
}
const datum = new THREE.Mesh(
new THREE.TubeGeometry(datumPath, 120, 0.025, 6, false),
supportAccentMaterial
);
scene.add(datum);
const faceColors = [
0xe8d1b1,
0xf0dfc0,
0xe97d4e,
0xf0dfc0,
0xe8d1b1
];
const sideColors = [
0xa77e61,
0xb38c6b,
0x9e4f36,
0xb38c6b,
0xa77e61
];
const blockDepth = 1.35;
const blockThickness = 0.72;
// Exactly five tapered blocks.
for (let i = 0; i < 5; i++) {
const a = profileNodes[i];
const b = profileNodes[i + 1];
const inset = i === 2 ? 0.15 : 0.075;
const shape = new THREE.Shape();
shape.moveTo(a.x, a.y);
shape.lineTo(b.x, b.y);
shape.lineTo(b.x - inset, b.y - blockThickness);
shape.lineTo(a.x + inset, a.y - blockThickness);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: blockDepth,
bevelEnabled: true,
bevelSegments: 2,
bevelSize: 0.035,
bevelThickness: 0.035,
curveSegments: 4,
steps: 1
});
geometry.translate(0, 0, -blockDepth / 2);
const faceMaterial = new THREE.MeshStandardMaterial({
color: faceColors[i],
roughness: 0.7,
metalness: 0.03
});
const sideMaterial = new THREE.MeshStandardMaterial({
color: sideColors[i],
roughness: 0.76,
metalness: 0.02
});
const block = new THREE.Mesh(geometry, [faceMaterial, sideMaterial]);
block.castShadow = true;
block.receiveShadow = true;
scene.add(block);
// Small front fastener on each block.
const fastener = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.105, 0.055, 14),
i === 2
? new THREE.MeshStandardMaterial({
color: 0x713b2d,
roughness: 0.4,
metalness: 0.58
})
: supportAccentMaterial
);
fastener.rotation.x = Math.PI / 2;
fastener.position.set(
(a.x + b.x) / 2,
(a.y + b.y) / 2 - 0.29,
blockDepth / 2 + 0.048
);
fastener.castShadow = true;
scene.add(fastener);
}
// Small seat brackets visually connect the blocks to the curved guide.
for (let i = 0; i < 5; i++) {
const a = profileNodes[i];
const b = profileNodes[i + 1];
const x = (a.x + b.x) / 2;
const blockBottom = (a.y + b.y) / 2 - blockThickness;
const railY = guideY(x);
const height = Math.max(0.08, blockBottom - railY);
const bracket = new THREE.Mesh(
new THREE.CylinderGeometry(0.075, 0.075, height, 10),
supportAccentMaterial
);
bracket.position.set(x, railY + height / 2, 0.79);
bracket.castShadow = true;
scene.add(bracket);
}
// Two supporting end pedestals.
function createSupport(side) {
const group = new THREE.Group();
const x = side * 4.78;
const topY = guideY(x);
const baseY = -1.12;
const postHeight = topY - baseY;
const base = new THREE.Mesh(
new THREE.BoxGeometry(1.55, 0.25, 1.9),
supportMaterial
);
base.position.set(x, -1.25, 0);
base.castShadow = true;
base.receiveShadow = true;
group.add(base);
const foot = new THREE.Mesh(
new THREE.BoxGeometry(1.12, 0.17, 1.48),
supportAccentMaterial
);
foot.position.set(x, -1.06, 0);
foot.castShadow = true;
group.add(foot);
const post = new THREE.Mesh(
new THREE.CylinderGeometry(0.22, 0.34, postHeight, 6),
supportMaterial
);
post.position.set(x, baseY + postHeight / 2, 0);
post.rotation.z = side * 0.11;
post.castShadow = true;
group.add(post);
const saddle = new THREE.Mesh(
new THREE.BoxGeometry(0.72, 0.16, 1.78),
supportMaterial
);
saddle.position.set(x, topY, 0);
saddle.castShadow = true;
group.add(saddle);
const saddleStripe = new THREE.Mesh(
new THREE.BoxGeometry(0.74, 0.055, 1.8),
supportAccentMaterial
);
saddleStripe.position.set(x, topY + 0.08, 0);
group.add(saddleStripe);
scene.add(group);
}
createSupport(-1);
createSupport(1);
// Custom camera controls — no external control modules.
const target = new THREE.Vector3(0, 1.02, 0);
const initial = {
theta: 0.2,
phi: 1.16,
radius: 14.5
};
let theta = initial.theta;
let phi = initial.phi;
let radius = initial.radius;
let targetTheta = theta;
let targetPhi = phi;
let targetRadius = radius;
let dragging = false;
let previousX = 0;
let previousY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
targetTheta -= dx * 0.006;
targetPhi = THREE.MathUtils.clamp(
targetPhi - dy * 0.005,
0.48,
1.43
);
previousX = event.clientX;
previousY = event.clientY;
});
function endDrag(event) {
dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
targetRadius = THREE.MathUtils.clamp(
targetRadius * Math.exp(event.deltaY * 0.001),
8.5,
21
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetCamera);
document.getElementById("zoomIn").addEventListener("click", () => {
targetRadius = Math.max(8.5, targetRadius - 1.1);
});
document.getElementById("zoomOut").addEventListener("click", () => {
targetRadius = Math.min(21, targetRadius + 1.1);
});
document.getElementById("reset").addEventListener("click", resetCamera);
function resetCamera() {
targetTheta = initial.theta;
targetPhi = initial.phi;
targetRadius = initial.radius;
}
window.addEventListener("keydown", (event) => {
if (event.key === "ArrowLeft") targetTheta += 0.08;
if (event.key === "ArrowRight") targetTheta -= 0.08;
if (event.key === "ArrowUp") {
targetPhi = Math.max(0.48, targetPhi - 0.05);
}
if (event.key === "ArrowDown") {
targetPhi = Math.min(1.43, targetPhi + 0.05);
}
if (event.key === "+" || event.key === "=") {
targetRadius = Math.max(8.5, targetRadius - 1);
}
if (event.key === "-") {
targetRadius = Math.min(21, targetRadius + 1);
}
});
function updateCamera() {
const damping = 0.085;
theta += (targetTheta - theta) * damping;
phi += (targetPhi - phi) * damping;
radius += (targetRadius - radius) * damping;
const horizontalRadius = radius * Math.sin(phi);
camera.position.set(
target.x + horizontalRadius * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + horizontalRadius * Math.cos(theta)
);
camera.lookAt(target);
}
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
renderer.setAnimationLoop(() => {
updateCamera();
renderer.render(scene, camera);
});
</script>
</body>
</html>
```