Prompt specification
Build or customize the Three.js 3D scene "Three equal steps and landing" 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: Three equal steps and landing
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/three-equal-steps-and-landing-x2221
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing three steps and a landing. Build three equal-height steps terminating at a flat landing. Add dimension guides for rise and run, making the repeated geometry readable from an oblique viewpoint. Stylized solid forms.
Working Three.js Starter (three-equal-steps-and-landing-x2221):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Three Steps & Landing — Three.js</title>
<style>
:root {
--ink: #223331;
--muted: #69726e;
--paper: #ece8df;
--panel: rgba(247, 245, 239, 0.82);
--line: rgba(34, 51, 49, 0.16);
--accent: #315c60;
--warm: #c96a4c;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#app {
position: relative;
width: 100%;
height: 100%;
isolation: isolate;
}
#scene {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
cursor: grab;
touch-action: none;
}
#scene:active {
cursor: grabbing;
}
#labels {
position: absolute;
inset: 0;
z-index: 3;
overflow: hidden;
pointer-events: none;
}
.dim-label {
position: absolute;
display: flex;
align-items: center;
gap: 6px;
min-width: 68px;
padding: 5px 8px;
border: 1px solid rgba(49, 92, 96, 0.22);
border-radius: 999px;
background: rgba(249, 247, 241, 0.94);
color: var(--accent);
box-shadow: 0 5px 16px rgba(40, 48, 44, 0.08);
transform: translate(-50%, -50%);
white-space: nowrap;
backdrop-filter: blur(7px);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.08em;
}
.dim-label b {
color: var(--ink);
font-size: 10px;
letter-spacing: 0.035em;
}
.dim-label::before {
content: "";
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--accent);
}
.dim-label.landing {
color: #7c4938;
border-color: rgba(124, 73, 56, 0.22);
}
.dim-label.landing::before {
background: var(--warm);
}
.hud {
position: absolute;
z-index: 5;
pointer-events: none;
}
.intro {
top: clamp(22px, 4vw, 52px);
left: clamp(22px, 4vw, 58px);
width: min(330px, calc(100vw - 44px));
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 16px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 28px;
height: 2px;
background: var(--warm);
}
h1 {
margin: 0;
max-width: 300px;
font-size: clamp(38px, 5.1vw, 72px);
font-weight: 560;
letter-spacing: -0.065em;
line-height: 0.94;
}
.intro p {
max-width: 275px;
margin: 18px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.6;
}
.spec-panel {
position: absolute;
top: clamp(22px, 4vw, 52px);
right: clamp(22px, 4vw, 58px);
width: 208px;
padding: 16px 17px;
border: 1px solid var(--line);
border-radius: 15px;
background: var(--panel);
box-shadow: 0 14px 40px rgba(52, 58, 53, 0.06);
backdrop-filter: blur(12px);
}
.spec-title {
margin-bottom: 13px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.spec-row {
display: grid;
grid-template-columns: 10px 1fr auto;
align-items: center;
gap: 8px;
padding: 7px 0;
border-top: 1px solid rgba(34, 51, 49, 0.08);
font-size: 10px;
letter-spacing: 0.08em;
}
.spec-row:first-of-type {
border-top: 0;
}
.spec-row strong {
font-size: 11px;
letter-spacing: 0.02em;
}
.swatch {
width: 8px;
height: 8px;
border-radius: 2px;
}
.swatch.rise,
.swatch.run {
background: var(--accent);
}
.swatch.landing {
background: var(--warm);
}
.bottom-bar {
position: absolute;
right: clamp(22px, 4vw, 58px);
bottom: clamp(22px, 3vw, 38px);
left: clamp(22px, 4vw, 58px);
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 20px;
}
.hint {
color: var(--muted);
font-size: 10px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.hint span {
margin: 0 7px;
color: rgba(34, 51, 49, 0.35);
}
.controls {
display: flex;
align-items: center;
gap: 7px;
pointer-events: auto;
}
button {
appearance: none;
min-height: 35px;
padding: 0 13px;
border: 1px solid rgba(34, 51, 49, 0.15);
border-radius: 999px;
background: rgba(247, 245, 239, 0.86);
color: var(--ink);
cursor: pointer;
box-shadow: 0 4px 16px rgba(40, 48, 44, 0.05);
backdrop-filter: blur(10px);
font: inherit;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
transition:
background 160ms ease,
color 160ms ease,
transform 160ms ease;
}
button:hover {
background: var(--ink);
color: #f7f5ef;
transform: translateY(-1px);
}
button.active {
border-color: var(--ink);
background: var(--ink);
color: #f7f5ef;
}
#dimension-toggle {
margin-left: 5px;
}
.loading {
position: absolute;
inset: 0;
z-index: 10;
display: grid;
place-items: center;
background: var(--paper);
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
.loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.intro {
top: 22px;
left: 22px;
}
.eyebrow {
margin-bottom: 10px;
}
h1 {
max-width: 240px;
font-size: clamp(34px, 11vw, 52px);
}
.intro p {
display: none;
}
.spec-panel {
top: auto;
right: 18px;
bottom: 75px;
width: 176px;
padding: 11px 13px;
}
.spec-title {
display: none;
}
.spec-row {
padding: 5px 0;
}
.bottom-bar {
right: 18px;
bottom: 18px;
left: 18px;
align-items: center;
}
.hint {
display: none;
}
.controls {
width: 100%;
justify-content: center;
flex-wrap: wrap;
}
button {
min-height: 32px;
padding: 0 10px;
font-size: 9px;
}
.dim-label {
min-width: 56px;
padding: 4px 6px;
gap: 4px;
font-size: 8px;
}
.dim-label b {
font-size: 9px;
}
}
</style>
</head>
<body>
<main id="app">
<canvas id="scene" aria-label="Interactive three-dimensional model of three steps and a landing"></canvas>
<div id="labels"></div>
<header class="hud intro">
<div class="eyebrow">Form study / 03 levels</div>
<h1>Stair<br />to stillness.</h1>
<p>
Three equal rises resolve into a quiet, level landing. Dimension guides
expose the repeated geometry from every angle.
</p>
</header>
<aside class="hud spec-panel" aria-label="Model specifications">
<div class="spec-title">Dimensional system</div>
<div class="spec-row">
<i class="swatch rise"></i><span>RISE</span><strong>900 mm</strong>
</div>
<div class="spec-row">
<i class="swatch run"></i><span>RUN</span><strong>1800 mm</strong>
</div>
<div class="spec-row">
<i class="swatch landing"></i><span>LANDING</span><strong>3000 mm</strong>
</div>
</aside>
<footer class="hud bottom-bar">
<div class="hint">
Drag to orbit <span>·</span> Shift-drag to pan <span>·</span> Scroll to zoom
</div>
<div class="controls">
<button type="button" data-view="oblique" class="active">Oblique</button>
<button type="button" data-view="front">Front</button>
<button type="button" data-view="top">Top</button>
<button type="button" id="dimension-toggle" class="active">Dimensions on</button>
</div>
</footer>
<div class="loading" id="loading">Building stair study</div>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const labelsLayer = document.querySelector("#labels");
const loading = document.querySelector("#loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xece8df);
scene.fog = new THREE.Fog(0xece8df, 18, 36);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.OrthographicCamera(-8, 8, 5, -5, 0.1, 100);
const pivot = new THREE.Vector3(3.55, 1.05, 0);
const orbit = {
theta: 0.68,
phi: 1.03,
zoom: 1
};
const RISE = 0.9;
const RUN = 1.8;
const WIDTH = 3.2;
const LANDING_DEPTH = 3.0;
const TOTAL_HEIGHT = RISE * 3;
const model = new THREE.Group();
scene.add(model);
const guides = new THREE.Group();
scene.add(guides);
const dimensions = [];
const projectedLabels = [];
// Lighting
scene.add(new THREE.HemisphereLight(0xfffbf2, 0x9ba49e, 2.05));
const keyLight = new THREE.DirectionalLight(0xfff1dd, 4.25);
keyLight.position.set(5.5, 10, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -11;
keyLight.shadow.camera.right = 11;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.0004;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xc9e3e4, 1.25);
fillLight.position.set(-6, 5, -7);
scene.add(fillLight);
// Ground plane
const groundMaterial = new THREE.MeshStandardMaterial({
color: 0xe3ded3,
roughness: 1,
metalness: 0
});
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(42, 42),
groundMaterial
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.025;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(24, 24, 0xa9aaa1, 0xbab9af);
grid.position.y = -0.012;
grid.material.transparent = true;
grid.material.opacity = 0.16;
grid.material.depthWrite = false;
scene.add(grid);
// Solid architectural forms
const stepSide = new THREE.Color(0xc96a4c);
const stepTop = new THREE.Color(0xe18b62);
const landingSide = new THREE.Color(0x254e52);
const landingTop = new THREE.Color(0x3c7274);
const edgeColor = 0x653d31;
function addBlock(width, height, depth, x, y, sideColor, topColor) {
const geometry = new THREE.BoxGeometry(width, height, depth);
const side = new THREE.MeshStandardMaterial({
color: sideColor,
roughness: 0.78,
metalness: 0.02
});
const top = new THREE.MeshStandardMaterial({
color: topColor,
roughness: 0.72,
metalness: 0.01
});
const mesh = new THREE.Mesh(geometry, [
side, side, top, side, side, side
]);
mesh.position.set(x, y, 0);
mesh.castShadow = true;
mesh.receiveShadow = true;
model.add(mesh);
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry),
new THREE.LineBasicMaterial({
color: edgeColor,
transparent: true,
opacity: 0.2,
depthWrite: false
})
);
edges.position.copy(mesh.position);
model.add(edges);
return mesh;
}
// Three equal-height steps, built as solid masses.
for (let i = 0; i < 3; i++) {
const height = RISE * (i + 1);
addBlock(
RUN,
height,
WIDTH,
i * RUN + RUN / 2,
height / 2,
stepSide,
stepTop
);
// A slim nosing makes each repeated tread easier to read.
const nosing = new THREE.Mesh(
new THREE.BoxGeometry(0.055, 0.028, WIDTH * 0.91),
new THREE.MeshStandardMaterial({
color: 0xf0ad7e,
roughness: 0.68
})
);
nosing.position.set(
i * RUN + 0.028,
height + 0.014,
0
);
nosing.castShadow = true;
model.add(nosing);
}
// Level landing.
addBlock(
LANDING_DEPTH,
TOTAL_HEIGHT,
WIDTH,
3 * RUN + LANDING_DEPTH / 2,
TOTAL_HEIGHT / 2,
landingSide,
landingTop
);
const landingNosing = new THREE.Mesh(
new THREE.BoxGeometry(0.055, 0.028, WIDTH * 0.91),
new THREE.MeshStandardMaterial({
color: 0x6f9a98,
roughness: 0.65
})
);
landingNosing.position.set(
3 * RUN + 0.028,
TOTAL_HEIGHT + 0.014,
0
);
landingNosing.castShadow = true;
model.add(landingNosing);
// Dimension guide styling
const guideColor = 0x315c60;
const guideZ = WIDTH / 2 + 0.62;
const dimensionMaterial = new THREE.LineBasicMaterial({
color: guideColor,
transparent: true,
opacity: 0.8,
depthTest: false,
depthWrite: false
});
const extensionMaterial = new THREE.LineDashedMaterial({
color: guideColor,
transparent: true,
opacity: 0.42,
dashSize: 0.09,
gapSize: 0.065,
depthTest: false,
depthWrite: false
});
function addLine(points, material = dimensionMaterial) {
const geometry = new THREE.BufferGeometry().setFromPoints(
points.map(p => new THREE.Vector3(...p))
);
const line = new THREE.Line(geometry, material);
if (material.isLineDashedMaterial) {
line.computeLineDistances();
}
line.renderOrder = 20;
guides.add(line);
return line;
}
function addVerticalTick(x, y, z) {
addLine([
[x - 0.095, y, z - 0.095],
[x + 0.095, y, z + 0.095]
]);
}
function addHorizontalTick(x, y, z) {
addLine([
[x, y - 0.09, z - 0.08],
[x, y + 0.09, z + 0.08]
]);
}
function createDimensionLabel(text, anchor, className = "") {
const element = document.createElement("div");
element.className = `dim-label ${className}`.trim();
element.innerHTML = text;
labelsLayer.appendChild(element);
const item = {
element,
anchor: anchor.clone()
};
projectedLabels.push(item);
return item;
}
// Three vertical rise dimensions.
for (let i = 0; i < 3; i++) {
const x = i * RUN;
const y0 = i * RISE;
const y1 = (i + 1) * RISE;
addLine([
[x, y0, guideZ],
[x, y1, guideZ]
]);
addVerticalTick(x, y0, guideZ);
addVerticalTick(x, y1, guideZ);
addLine([
[x, y0, WIDTH / 2],
[x, y0, guideZ + 0.08]
], extensionMaterial);
addLine([
[x, y1, WIDTH / 2],
[x, y1, guideZ + 0.08]
], extensionMaterial);
createDimensionLabel(
"<span>RISE</span><b>900</b>",
new THREE.Vector3(x - 0.14, (y0 + y1) / 2, guideZ + 0.04)
);
}
// Three horizontal run dimensions.
for (let i = 0; i < 3; i++) {
const x0 = i * RUN;
const x1 = (i + 1) * RUN;
const y = (i + 1) * RISE + 0.16;
addLine([
[x0, y, guideZ],
[x1, y, guideZ]
]);
addHorizontalTick(x0, y, guideZ);
addHorizontalTick(x1, y, guideZ);
addLine([
[x0, (i + 1) * RISE, WIDTH / 2],
[x0, (i + 1) * RISE, guideZ + 0.08]
], extensionMaterial);
addLine([
[x1, (i + 1) * RISE, WIDTH / 2],
[x1, (i + 1) * RISE, guideZ + 0.08]
], extensionMaterial);
createDimensionLabel(
"<span>RUN</span><b>1800</b>",
new THREE.Vector3((x0 + x1) / 2, y, guideZ + 0.04)
);
}
// Landing depth dimension.
const landingY = TOTAL_HEIGHT + 0.42;
const landingX0 = 3 * RUN;
const landingX1 = landingX0 + LANDING_DEPTH;
addLine([
[landingX0, landingY, guideZ],
[landingX1, landingY, guideZ]
]);
addHorizontalTick(landingX0, landingY, guideZ);
addHorizontalTick(landingX1, landingY, guideZ);
addLine([
[landingX0, TOTAL_HEIGHT, WIDTH / 2],
[landingX0, landingY, guideZ + 0.08]
], extensionMaterial);
addLine([
[landingX1, TOTAL_HEIGHT, WIDTH / 2],
[landingX1, landingY, guideZ + 0.08]
], extensionMaterial);
createDimensionLabel(
"<span>LANDING</span><b>3000</b>",
new THREE.Vector3(
(landingX0 + landingX1) / 2,
landingY,
guideZ + 0.04
),
"landing"
);
// Camera and manual controls
const CAMERA_RADIUS = 14;
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
pivot.x + CAMERA_RADIUS * sinPhi * Math.sin(orbit.theta),
pivot.y + CAMERA_RADIUS * Math.cos(orbit.phi),
pivot.z + CAMERA_RADIUS * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(pivot);
camera.zoom = orbit.zoom;
camera.updateProjectionMatrix();
camera.updateMatrixWorld();
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
renderer.setSize(width, height, false);
const viewHeight = aspect < 0.8 ? 13.7 : 8.65;
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
pivot.y = aspect < 0.8 ? 1.75 : 1.05;
updateCamera();
}
window.addEventListener("resize", resize);
resize();
let dragging = false;
let previousX = 0;
let previousY = 0;
let cameraAnimation = null;
canvas.addEventListener("pointerdown", event => {
if (event.button !== 0) return;
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
cameraAnimation = null;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
if (event.shiftKey) {
const right = new THREE.Vector3();
const up = new THREE.Vector3();
camera.matrixWorld.extractBasis(right, up, new THREE.Vector3());
const worldPerPixel =
(camera.top - camera.bottom) / camera.zoom / window.innerHeight;
pivot.addScaledVector(right, -dx * worldPerPixel);
pivot.addScaledVector(up, dy * worldPerPixel);
} else {
orbit.theta -= dx * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - dy * 0.005,
0.12,
1.43
);
}
updateCamera();
});
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();
cameraAnimation = null;
orbit.zoom = THREE.MathUtils.clamp(
orbit.zoom * Math.exp(-event.deltaY * 0.001),
0.62,
2.25
);
updateCamera();
},
{ passive: false }
);
const views = {
oblique: { theta: 0.68, phi: 1.03, zoom: 1 },
front: { theta: 0, phi: 1.29, zoom: 1.04 },
top: { theta: 0, phi: 0.16, zoom: 0.96 }
};
function animateToView(name) {
const target = views[name];
if (!target) return;
cameraAnimation = {
start: performance.now(),
duration: 650,
from: { ...orbit },
to: { ...target }
};
document.querySelectorAll("[data-view]").forEach(button => {
button.classList.toggle("active", button.dataset.view === name);
});
}
document.querySelectorAll("[data-view]").forEach(button => {
button.addEventListener("click", () => {
animateToView(button.dataset.view);
});
});
let dimensionsVisible = true;
const dimensionToggle = document.querySelector("#dimension-toggle");
dimensionToggle.addEventListener("click", () => {
dimensionsVisible = !dimensionsVisible;
guides.visible = dimensionsVisible;
dimensionToggle.classList.toggle("active", dimensionsVisible);
dimensionToggle.textContent = dimensionsVisible
? "Dimensions on"
: "Dimensions off";
});
// Project HTML dimension labels into the 3D scene.
const projected = new THREE.Vector3();
function updateLabels() {
for (const label of projectedLabels) {
if (!dimensionsVisible) {
label.element.style.display = "none";
continue;
}
projected.copy(label.anchor).project(camera);
const visible =
projected.z >= -1 &&
projected.z <= 1 &&
projected.x >= -1.2 &&
projected.x <= 1.2 &&
projected.y >= -1.2 &&
projected.y <= 1.2;
label.element.style.display = visible ? "flex" : "none";
if (!visible) continue;
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
label.element.style.left = `${x}px`;
label.element.style.top = `${y}px`;
}
}
function easeInOutCubic(value) {
return value < 0.5
? 4 * value * value * value
: 1 - Math.pow(-2 * value + 2, 3) / 2;
}
function render(time) {
requestAnimationFrame(render);
if (cameraAnimation) {
const progress = Math.min(
1,
(time - cameraAnimation.start) / cameraAnimation.duration
);
const eased = easeInOutCubic(progress);
orbit.theta =
cameraAnimation.from.theta +
(cameraAnimation.to.theta - cameraAnimation.from.theta) * eased;
orbit.phi =
cameraAnimation.from.phi +
(cameraAnimation.to.phi - cameraAnimation.from.phi) * eased;
orbit.zoom =
cameraAnimation.from.zoom +
(cameraAnimation.to.zoom - cameraAnimation.from.zoom) * eased;
if (progress >= 1) {
cameraAnimation = null;
}
}
updateCamera();
updateLabels();
renderer.render(scene, camera);
}
updateCamera();
requestAnimationFrame(render);
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 500);
});
</script>
</body>
</html>
```