Prompt specification
Build or customize the Three.js 3D scene "Window with three vertical fins" 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: Window with three vertical fins
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/window-with-three-vertical-fins-x2193
Scene Description Prompt:
A stylized window with three vertical shading fins casting separate oblique shadows. Build this in one HTML file with Three.js from cdnjs.
Working Three.js Starter (window-with-three-vertical-fins-x2193):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Oblique Shade — Three Fins</title>
<style>
:root {
--ink: #263b3c;
--paper: #f3eee4;
--accent: #c96d4a;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8d0c2;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene:active {
cursor: grabbing;
}
.title {
position: fixed;
top: clamp(22px, 4vw, 48px);
left: clamp(22px, 4vw, 52px);
z-index: 2;
pointer-events: none;
max-width: 420px;
}
.eyebrow {
margin: 0 0 10px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
color: var(--accent);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(38px, 6vw, 76px);
font-weight: 400;
line-height: 0.92;
letter-spacing: -0.055em;
}
.subtitle {
max-width: 330px;
margin: 16px 0 0;
font-size: 13px;
line-height: 1.55;
color: rgba(38, 59, 60, 0.72);
}
.controls {
position: fixed;
right: clamp(18px, 3vw, 38px);
bottom: clamp(18px, 3vw, 32px);
z-index: 3;
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px 10px 16px;
border: 1px solid rgba(38, 59, 60, 0.16);
border-radius: 999px;
background: rgba(243, 238, 228, 0.78);
backdrop-filter: blur(14px);
box-shadow: 0 12px 34px rgba(38, 59, 60, 0.12);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.05em;
}
button {
appearance: none;
border: 0;
border-radius: 999px;
padding: 9px 13px;
background: var(--ink);
color: var(--paper);
font: inherit;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
cursor: pointer;
transition: transform 160ms ease, background 160ms ease;
}
button:hover {
transform: translateY(-1px);
background: var(--accent);
}
.legend {
position: fixed;
left: clamp(22px, 4vw, 52px);
bottom: clamp(22px, 4vw, 38px);
z-index: 2;
display: flex;
align-items: center;
gap: 9px;
pointer-events: none;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
color: rgba(38, 59, 60, 0.65);
}
.legend::before {
content: "";
width: 28px;
height: 2px;
background: var(--accent);
transform: rotate(-22deg);
transform-origin: left center;
}
@media (max-width: 680px) {
.subtitle,
.legend {
display: none;
}
.controls {
left: 18px;
right: 18px;
justify-content: space-between;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive architectural scene with three window fins"></canvas>
<header class="title">
<p class="eyebrow">Solar study / 03</p>
<h1>Oblique<br />Shade</h1>
<p class="subtitle">
Three vertical fins interrupt a low-angle sun, drawing separate,
graphic shadows across the window.
</p>
</header>
<div class="legend">Three fins / three shadow paths</div>
<div class="controls">
<span>Drag to orbit · Scroll to zoom</span>
<button id="reset" type="button">Reset</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 canvas = document.querySelector("#scene");
const resetButton = document.querySelector("#reset");
const renderer = new THREE.WebGLRenderer({
canvas,
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;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8d0c2);
scene.fog = new THREE.Fog(0xd8d0c2, 24, 44);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(0, 3.15, -1.15);
const initialView = {
theta: 0.62,
phi: 0.3,
radius: 16.5
};
const view = {
theta: initialView.theta,
phi: initialView.phi,
radius: initialView.radius,
desiredTheta: initialView.theta,
desiredPhi: initialView.phi,
desiredRadius: initialView.radius
};
function updateCamera(instant = false) {
if (instant) {
view.theta = view.desiredTheta;
view.phi = view.desiredPhi;
view.radius = view.desiredRadius;
}
const horizontal = Math.cos(view.phi) * view.radius;
camera.position.set(
target.x + Math.sin(view.theta) * horizontal,
target.y + Math.sin(view.phi) * view.radius,
target.z + Math.cos(view.theta) * horizontal
);
camera.lookAt(target);
}
updateCamera(true);
// Soft sky and fill light.
scene.add(
new THREE.HemisphereLight(0xd8eff1, 0x8c735c, 1.75)
);
const fill = new THREE.DirectionalLight(0xb9d8e0, 0.55);
fill.position.set(7, 6, 10);
scene.add(fill);
// Low, side-biased sunlight produces the long diagonal fin shadows.
const sun = new THREE.DirectionalLight(0xffe3b5, 4.25);
sun.position.set(-10, 13, 6);
sun.target.position.set(1, 2, -3.55);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -13;
sun.shadow.camera.right = 13;
sun.shadow.camera.top = 13;
sun.shadow.camera.bottom = -13;
sun.shadow.camera.near = 0.5;
sun.shadow.camera.far = 42;
sun.shadow.bias = -0.00035;
sun.shadow.normalBias = 0.025;
scene.add(sun, sun.target);
// Materials.
const wallMaterial = new THREE.MeshStandardMaterial({
color: 0xd9c8ad,
roughness: 0.94
});
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0xb5aa98,
roughness: 0.93
});
const baseMaterial = new THREE.MeshStandardMaterial({
color: 0x817a6f,
roughness: 0.88
});
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0x31585a,
roughness: 0.48,
metalness: 0.24
});
const finMaterial = new THREE.MeshStandardMaterial({
color: 0xc96d4a,
roughness: 0.58,
metalness: 0.04
});
const finEdgeMaterial = new THREE.MeshStandardMaterial({
color: 0xf0aa72,
roughness: 0.5
});
// Floor and architectural plinth.
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(60, 60),
floorMaterial
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.015;
floor.receiveShadow = true;
scene.add(floor);
const plinth = new THREE.Mesh(
new THREE.BoxGeometry(15.8, 0.28, 2.25),
baseMaterial
);
plinth.position.set(0, 0.14, -2.75);
plinth.castShadow = true;
plinth.receiveShadow = true;
scene.add(plinth);
// The wall is assembled around a real opening so sunlight can pass through.
const opening = {
left: -2.8,
right: 2.8,
bottom: 1.15,
top: 5.95
};
const wallLeft = -8;
const wallRight = 8;
const wallTop = 7.8;
const wallDepth = 0.58;
const wallZ = -3.28;
function addWallBlock(width, height, x, y) {
const block = new THREE.Mesh(
new THREE.BoxGeometry(width, height, wallDepth),
wallMaterial
);
block.position.set(x, y, wallZ);
block.castShadow = true;
block.receiveShadow = true;
scene.add(block);
}
addWallBlock(
opening.left - wallLeft,
wallTop,
(wallLeft + opening.left) / 2,
wallTop / 2
);
addWallBlock(
wallRight - opening.right,
wallTop,
(wallRight + opening.right) / 2,
wallTop / 2
);
addWallBlock(
opening.right - opening.left,
opening.bottom,
0,
opening.bottom / 2
);
addWallBlock(
opening.right - opening.left,
wallTop - opening.top,
0,
(wallTop + opening.top) / 2
);
// A hand-drawn exterior view, created locally with a canvas texture.
const textureCanvas = document.createElement("canvas");
textureCanvas.width = 1024;
textureCanvas.height = 1024;
const context = textureCanvas.getContext("2d");
const skyGradient = context.createLinearGradient(0, 0, 0, 1024);
skyGradient.addColorStop(0, "#6db7c8");
skyGradient.addColorStop(0.56, "#b9d8d7");
skyGradient.addColorStop(1, "#e5dfbf");
context.fillStyle = skyGradient;
context.fillRect(0, 0, 1024, 1024);
context.fillStyle = "rgba(255, 226, 155, 0.9)";
context.beginPath();
context.arc(790, 215, 78, 0, Math.PI * 2);
context.fill();
context.fillStyle = "#86aaa0";
context.beginPath();
context.moveTo(0, 610);
context.quadraticCurveTo(190, 470, 385, 590);
context.quadraticCurveTo(570, 500, 750, 570);
context.quadraticCurveTo(900, 470, 1024, 525);
context.lineTo(1024, 1024);
context.lineTo(0, 1024);
context.closePath();
context.fill();
context.fillStyle = "#6e9188";
context.fillRect(0, 740, 1024, 284);
context.fillStyle = "#d4c79e";
context.fillRect(110, 565, 115, 190);
context.fillRect(710, 615, 170, 150);
context.fillStyle = "#f0e4bd";
for (let x = 132; x < 210; x += 38) {
context.fillRect(x, 592, 17, 31);
context.fillRect(x, 652, 17, 31);
}
context.fillStyle = "#4f7774";
for (let x = 735; x < 855; x += 42) {
context.fillRect(x, 642, 21, 36);
}
const windowTexture = new THREE.CanvasTexture(textureCanvas);
windowTexture.colorSpace = THREE.SRGBColorSpace;
windowTexture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
const windowMaterial = new THREE.MeshStandardMaterial({
map: windowTexture,
color: 0xffffff,
roughness: 0.9,
metalness: 0,
emissive: 0x31565b,
emissiveIntensity: 0.08
});
const windowPane = new THREE.Mesh(
new THREE.PlaneGeometry(
opening.right - opening.left,
opening.top - opening.bottom
),
windowMaterial
);
windowPane.position.set(
0,
(opening.top + opening.bottom) / 2,
-3.59
);
windowPane.receiveShadow = true;
scene.add(windowPane);
// Slim metal window frame.
const frameParts = [
[0.14, opening.top - opening.bottom + 0.18, opening.left - 0.04,
(opening.top + opening.bottom) / 2],
[0.14, opening.top - opening.bottom + 0.18, opening.right + 0.04,
(opening.top + opening.bottom) / 2],
[opening.right - opening.left + 0.25, 0.14, 0, opening.bottom - 0.04],
[opening.right - opening.left + 0.25, 0.14, 0, opening.top + 0.04]
];
for (const [width, height, x, y] of frameParts) {
const frame = new THREE.Mesh(
new THREE.BoxGeometry(width, height, 0.18),
frameMaterial
);
frame.position.set(x, y, -3.44);
frame.castShadow = true;
frame.receiveShadow = true;
scene.add(frame);
}
// Beveled vertical fins.
function makeFinGeometry(width, height, depth) {
const shape = new THREE.Shape();
const x = -width / 2;
const y = -height / 2;
shape.moveTo(x, y);
shape.lineTo(x + width, y);
shape.lineTo(x + width, y + height);
shape.lineTo(x, y + height);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth,
bevelEnabled: true,
bevelThickness: 0.025,
bevelSize: 0.025,
bevelSegments: 2,
steps: 1
});
geometry.translate(0, 0, -depth / 2);
return geometry;
}
const finGeometry = makeFinGeometry(0.24, 4.55, 0.88);
const finPositions = [-1.75, 0, 1.75];
for (const x of finPositions) {
const fin = new THREE.Mesh(finGeometry, finMaterial);
fin.position.set(x, 3.5, -2.34);
fin.rotation.y = -0.075;
fin.castShadow = true;
fin.receiveShadow = true;
scene.add(fin);
// Thin illuminated edge emphasizes each blade and its orientation.
const edge = new THREE.Mesh(
new THREE.BoxGeometry(0.035, 4.4, 0.035),
finEdgeMaterial
);
edge.position.set(-0.072, 0, 0.455);
edge.castShadow = false;
fin.add(edge);
}
// Small mounting details.
for (const x of finPositions) {
for (const y of [1.45, 5.55]) {
const bracket = new THREE.Mesh(
new THREE.BoxGeometry(0.32, 0.08, 0.16),
frameMaterial
);
bracket.position.set(x, y, -2.78);
bracket.castShadow = true;
scene.add(bracket);
}
}
// Lightweight camera controls implemented directly.
let dragging = false;
let pointerX = 0;
let pointerY = 0;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - pointerX;
const deltaY = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
view.desiredTheta -= deltaX * 0.006;
view.desiredPhi = THREE.MathUtils.clamp(
view.desiredPhi + deltaY * 0.005,
0.08,
1.15
);
});
function stopDragging(event) {
dragging = false;
if (event.pointerId !== undefined && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
view.desiredRadius = THREE.MathUtils.clamp(
view.desiredRadius * Math.exp(event.deltaY * 0.001),
11,
24
);
},
{ passive: false }
);
resetButton.addEventListener("click", () => {
view.desiredTheta = initialView.theta;
view.desiredPhi = initialView.phi;
view.desiredRadius = initialView.radius;
});
function onResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", onResize);
function animate() {
requestAnimationFrame(animate);
view.theta = THREE.MathUtils.lerp(
view.theta,
view.desiredTheta,
0.075
);
view.phi = THREE.MathUtils.lerp(
view.phi,
view.desiredPhi,
0.075
);
view.radius = THREE.MathUtils.lerp(
view.radius,
view.desiredRadius,
0.075
);
updateCamera();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```