Prompt specification
Build or customize the Three.js 3D scene "Facade Rhythm With Door and Window Bays" 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: Facade Rhythm With Door and Window Bays
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/facade-rhythm-with-door-and-window-bays-x3281
Scene Description Prompt:
Facade rhythm with door and window bays. Build an original facade strip with repeated bays and one deliberate entrance emphasis. Make the rhythm readable through geometry rather than copied decorative textures. Please build this with Three.js from cdnjs in one self-contained HTML file, using stylized solid shapes.
Working Three.js Starter (facade-rhythm-with-door-and-window-bays-x3281):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Threshold Rhythm — Three.js Facade</title>
<style>
:root {
color-scheme: dark;
--ink: #f4eee5;
--muted: rgba(244, 238, 229, 0.72);
--line: rgba(244, 238, 229, 0.24);
--glass: rgba(24, 31, 34, 0.62);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #cbd6da;
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: 24px;
left: 28px;
z-index: 10;
max-width: min(430px, calc(100vw - 120px));
color: var(--ink);
pointer-events: none;
text-shadow: 0 2px 18px rgba(22, 28, 31, 0.3);
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 9px;
color: var(--muted);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.eyebrow::before {
width: 28px;
height: 1px;
content: "";
background: currentColor;
}
h1 {
margin: 0;
font-size: clamp(28px, 4vw, 52px);
font-weight: 520;
letter-spacing: -0.045em;
line-height: 0.98;
}
.subtitle {
margin: 12px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.controls {
position: fixed;
right: 24px;
bottom: 22px;
z-index: 10;
display: flex;
align-items: center;
gap: 12px;
color: var(--ink);
}
.hint {
padding: 10px 13px;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--glass);
backdrop-filter: blur(12px);
color: var(--muted);
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
button {
min-width: 82px;
padding: 11px 15px;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--glass);
color: var(--ink);
font: inherit;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
cursor: pointer;
backdrop-filter: blur(12px);
transition:
background 160ms ease,
border-color 160ms ease,
transform 160ms ease;
}
button:hover {
border-color: rgba(244, 238, 229, 0.55);
background: rgba(24, 31, 34, 0.82);
transform: translateY(-1px);
}
@media (max-width: 700px) {
.info {
top: 18px;
left: 18px;
}
.subtitle {
max-width: 270px;
}
.controls {
right: 16px;
bottom: 16px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<header class="info">
<div class="eyebrow">Facade study / 07 bays</div>
<h1>Threshold<br />Rhythm</h1>
<p class="subtitle">
Repeated window bays and narrow service doors establish the cadence.
One projecting clay canopy marks the principal entrance.
</p>
</header>
<div class="controls">
<div class="hint">Drag to orbit · Wheel to zoom</div>
<button id="reset" type="button">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";
// ---------------------------------------------------------------------
// Renderer and scene
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xcbd6da);
scene.fog = new THREE.Fog(0xcbd6da, 34, 78);
const camera = new THREE.PerspectiveCamera(
38,
innerWidth / innerHeight,
0.1,
120
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive three-dimensional facade with repeated window and door bays"
);
document.body.prepend(renderer.domElement);
// ---------------------------------------------------------------------
// Materials
// ---------------------------------------------------------------------
const material = (color, roughness = 0.82, metalness = 0.0) =>
new THREE.MeshStandardMaterial({
color,
roughness,
metalness
});
const mats = {
plaster: material(0xd6c1a1),
panel: material(0xcbb493),
stone: material(0xe5d8c1),
stoneSide: material(0xc9b99d),
reveal: material(0x252e30),
glass: material(0x527783, 0.22, 0.32),
glassDark: material(0x304d57, 0.18, 0.38),
wood: material(0x49382f),
doorPaint: material(0x40575a),
doorInset: material(0x334649),
bronze: material(0x8d6747, 0.38, 0.58),
clay: material(0xa85e49),
clayDark: material(0x754235),
asphalt: material(0x596266, 0.96),
sidewalk: material(0xa7aaa4, 0.94),
ground: material(0x7c827d, 0.96),
foliage: material(0x536958, 0.92),
soil: material(0x403d35, 1.0)
};
const lampMaterial = new THREE.MeshStandardMaterial({
color: 0xffdf9c,
emissive: 0xffb85d,
emissiveIntensity: 3.2,
roughness: 0.32
});
// ---------------------------------------------------------------------
// Geometry helpers
// ---------------------------------------------------------------------
function box(
width,
height,
depth,
x,
y,
z,
mat,
castShadow = true,
receiveShadow = true
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
mat
);
mesh.position.set(x, y, z);
mesh.castShadow = castShadow;
mesh.receiveShadow = receiveShadow;
scene.add(mesh);
return mesh;
}
function beamBetween(a, b, width, depth, mat) {
const direction = new THREE.Vector3().subVectors(b, a);
const midpoint = new THREE.Vector3()
.addVectors(a, b)
.multiplyScalar(0.5);
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, direction.length(), depth),
mat
);
mesh.position.copy(midpoint);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.clone().normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
function addWindow(x, y, width, height, upper = false) {
const frame = 0.13;
// Dark inset and solid glass pane.
box(
width + 0.12,
height + 0.12,
0.10,
x,
y,
1.50,
mats.reveal
);
box(
width - 0.16,
height - 0.16,
0.045,
x,
y,
1.565,
upper ? mats.glass : mats.glassDark
);
// Projecting stone jambs.
box(
frame,
height + frame * 2,
0.19,
x - width / 2 - frame / 2,
y,
1.63,
mats.stone
);
box(
frame,
height + frame * 2,
0.19,
x + width / 2 + frame / 2,
y,
1.63,
mats.stone
);
// Head and lower frame.
box(
width + frame * 2,
frame,
0.19,
x,
y + height / 2 + frame / 2,
1.63,
mats.stone
);
box(
width + frame * 2,
frame,
0.17,
x,
y - height / 2 - frame / 2,
1.62,
mats.stone
);
// Window mullions create the bay rhythm through solid geometry.
if (width > 1.0) {
box(
0.075,
height - 0.12,
0.11,
x,
y,
1.65,
mats.stoneSide
);
}
box(
width - 0.10,
0.065,
0.10,
x,
y + height * (upper ? 0.16 : -0.13),
1.65,
mats.stoneSide
);
// Deep sill and shallow lintel cap.
box(
width + 0.40,
0.14,
0.43,
x,
y - height / 2 - 0.14,
1.65,
mats.stone
);
box(
width + 0.44,
0.16,
0.36,
x,
y + height / 2 + 0.17,
1.64,
mats.stone
);
}
function addServiceDoor(x) {
// Recess and transom.
box(1.10, 4.18, 0.11, x, 2.91, 1.50, mats.reveal);
box(0.76, 0.58, 0.045, x, 4.54, 1.64, mats.glassDark);
// Painted lower door leaf.
box(0.79, 3.18, 0.10, x, 2.50, 1.64, mats.doorPaint);
box(0.55, 0.92, 0.04, x, 1.55, 1.705, mats.doorInset);
// Upper glazed panel.
box(0.54, 1.13, 0.04, x, 3.22, 1.705, mats.glassDark);
// Frame and threshold.
box(0.12, 4.24, 0.21, x - 0.54, 2.91, 1.65, mats.stone);
box(0.12, 4.24, 0.21, x + 0.54, 2.91, 1.65, mats.stone);
box(1.20, 0.16, 0.29, x, 5.04, 1.66, mats.stone);
box(1.22, 0.14, 0.38, x, 0.88, 1.66, mats.stone);
// Transom bar and handle.
box(0.84, 0.07, 0.13, x, 4.22, 1.69, mats.stoneSide);
box(0.055, 0.48, 0.08, x + 0.25, 2.66, 1.75, mats.bronze);
}
function addDoorLeaf(x, y, width, height) {
box(width, height, 0.11, x, y, 1.66, mats.wood);
// Recessed lower panel.
box(
width - 0.20,
0.88,
0.045,
x,
y - height / 2 + 0.61,
1.735,
mats.doorInset
);
// Upper glazed panel.
box(
width - 0.20,
1.60,
0.045,
x,
y + 0.48,
1.735,
mats.glassDark
);
// Narrow vertical stile.
box(
0.07,
height - 0.20,
0.06,
x,
y,
1.755,
mats.bronze
);
}
function addLamp(x, y, z) {
box(0.26, 0.44, 0.12, x, y, z, mats.bronze);
box(0.14, 0.27, 0.15, x, y, z + 0.10, lampMaterial);
box(0.34, 0.07, 0.30, x, y + 0.25, z + 0.08, mats.bronze);
}
// ---------------------------------------------------------------------
// Ground and street
// ---------------------------------------------------------------------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(120, 120),
mats.ground
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.03;
ground.receiveShadow = true;
scene.add(ground);
box(31, 0.26, 7.2, 0, 0.10, 4.2, mats.sidewalk);
box(31, 0.20, 0.34, 0, 0.07, 8.05, mats.stoneSide);
box(100, 0.06, 36, 0, 0.015, 25, mats.asphalt, false, true);
// ---------------------------------------------------------------------
// Main facade volume
// ---------------------------------------------------------------------
box(23.4, 10.4, 2.8, 0, 5.65, 0, mats.plaster);
box(23.7, 0.45, 3.1, 0, 0.225, 0, mats.stoneSide);
box(23.65, 0.22, 3.25, 0, 0.53, 0, mats.stone);
// Strong projecting cornice and low parapet.
box(23.9, 0.26, 3.30, 0, 10.86, 0, mats.stoneSide);
box(24.2, 0.34, 3.60, 0, 11.13, 0, mats.stone);
box(24.0, 0.20, 3.35, 0, 11.39, 0, mats.stoneSide);
// ---------------------------------------------------------------------
// Repeated bays
// ---------------------------------------------------------------------
const bayCenters = [
-9.45,
-6.30,
-3.15,
0.00,
3.15,
6.30,
9.45
];
const bayWidth = 3.15;
const entranceIndex = 2;
const entranceX = bayCenters[entranceIndex];
const lowerBayTypes = [
"door",
"window",
"entrance",
"window",
"door",
"window",
"door"
];
// Recessed field panels inside each structural bay.
bayCenters.forEach((x) => {
box(2.68, 9.54, 0.075, x, 5.54, 1.42, mats.panel);
});
// Eight narrow piers divide the facade into seven regular bays.
for (let i = 0; i < 8; i++) {
const x = -11.025 + i * bayWidth;
box(0.27, 10.02, 0.34, x, 5.67, 1.55, mats.stone);
box(0.39, 0.28, 0.44, x, 0.79, 1.58, mats.stoneSide);
box(0.40, 0.24, 0.46, x, 10.50, 1.59, mats.stone);
}
// The middle course is interrupted at the entrance.
const courseLeftEnd = entranceX - 1.62;
const courseRightStart = entranceX + 1.62;
const courseLeftWidth = courseLeftEnd - (-11.2);
const courseRightWidth = 11.2 - courseRightStart;
box(
courseLeftWidth,
0.22,
0.37,
(-11.2 + courseLeftEnd) / 2,
5.56,
1.59,
mats.stone
);
box(
courseRightWidth,
0.22,
0.37,
(courseRightStart + 11.2) / 2,
5.56,
1.59,
mats.stone
);
// Repeated upper windows and lower door/window variants.
bayCenters.forEach((x, index) => {
addWindow(x, 8.02, 1.34, 2.13, true);
// Small repeated shadow slot above each upper window.
box(2.22, 0.10, 0.08, x, 9.66, 1.51, mats.reveal);
box(2.48, 0.12, 0.19, x, 9.76, 1.57, mats.stone);
const lowerType = lowerBayTypes[index];
if (lowerType === "window") {
addWindow(x, 3.30, 1.46, 2.34, false);
} else if (lowerType === "door") {
addServiceDoor(x);
}
});
// ---------------------------------------------------------------------
// Principal entrance: recessed portal, double doors, transom,
// projecting clay canopy, lamps, braces, and steps.
// ---------------------------------------------------------------------
// Clay-colored portal field contrasts with the neutral facade.
box(
2.72,
5.20,
0.12,
entranceX,
3.18,
1.49,
mats.clay
);
// Deep portal opening.
box(
2.30,
4.38,
0.11,
entranceX,
3.03,
1.57,
mats.reveal
);
// Two substantial door leaves.
addDoorLeaf(entranceX - 0.56, 2.79, 1.02, 3.60);
addDoorLeaf(entranceX + 0.56, 2.79, 1.02, 3.60);
// Glazed transom.
box(
2.06,
0.58,
0.045,
entranceX,
4.93,
1.72,
mats.glassDark
);
box(
0.07,
0.62,
0.10,
entranceX,
4.93,
1.76,
mats.bronze
);
// Stone portal jambs and lintel.
box(
0.22,
4.57,
0.25,
entranceX - 1.23,
3.03,
1.68,
mats.stone
);
box(
0.22,
4.57,
0.25,
entranceX + 1.23,
3.03,
1.68,
mats.stone
);
box(
2.70,
0.27,
0.29,
entranceX,
5.43,
1.69,
mats.stone
);
box(
2.52,
0.16,
0.43,
entranceX,
0.91,
1.70,
mats.stone
);
// Cantilevered canopy.
box(
3.28,
0.21,
1.48,
entranceX,
6.22,
2.02,
mats.clay
);
box(
3.12,
0.065,
1.30,
entranceX,
6.09,
2.02,
mats.clayDark
);
box(
3.34,
0.21,
0.16,
entranceX,
6.08,
2.72,
mats.bronze
);
// Angular canopy braces.
beamBetween(
new THREE.Vector3(entranceX - 0.93, 5.30, 1.69),
new THREE.Vector3(entranceX - 0.93, 6.04, 2.38),
0.09,
0.09,
mats.bronze
);
beamBetween(
new THREE.Vector3(entranceX + 0.93, 5.30, 1.69),
new THREE.Vector3(entranceX + 0.93, 6.04, 2.38),
0.09,
0.09,
mats.bronze
);
// Wall lamps.
addLamp(entranceX - 1.37, 4.75, 1.76);
addLamp(entranceX + 1.37, 4.75, 1.76);
const entranceLight = new THREE.PointLight(
0xffbd73,
13,
6,
2
);
entranceLight.position.set(entranceX, 4.78, 2.30);
scene.add(entranceLight);
// Three shallow steps lead to the emphasized threshold.
box(3.85, 0.18, 1.92, entranceX, 0.19, 2.16, mats.stoneSide);
box(3.48, 0.18, 1.55, entranceX, 0.36, 1.91, mats.stone);
box(3.12, 0.22, 1.16, entranceX, 0.55, 1.68, mats.stone);
box(2.72, 0.17, 0.56, entranceX, 0.75, 1.58, mats.stone);
// ---------------------------------------------------------------------
// Small street-scale elements
// ---------------------------------------------------------------------
function bollard(x, z) {
const post = new THREE.Mesh(
new THREE.CylinderGeometry(0.075, 0.10, 0.92, 12),
mats.bronze
);
post.position.set(x, 0.66, z);
post.castShadow = true;
post.receiveShadow = true;
scene.add(post);
const cap = new THREE.Mesh(
new THREE.SphereGeometry(0.105, 12, 8),
mats.bronze
);
cap.position.set(x, 1.12, z);
cap.castShadow = true;
scene.add(cap);
}
bollard(entranceX - 2.35, 3.55);
bollard(entranceX + 2.35, 3.55);
// Low planters frame the entrance without obscuring its geometry.
function planter(x) {
box(1.55, 0.46, 0.82, x, 0.43, 3.10, mats.stoneSide);
box(1.35, 0.08, 0.64, x, 0.67, 3.10, mats.soil);
const shrub = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.48, 1),
mats.foliage
);
shrub.scale.set(1.25, 0.82, 0.82);
shrub.position.set(x, 0.99, 3.10);
shrub.castShadow = true;
shrub.receiveShadow = true;
scene.add(shrub);
}
planter(entranceX - 4.35);
planter(entranceX + 4.35);
// ---------------------------------------------------------------------
// Lighting
// ---------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(
0xddebf0,
0x756552,
1.75
);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe1b8, 3.1);
sun.position.set(-12, 20, 16);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -20;
sun.shadow.camera.right = 20;
sun.shadow.camera.top = 20;
sun.shadow.camera.bottom = -10;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 65;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const coolFill = new THREE.DirectionalLight(0xbdd8e4, 0.75);
coolFill.position.set(16, 10, 9);
scene.add(coolFill);
const ambient = new THREE.AmbientLight(0xffffff, 0.14);
scene.add(ambient);
// ---------------------------------------------------------------------
// Direct camera controls: drag orbit, wheel/pinch zoom, keyboard.
// ---------------------------------------------------------------------
const target = new THREE.Vector3(0, 5.35, 0);
const controls = {
radius: 29,
theta: 0.28,
phi: 1.25
};
function updateCamera() {
const sinPhi = Math.sin(controls.phi);
const cosPhi = Math.cos(controls.phi);
camera.position.set(
target.x + controls.radius * sinPhi * Math.sin(controls.theta),
target.y + controls.radius * cosPhi,
target.z + controls.radius * sinPhi * Math.cos(controls.theta)
);
camera.lookAt(target);
}
function resetCamera() {
const portrait = innerWidth / innerHeight < 0.8;
controls.radius = portrait ? 49 : 29;
controls.theta = 0.28;
controls.phi = portrait ? 1.30 : 1.25;
updateCamera();
}
const pointers = new Map();
let previousPinchDistance = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 2) {
const [a, b] = Array.from(pointers.values());
previousPinchDistance = Math.hypot(a.x - b.x, a.y - b.y);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
if (pointers.size === 1) {
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
controls.theta -= dx * 0.0055;
controls.phi -= dy * 0.0045;
controls.theta = THREE.MathUtils.clamp(
controls.theta,
-1.15,
1.15
);
controls.phi = THREE.MathUtils.clamp(
controls.phi,
0.58,
1.47
);
previous.x = event.clientX;
previous.y = event.clientY;
} else if (pointers.size === 2) {
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
const [a, b] = Array.from(pointers.values());
const distance = Math.hypot(a.x - b.x, a.y - b.y);
if (previousPinchDistance > 0 && distance > 0) {
controls.radius *= previousPinchDistance / distance;
controls.radius = THREE.MathUtils.clamp(
controls.radius,
17,
62
);
}
previousPinchDistance = distance;
}
updateCamera();
});
function releasePointer(event) {
pointers.delete(event.pointerId);
previousPinchDistance = 0;
}
renderer.domElement.addEventListener(
"pointerup",
releasePointer
);
renderer.domElement.addEventListener(
"pointercancel",
releasePointer
);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.radius *= Math.exp(event.deltaY * 0.001);
controls.radius = THREE.MathUtils.clamp(
controls.radius,
17,
62
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
window.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
controls.theta += 0.08;
break;
case "ArrowRight":
controls.theta -= 0.08;
break;
case "ArrowUp":
controls.phi -= 0.06;
break;
case "ArrowDown":
controls.phi += 0.06;
break;
case "+":
case "=":
controls.radius -= 1.5;
break;
case "-":
case "_":
controls.radius += 1.5;
break;
case "r":
case "R":
resetCamera();
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
controls.theta = THREE.MathUtils.clamp(
controls.theta,
-1.15,
1.15
);
controls.phi = THREE.MathUtils.clamp(
controls.phi,
0.58,
1.47
);
controls.radius = THREE.MathUtils.clamp(
controls.radius,
17,
62
);
updateCamera();
}
});
document.getElementById("reset").addEventListener("click", () => {
resetCamera();
});
// ---------------------------------------------------------------------
// Resize and render loop
// ---------------------------------------------------------------------
function resize() {
const aspect = innerWidth / innerHeight;
camera.aspect = aspect;
camera.fov = aspect < 0.8 ? 50 : 38;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
}
window.addEventListener("resize", resize);
resize();
resetCamera();
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
</script>
</body>
</html>
```