Prompt specification
Build or customize the Three.js 3D scene "Neighbors arranging chairs on a Getsemaní lane" 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: Neighbors arranging chairs on a Getsemaní lane
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/neighbors-arranging-chairs-on-a-getseman-lane-x2726
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts Getsemaní in Cartagena. Create a compact neighborhood vignette with residents, chairs, and a street vendor. Keep people varied and the walking route clear, using referenced local architectural proportions. Voxel style.
Working Three.js Starter (neighbors-arranging-chairs-on-a-getseman-lane-x2726):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Getsemaní — A Caribbean Street in Voxel</title>
<style>
:root {
color-scheme: light;
--ink: #173f43;
--cream: #fff6dc;
--accent: #ef9f43;
--glass: rgba(255, 248, 224, 0.88);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #b8d9d3;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
#scene:active {
cursor: grabbing;
}
.title-card {
position: fixed;
top: 24px;
left: 24px;
z-index: 10;
max-width: min(440px, calc(100vw - 48px));
padding: 17px 20px 16px;
color: var(--ink);
background: var(--glass);
border: 1px solid rgba(255, 255, 255, 0.72);
border-radius: 4px 18px 18px 18px;
box-shadow: 0 12px 35px rgba(20, 61, 62, 0.16);
backdrop-filter: blur(10px);
pointer-events: none;
}
.eyebrow {
margin-bottom: 6px;
color: #bc653d;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4vw, 48px);
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
.subtitle {
margin: 9px 0 0;
color: #4f6b69;
font-size: 12px;
line-height: 1.45;
}
.legend {
position: fixed;
top: 24px;
right: 24px;
z-index: 10;
display: grid;
gap: 8px;
min-width: 174px;
padding: 13px 15px;
color: var(--ink);
background: var(--glass);
border: 1px solid rgba(255, 255, 255, 0.68);
border-radius: 14px;
box-shadow: 0 12px 35px rgba(20, 61, 62, 0.12);
backdrop-filter: blur(10px);
pointer-events: none;
}
.legend-row {
display: flex;
align-items: center;
gap: 9px;
font-size: 11px;
font-weight: 650;
}
.route-swatch {
width: 30px;
height: 8px;
border-radius: 2px;
background: #f4c875;
box-shadow: inset 0 -2px 0 rgba(117, 73, 32, 0.15);
}
.building-swatch {
width: 30px;
height: 8px;
border-radius: 2px;
background: linear-gradient(
90deg,
#e5ae55 0 25%,
#cf705b 25% 50%,
#65a49e 50% 75%,
#527f9d 75%
);
}
.controls {
position: fixed;
left: 24px;
bottom: 22px;
z-index: 10;
display: flex;
align-items: center;
gap: 12px;
color: var(--ink);
pointer-events: none;
}
.hint {
padding: 9px 12px;
background: rgba(255, 248, 224, 0.76);
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 9px;
font-size: 11px;
font-weight: 650;
backdrop-filter: blur(8px);
}
button {
padding: 10px 13px;
color: var(--ink);
background: var(--cream);
border: 1px solid rgba(23, 63, 67, 0.14);
border-radius: 9px;
box-shadow: 0 6px 18px rgba(20, 61, 62, 0.12);
font: inherit;
font-size: 11px;
font-weight: 750;
cursor: pointer;
pointer-events: auto;
}
button:hover {
transform: translateY(-1px);
background: #fffaf0;
}
button:active {
transform: translateY(0);
}
.credit {
position: fixed;
right: 25px;
bottom: 24px;
z-index: 10;
color: rgba(23, 63, 67, 0.72);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
@media (max-width: 720px) {
.title-card {
top: 14px;
left: 14px;
padding: 13px 15px;
}
.subtitle {
display: none;
}
.legend {
top: auto;
right: 14px;
bottom: 64px;
min-width: 150px;
}
.controls {
left: 14px;
bottom: 14px;
}
.credit {
display: none;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive voxel scene of Getsemaní, Cartagena"></canvas>
<header class="title-card">
<div class="eyebrow">Cartagena de Indias · Colombia</div>
<h1>Getsemaní</h1>
<p class="subtitle">
A sun-washed neighborhood pocket: narrow stucco houses, shaded balconies,
courtyard chairs, and the everyday rhythm of the street.
</p>
</header>
<aside class="legend" aria-label="Scene legend">
<div class="legend-row">
<span class="route-swatch"></span>
<span>Clear walking route</span>
</div>
<div class="legend-row">
<span class="building-swatch"></span>
<span>Colonial townhouses</span>
</div>
</aside>
<div class="controls">
<button id="reset" type="button">Reset view</button>
<div class="hint">Drag to orbit · Scroll to zoom · Arrow keys to look</div>
</div>
<div class="credit">Voxel Caribbean street study</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, lighting, and camera
// -------------------------------------------------------------------------
const canvas = document.querySelector("#scene");
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.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const scene = new THREE.Scene();
scene.background = new THREE.Color("#b8d9d3");
scene.fog = new THREE.Fog("#b8d9d3", 42, 78);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
120
);
const cameraTarget = new THREE.Vector3(0, 2.4, -0.5);
let cameraYaw = 0.67;
let cameraPitch = 0.91;
let cameraDistance = 35;
let userAdjustedCamera = false;
const hemi = new THREE.HemisphereLight("#dff6ee", "#8a7055", 2.1);
scene.add(hemi);
const sun = new THREE.DirectionalLight("#ffe0a5", 3.25);
sun.position.set(-18, 30, 20);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -27;
sun.shadow.camera.right = 27;
sun.shadow.camera.top = 25;
sun.shadow.camera.bottom = -25;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 75;
sun.shadow.bias = -0.00035;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight("#8ecfd1", 0.7);
fill.position.set(16, 12, -20);
scene.add(fill);
function updateCamera() {
const horizontal = Math.sin(cameraPitch) * cameraDistance;
camera.position.set(
cameraTarget.x + horizontal * Math.sin(cameraYaw),
cameraTarget.y + Math.cos(cameraPitch) * cameraDistance,
cameraTarget.z + horizontal * Math.cos(cameraYaw)
);
camera.lookAt(cameraTarget);
}
function resetCamera() {
cameraYaw = 0.67;
cameraPitch = 0.91;
cameraDistance = window.innerWidth < 720 ? 48 : 35;
cameraTarget.set(0, 2.4, -0.5);
updateCamera();
}
resetCamera();
document.querySelector("#reset").addEventListener("click", resetCamera);
// Direct camera controls: no examples or addons are used.
let pointerDown = false;
let previousX = 0;
let previousY = 0;
canvas.addEventListener("pointerdown", (event) => {
pointerDown = true;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!pointerDown) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
cameraYaw -= deltaX * 0.005;
cameraPitch = THREE.MathUtils.clamp(
cameraPitch + deltaY * 0.004,
0.38,
1.32
);
userAdjustedCamera = true;
updateCamera();
});
function endPointer(event) {
pointerDown = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraDistance = THREE.MathUtils.clamp(
cameraDistance + event.deltaY * 0.025,
20,
58
);
userAdjustedCamera = true;
updateCamera();
},
{ passive: false }
);
window.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
cameraYaw -= 0.08;
break;
case "ArrowRight":
cameraYaw += 0.08;
break;
case "ArrowUp":
cameraPitch = Math.max(0.38, cameraPitch - 0.06);
break;
case "ArrowDown":
cameraPitch = Math.min(1.32, cameraPitch + 0.06);
break;
case "+":
case "=":
cameraDistance = Math.max(20, cameraDistance - 1);
break;
case "-":
cameraDistance = Math.min(58, cameraDistance + 1);
break;
case "r":
case "R":
resetCamera();
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
userAdjustedCamera = true;
updateCamera();
}
});
// -------------------------------------------------------------------------
// Shared voxel construction helpers
// -------------------------------------------------------------------------
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const materialCache = new Map();
function material(color) {
if (color && color.isMaterial) return color;
if (!materialCache.has(color)) {
materialCache.set(
color,
new THREE.MeshStandardMaterial({
color,
roughness: 0.86,
metalness: 0
})
);
}
return materialCache.get(color);
}
function cube(
parent,
width,
height,
depth,
x,
y,
z,
color,
castShadow = true
) {
const mesh = new THREE.Mesh(unitBox, material(color));
mesh.scale.set(width, height, depth);
mesh.position.set(x, y, z);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function signTexture(text, background = "#fff3d1", foreground = "#234749") {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 128;
const context = canvas.getContext("2d");
context.fillStyle = background;
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = foreground;
context.lineWidth = 7;
context.strokeRect(8, 8, 496, 112);
context.fillStyle = foreground;
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "700 49px Arial, sans-serif";
context.fillText(text, 256, 67);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
return texture;
}
function addSign(parent, text, width, height, x, y, z, background, foreground) {
const texture = signTexture(text, background, foreground);
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: texture })
);
mesh.position.set(x, y, z);
parent.add(mesh);
return mesh;
}
// -------------------------------------------------------------------------
// Diorama base, cobbles, and the highlighted pedestrian route
// -------------------------------------------------------------------------
const base = cube(
scene,
38,
1.2,
28,
0,
-0.68,
0,
"#9d7755",
false
);
base.receiveShadow = true;
cube(scene, 37.8, 0.14, 27.8, 0, -0.05, 0, "#c9b58c", false);
// Seeded randomness keeps the scene deterministic.
let randomSeed = 73941;
function random() {
randomSeed = (randomSeed * 16807) % 2147483647;
return (randomSeed - 1) / 2147483646;
}
function blockedByBuilding(x, z) {
if (z < -5.85 && x > -16.2 && x < 16.2) return true;
if (x < -11.55 && z > -5.7 && z < 5.3) return true;
if (x > 11.55 && z > -5.7 && z < 5.6) return true;
return false;
}
const cobbleMaterial = new THREE.MeshStandardMaterial({
color: "#ffffff",
roughness: 0.96
});
const cobbleGeometry = new THREE.BoxGeometry(1, 1, 1);
const cobbleCount = 1000;
const cobbles = new THREE.InstancedMesh(
cobbleGeometry,
cobbleMaterial,
cobbleCount
);
cobbles.receiveShadow = true;
const cobblePalette = [
"#788b8c",
"#849493",
"#6f8385",
"#929b91",
"#71817f",
"#a19b88"
];
const dummy = new THREE.Object3D();
let cobbleIndex = 0;
for (let x = -18; x <= 18; x += 0.86) {
for (let z = -12.7; z <= 12.7; z += 0.82) {
if (blockedByBuilding(x, z)) continue;
if (cobbleIndex >= cobbleCount) break;
dummy.position.set(
x + (random() - 0.5) * 0.12,
0.025 + random() * 0.018,
z + (random() - 0.5) * 0.12
);
dummy.rotation.set(0, (random() - 0.5) * 0.13, 0);
dummy.scale.set(
0.65 + random() * 0.12,
0.09 + random() * 0.025,
0.49 + random() * 0.11
);
dummy.updateMatrix();
cobbles.setMatrixAt(cobbleIndex, dummy.matrix);
cobbles.setColorAt(
cobbleIndex,
new THREE.Color(cobblePalette[Math.floor(random() * cobblePalette.length)])
);
cobbleIndex++;
}
}
cobbles.count = cobbleIndex;
cobbles.instanceMatrix.needsUpdate = true;
if (cobbles.instanceColor) cobbles.instanceColor.needsUpdate = true;
scene.add(cobbles);
const routePoints = [
new THREE.Vector3(3.2, 0.13, 11.5),
new THREE.Vector3(2.8, 0.13, 7.4),
new THREE.Vector3(1.2, 0.13, 4.2),
new THREE.Vector3(-1.6, 0.13, 0.8),
new THREE.Vector3(-0.4, 0.13, -3.1),
new THREE.Vector3(1.6, 0.13, -5.65)
];
const routeCurve = new THREE.CatmullRomCurve3(
routePoints,
false,
"catmullrom",
0.35
);
const routeTileMaterial = new THREE.MeshStandardMaterial({
color: "#edc777",
roughness: 0.9
});
for (let i = 0; i <= 72; i++) {
const u = i / 72;
const point = routeCurve.getPointAt(u);
const tangent = routeCurve.getTangentAt(u);
const tile = cube(
scene,
0.72,
0.07,
0.7,
point.x,
0.115,
point.z,
routeTileMaterial,
false
);
tile.rotation.y = Math.atan2(tangent.x, tangent.z);
tile.rotation.z = (random() - 0.5) * 0.015;
}
function addRouteArrow(u) {
const group = new THREE.Group();
const point = routeCurve.getPointAt(u);
const tangent = routeCurve.getTangentAt(u);
group.position.set(point.x, 0.175, point.z);
group.rotation.y = Math.atan2(tangent.x, tangent.z);
cube(group, 0.13, 0.025, 0.52, 0, 0, 0.03, "#a65b35", false);
cube(group, 0.30, 0.025, 0.10, -0.115, 0, 0.26, "#a65b35", false)
.rotation.y = -0.62;
cube(group, 0.30, 0.025, 0.10, 0.115, 0, 0.26, "#a65b35", false)
.rotation.y = 0.62;
scene.add(group);
}
[0.08, 0.25, 0.43, 0.61, 0.79, 0.93].forEach(addRouteArrow);
// -------------------------------------------------------------------------
// Colonial townhouses
//
// Proportions are based on narrow attached Caribbean colonial houses:
// roughly 5.8 m frontages, 5.4 m depth, 3.0–3.2 m floor heights,
// 2.3 m doors, and deep 0.8 m balconies.
// -------------------------------------------------------------------------
function addDoor(group, frontZ) {
cube(group, 0.98, 1.58, 0.08, 0, 1.01, frontZ, "#302f2c", false);
cube(group, 0.80, 1.50, 0.10, 0, 0.98, frontZ + 0.025, "#795236");
for (let i = 0; i < 4; i++) {
cube(
group,
0.98 - i * 0.18,
0.18,
0.07,
0,
1.88 + i * 0.18,
frontZ,
"#302f2c",
false
);
}
cube(group, 0.14, 2.35, 0.16, -0.59, 1.28, frontZ + 0.01, "#f2dfb2");
cube(group, 0.14, 2.35, 0.16, 0.59, 1.28, frontZ + 0.01, "#f2dfb2");
cube(group, 1.32, 0.16, 0.17, 0, 2.52, frontZ + 0.01, "#f2dfb2");
cube(group, 0.08, 0.08, 0.08, 0.22, 1.08, frontZ + 0.09, "#d9af48");
cube(group, 0.06, 1.26, 0.06, 0, 1.02, frontZ + 0.10, "#a36e3d");
}
function addWindow(group, x, y, frontZ, width, shutters = true) {
const height = 1.35;
cube(group, width, height, 0.07, x, y, frontZ, "#233c43", false);
cube(group, width + 0.14, 0.10, 0.13, x, y + height / 2, frontZ + 0.02, "#f3dfb3");
cube(group, width + 0.14, 0.10, 0.13, x, y - height / 2, frontZ + 0.02, "#f3dfb3");
cube(group, 0.10, height + 0.12, 0.13, x - width / 2, y, frontZ + 0.02, "#f3dfb3");
cube(group, 0.10, height + 0.12, 0.13, x + width / 2, y, frontZ + 0.02, "#f3dfb3");
cube(group, 0.045, height, 0.045, x, y, frontZ + 0.07, "#d8b68a", false);
cube(group, width, 0.045, 0.045, x, y, frontZ + 0.07, "#d8b68a", false);
if (shutters) {
cube(group, 0.31, height + 0.10, 0.10, x - width / 2 - 0.23, y, frontZ + 0.03, "#376b70");
cube(group, 0.31, height + 0.10, 0.10, x + width / 2 + 0.23, y, frontZ + 0.03, "#376b70");
}
}
function addBalcony(group, width, floorY, frontZ) {
const balconyWidth = Math.min(3.85, width - 1.4);
const balconyDepth = 0.86;
cube(
group,
balconyWidth,
0.13,
balconyDepth,
0,
floorY,
frontZ + balconyDepth / 2,
"#e9d5a8"
);
const railZ = frontZ + balconyDepth - 0.035;
const railHeight = 0.95;
const barCount = Math.floor(balconyWidth / 0.29);
cube(
group,
balconyWidth,
0.055,
0.065,
0,
floorY + railHeight,
railZ,
"#263e3d"
);
for (let i = 0; i <= barCount; i++) {
const x = -balconyWidth / 2 + (balconyWidth * i) / barCount;
cube(
group,
0.035,
railHeight,
0.035,
x,
floorY + railHeight / 2,
railZ,
"#263e3d"
);
}
cube(
group,
0.055,
railHeight,
0.055,
-balconyWidth / 2,
floorY + railHeight / 2,
railZ,
"#263e3d"
);
cube(
group,
0.055,
railHeight,
0.055,
balconyWidth / 2,
floorY + railHeight / 2,
railZ,
"#263e3d"
);
if (Math.random() > 0.35) {
cube(group, 0.33, 0.30, 0.33, -balconyWidth * 0.32, floorY + 0.22, frontZ + 0.57, "#b86240");
cube(group, 0.48, 0.34, 0.42, -balconyWidth * 0.32, floorY + 0.52, frontZ + 0.57, "#4b8a54");
cube(group, 0.34, 0.28, 0.30, balconyWidth * 0.34, floorY + 0.50, frontZ + 0.53, "#5b9857");
}
}
function addAwning(group, width, frontZ, colorA, colorB) {
const stripWidth = width / 7;
for (let i = 0; i < 7; i++) {
const strip = cube(
group,
stripWidth + 0.015,
0.09,
1.05,
-width / 2 + stripWidth * (i + 0.5),
2.69,
frontZ + 0.43,
i % 2 === 0 ? colorA : colorB
);
strip.rotation.x = 0.10;
}
for (let i = 0; i < 7; i++) {
cube(
group,
stripWidth + 0.015,
0.22,
0.07,
-width / 2 + stripWidth * (i + 0.5),
2.58,
frontZ + 0.92,
i % 2 === 0 ? colorA : colorB
);
}
}
function makeTownhouse({
x,
z,
width = 5.85,
depth = 5.4,
height = 9.4,
color,
trim = "#f2dfb6",
rotation = 0,
label = "",
awning = null
}) {
const group = new THREE.Group();
group.position.set(x, 0.08, z);
group.rotation.y = rotation;
scene.add(group);
cube(group, width, height, depth, 0, height / 2, 0, color);
cube(group, width + 0.12, 0.34, depth + 0.12, 0, 0.17, 0, "#a58d6d");
cube(group, width + 0.15, 0.18, depth + 0.15, 0, 0.38, 0, trim);
cube(group, width + 0.18, 0.17, depth + 0.18, 0, 3.18, 0, trim);
cube(group, width + 0.18, 0.17, depth + 0.18, 0, 6.27, 0, trim);
cube(group, width + 0.24, 0.24, depth + 0.24, 0, height + 0.08, 0, trim);
const frontZ = depth / 2 + 0.025;
addDoor(group, frontZ);
addWindow(group, -width * 0.31, 1.47, frontZ, 0.86, true);
addWindow(group, width * 0.31, 1.47, frontZ, 0.86, true);
const floors = [3.22, 6.31];
floors.forEach((floorY, floorIndex) => {
if (floorY + 2.4 > height + 0.4) return;
addBalcony(group, width, floorY, frontZ);
const windowY = floorY + 1.15;
addWindow(group, -width * 0.26, windowY, frontZ, 0.98, true);
addWindow(group, width * 0.26, windowY, frontZ, 0.98, true);
});
// Flat roof and parapet, common in the warm coastal city.
cube(group, width - 0.3, 0.10, depth - 0.3, 0, height + 0.22, 0, "#8f7459");
cube(group, width, 0.42, 0.20, 0, height + 0.40, -depth / 2 + 0.1, trim);
cube(group, width, 0.42, 0.20, 0, height + 0.40, depth / 2 - 0.1, trim);
cube(group, 0.20, 0.42, depth, -width / 2 + 0.1, height + 0.40, 0, trim);
cube(group, 0.20, 0.42, depth, width / 2 - 0.1, height + 0.40, 0, trim);
if (awning) {
addAwning(group, width, frontZ, awning[0], awning[1]);
}
if (label) {
addSign(group, label, Math.min(3.8, width - 0.6), 0.62, 0, 2.98, frontZ + 0.075);
}
// A rooftop water tank.
if (Math.random() > 0.48) {
cube(group, 1.05, 0.78, 0.90, width * 0.25, height + 0.67, -depth * 0.16, "#344b4b");
cube(group, 0.16, 0.38, 0.16, width * 0.25, height + 1.22, -depth * 0.16, "#344b4b");
}
return group;
}
makeTownhouse({
x: -12.7,
z: -9,
height: 9.2,
color: "#e1aa50",
label: "CASA ROSA",
awning: ["#f3ddba", "#a85043"]
});
makeTownhouse({
x: -6.35,
z: -9,
height: 10.1,
color: "#d66f59",
trim: "#f4dfb8",
label: "CASA 39",
awning: ["#f3ddba", "#376e72"]
});
makeTownhouse({
x: 0,
z: -9,
height: 8.9,
color: "#d9cfab",
trim: "#b95e49",
label: "CAFÉ LOLA",
awning: ["#f5dfb4", "#bd5c45"]
});
makeTownhouse({
x: 6.35,
z: -9,
height: 9.7,
color: "#65a49e",
label: "ESTUDIO",
awning: ["#f3ddba", "#4f7f9c"]
});
makeTownhouse({
x: 12.7,
z: -9,
height: 9.1,
color: "#537f9b",
label: "LA ESQUINA"
});
makeTownhouse({
x: -14.35,
z: 0.1,
width: 9.1,
depth: 5.0,
height: 8.8,
color: "#b98168",
rotation: Math.PI / 2,
label: "CAFÉ"
});
makeTownhouse({
x: 14.35,
z: 0.4,
width: 9.0,
depth: 5.0,
height: 9.5,
color: "#e0ae56",
rotation: -Math.PI / 2,
label: "LOCAL"
});
// A small colonial bell tower rising behind the roofline.
const tower = new THREE.Group();
tower.position.set(-2.7, 0.08, -12.0);
scene.add(tower);
cube(tower, 2.8, 10.6, 2.8, 0, 5.3, 0, "#d5a052");
cube(tower, 3.0, 0.22, 3.0, 0, 0.12, 0, "#a88b67");
cube(tower, 3.15, 0.22, 3.15, 0, 10.62, 0, "#efdbb2");
cube(tower, 2.45, 1.65, 2.45, 0, 11.5, 0, "#efdbb2");
cube(tower, 2.8, 0.20, 2.8, 0, 12.38, 0, "#b85e48");
cube(tower, 0.72, 1.03, 0.08, 0, 11.45, 1.27, "#334347", false);
cube(tower, 0.08, 1.05, 0.09, 0, 11.45, 1.32, "#e4c78d", false);
cube(tower, 0.14, 0.54, 0.14, 0, 12.92, 0, "#f1dcae");
cube(tower, 0.54, 0.14, 0.14, 0, 13.08, 0, "#f1dcae");
// -------------------------------------------------------------------------
// Street trees, planters, and overhead lights
// -------------------------------------------------------------------------
function makeBroadleafTree(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0.08, z);
group.scale.setScalar(scale);
scene.add(group);
cube(group, 0.48, 2.7, 0.48, 0, 1.35, 0, "#79553b");
cube(group, 0.32, 1.0, 0.32, -0.45, 2.25, 0.05, "#79553b").rotation.z = -0.65;
cube(group, 0.32, 1.0, 0.32, 0.48, 2.4, -0.05, "#79553b").rotation.z = 0.68;
cube(group, 2.6, 1.55, 2.35, 0, 3.3, 0, "#4e8e51");
cube(group, 1.8, 1.3, 1.8, -1.0, 3.7, 0.25, "#5d9d57");
cube(group, 1.65, 1.4, 1.7, 1.05, 3.65, -0.15, "#427f4c");
cube(group, 1.25, 0.95, 1.25, 0.15, 4.45, 0.1, "#72a85e");
cube(group, 1.45, 0.35, 1.45, 0, 0.18, 0, "#a36f4e");
return group;
}
function makePalm(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0.08, z);
group.scale.setScalar(scale);
scene.add(group);
for (let i = 0; i < 7; i++) {
cube(
group,
0.34,
0.68,
0.34,
Math.sin(i * 0.45) * 0.13,
0.36 + i * 0.62,
0,
i % 2 ? "#8e6945" : "#9a744c"
);
}
const crown = new THREE.Group();
crown.position.set(0, 4.45, 0);
group.add(crown);
for (let i = 0; i < 8; i++) {
const angle = (i / 8) * Math.PI * 2;
const leaf = cube(
crown,
3.4,
0.16,
0.40,
Math.cos(angle) * 1.45,
0,
Math.sin(angle) * 1.45,
i % 2 ? "#3f804a" : "#599551"
);
leaf.rotation.y = -angle;
leaf.rotation.z = 0.12;
}
cube(crown, 0.48, 0.48, 0.48, 0, -0.18, 0, "#6e693b");
return group;
}
makeBroadleafTree(-11.0, 8.6, 1.05);
makeBroadleafTree(10.5, 8.9, 0.9);
makePalm(12.3, -4.4, 0.93);
makePalm(-12.2, -4.6, 0.82);
function makePlanter(x, z, color = "#b86043") {
const group = new THREE.Group();
group.position.set(x, 0.08, z);
scene.add(group);
cube(group, 0.72, 0.62, 0.72, 0, 0.31, 0, color);
cube(group, 0.78, 0.12, 0.78, 0, 0.65, 0, "#d18b59");
cube(group, 0.55, 0.68, 0.55, 0, 1.03, 0, "#4e8952");
cube(group, 0.38, 0.52, 0.38, 0.2, 1.36, 0.08, "#6c9e58");
return group;
}
makePlanter(-10.9, -5.4, "#b35e45");
makePlanter(10.9, -5.4, "#4f8393");
makePlanter(5.2, 9.8, "#ba7449");
const bulbMaterial = new THREE.MeshStandardMaterial({
color: "#ffd679",
emissive: "#ff9c34",
emissiveIntensity: 1.4,
roughness: 0.55
});
function addStringLights(start, end, sag, count) {
const points = [];
for (let i = 0; i <= 40; i++) {
const u = i / 40;
const point = new THREE.Vector3().lerpVectors(start, end, u);
point.y -= Math.sin(u * Math.PI) * sag;
points.push(point);
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
scene.add(new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: "#394744" })));
for (let i = 1; i < count; i++) {
const u = i / count;
const point = new THREE.Vector3().lerpVectors(start, end, u);
point.y -= Math.sin(u * Math.PI) * sag + 0.12;
cube(scene, 0.15, 0.20, 0.15, point.x, point.y, point.z, bulbMaterial, false);
}
}
addStringLights(
new THREE.Vector3(-11.7, 5.5, -5.8),
new THREE.Vector3(11.7, 5.8, -5.8),
1.65,
13
);
addStringLights(
new THREE.Vector3(-11.7, 5.0, -2.5),
new THREE.Vector3(-11.7, 4.6, 8.2),
1.15,
8
);
// -------------------------------------------------------------------------
// People: blocky bodies with articulated walking limbs
// -------------------------------------------------------------------------
const skinColors = ["#9b5f3f", "#c47f54", "#e0a471", "#754632", "#b9784e"];
const hairColors = ["#2d2725", "#4b3024", "#171a19", "#795136"];
function makePerson({
x = 0,
z = 0,
rotation = 0,
skin = skinColors[0],
shirt = "#d96752",
pants = "#315b68",
hair = hairColors[0],
scale = 1,
hat = null,
dress = false,
scarf = null,
apron = null,
walking = false
} = {}) {
const group = new THREE.Group();
group.position.set(x, 0.1, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
const body = new THREE.Group();
group.add(body);
const legLeft = new THREE.Group();
const legRight = new THREE.Group();
legLeft.position.set(-0.14, 0.76, 0);
legRight.position.set(0.14, 0.76, 0);
body.add(legLeft, legRight);
cube(legLeft, 0.20, 0.64, 0.23, 0, -0.31, 0, pants);
cube(legRight, 0.20, 0.64, 0.23, 0, -0.31, 0, pants);
cube(legLeft, 0.24, 0.14, 0.36, 0, -0.66, 0.06, "#3f3935");
cube(legRight, 0.24, 0.14, 0.36, 0, -0.66, 0.06, "#3f3935");
cube(body, 0.56, 0.72, 0.34, 0, 1.12, 0, shirt);
if (dress) {
cube(body, 0.65, 0.42, 0.40, 0, 0.80, 0, shirt);
}
if (apron) {
cube(body, 0.46, 0.65, 0.035, 0, 1.05, 0.19, apron);
}
const armLeft = new THREE.Group();
const armRight = new THREE.Group();
armLeft.position.set(-0.36, 1.38, 0);
armRight.position.set(0.36, 1.38, 0);
body.add(armLeft, armRight);
cube(armLeft, 0.17, 0.55, 0.19, 0, -0.26, 0, shirt);
cube(armRight, 0.17, 0.55, 0.19, 0, -0.26, 0, shirt);
cube(armLeft, 0.17, 0.16, 0.18, 0, -0.59, 0, skin);
cube(armRight, 0.17, 0.16, 0.18, 0, -0.59, 0, skin);
cube(body, 0.43, 0.43, 0.42, 0, 1.70, 0, skin);
cube(body, 0.46, 0.15, 0.45, 0, 1.92, -0.015, hair);
cube(body, 0.12, 0.12, 0.13, 0, 1.68, 0.225, skin);
cube(body, 0.045, 0.045, 0.035, -0.095, 1.76, 0.215, "#242a28", false);
cube(body, 0.045, 0.045, 0.035, 0.095, 1.76, 0.215, "#242a28", false);
if (scarf) {
cube(body, 0.47, 0.16, 0.47, 0, 1.96, 0, scarf);
cube(body, 0.18, 0.65, 0.10, 0.16, 1.62, -0.23, scarf);
}
if (hat) {
cube(body, 0.72, 0.09, 0.68, 0, 2.03, 0, hat);
cube(body, 0.43, 0.25, 0.43, 0, 2.16, 0, hat);
}
return {
group,
body,
legLeft,
legRight,
armLeft,
armRight,
walking
};
}
function makeSeatedPerson({
x,
z,
rotation = 0,
skin = skinColors[1],
shirt = "#cf7157",
pants = "#3a626b",
hair = hairColors[0],
scale = 1
}) {
const group = new THREE.Group();
group.position.set(x, 0.1, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
cube(group, 0.50, 0.62, 0.32, 0, 1.03, 0, shirt);
cube(group, 0.43, 0.43, 0.42, 0, 1.59, 0, skin);
cube(group, 0.46, 0.15, 0.45, 0, 1.80, -0.01, hair);
cube(group, 0.11, 0.11, 0.12, 0, 1.57, 0.22, skin);
cube(group, 0.045, 0.045, 0.03, -0.09, 1.65, 0.215, "#242a28", false);
cube(group, 0.045, 0.045, 0.03, 0.09, 1.65, 0.215, "#242a28", false);
cube(group, 0.19, 0.20, 0.48, -0.14, 0.70, 0.23, pants);
cube(group, 0.19, 0.20, 0.48, 0.14, 0.70, 0.23, pants);
cube(group, 0.18, 0.55, 0.20, -0.14, 0.35, 0.46, pants);
cube(group, 0.18, 0.55, 0.20, 0.14, 0.35, 0.46, pants);
cube(group, 0.22, 0.13, 0.32, -0.14, 0.08, 0.50, "#3f3935");
cube(group, 0.22, 0.13, 0.32, 0.14, 0.08, 0.50, "#3f3935");
cube(group, 0.15, 0.48, 0.17, -0.33, 1.03, 0.08, shirt);
cube(group, 0.15, 0.48, 0.17, 0.33, 1.03, 0.08, shirt);
cube(group, 0.15, 0.14, 0.17, -0.33, 0.75, 0.12, skin);
cube(group, 0.15, 0.14, 0.17, 0.33, 0.75, 0.12, skin);
return group;
}
// -------------------------------------------------------------------------
// Chairs, tables, and seated residents
// -------------------------------------------------------------------------
function makeChair(x, z, rotation = 0, color = "#37777a") {
const group = new THREE.Group();
group.position.set(x, 0.1, z);
group.rotation.y = rotation;
scene.add(group);
cube(group, 0.64, 0.10, 0.60, 0, 0.54, 0, color);
cube(group, 0.64, 0.70, 0.09, 0, 0.91, -0.28, color);
cube(group, 0.08, 0.55, 0.08, -0.25, 0.27, -0.23, "#6b523e");
cube(group, 0.08, 0.55, 0.08, 0.25, 0.27, -0.23, "#6b523e");
cube(group, 0.08, 0.55, 0.08, -0.25, 0.27, 0.23, "#6b523e");
cube(group, 0.08, 0.55, 0.08, 0.25, 0.27, 0.23, "#6b523e");
return group;
}
function makeTable(x, z, tablecloth = "#e7c979") {
const group = new THREE.Group();
group.position.set(x, 0.1, z);
scene.add(group);
cube(group, 1.15, 0.12, 1.15, 0, 1.03, 0, tablecloth);
cube(group, 0.18, 0.98, 0.18, 0, 0.49, 0, "#70533c");
cube(group, 0.72, 0.08, 0.72, 0, 0.04, 0, "#70533c");
// Cups and saucers in simple voxel forms.
cube(group, 0.18, 0.16, 0.18, -0.28, 1.17, 0.21, "#fff5dc");
cube(group, 0.16, 0.14, 0.16, 0.30, 1.16, -0.18, "#c9684f");
cube(group, 0.22, 0.04, 0.22, -0.28, 1.10, 0.21, "#fff5dc");
cube(group, 0.22, 0.04, 0.22, 0.30, 1.09, -0.18, "#fff5dc");
return group;
}
makeTable(-7.25, 4.35);
makeChair(-8.55, 4.35, Math.PI / 2, "#c86850");
makeChair(-5.95, 4.35, -Math.PI / 2, "#3c7c80");
makeChair(-7.25, 3.05, 0, "#d9ad52");
makeChair(-7.25, 5.65, Math.PI, "#6d8f68");
makeSeatedPerson({
x: -8.55,
z: 4.35,
rotation: Math.PI / 2,
skin: skinColors[2],
shirt: "#e5b34f",
pants: "#435e70",
hair: hairColors[1]
});
makeSeatedPerson({
x: -7.25,
z: 5.65,
rotation: Math.PI,
skin: skinColors[1],
shirt: "#5e9a8f",
pants: "#8d5c44",
hair: hairColors[0]
});
makeTable(-8.2, 7.55, "#d87558");
makeChair(-9.5, 7.55, Math.PI / 2, "#d4a449");
makeChair(-6.9, 7.55, -Math.PI / 2, "#4e8180");
makeChair(-8.2, 6.25, 0, "#c96c51");
makeChair(-8.2, 8.85, Math.PI, "#4f8581");
makeSeatedPerson({
x: -9.5,
z: 7.55,
rotation: Math.PI / 2,
skin: skinColors[3],
shirt: "#6d86a0",
pants: "#d1b17d",
hair: "#5a4b3d",
hat: "#e0c38e"
});
// Standing residents remain outside the clear walking corridor.
const standingPeople = [
makePerson({
x: -4.4,
z: 7.4,
rotation: 0.35,
skin: skinColors[1],
shirt: "#d65f50",
pants: "#304f67",
hair: hairColors[0],
dress: true,
scarf: "#f0c15a"
}),
makePerson({
x: 8.0,
z: -3.45,
rotation: -1.25,
skin: skinColors[2],
shirt: "#f0d9a0",
pants: "#56614f",
hair: "#8b775b",
hat: "#c08a45"
}),
makePerson({
x: 5.2,
z: 0.9,
rotation: -1.1,
skin: skinColors[0],
shirt: "#e2aa42",
pants: "#385e72",
hair: hairColors[1],
scale: 0.73
}),
makePerson({
x: -8.9,
z: -2.9,
rotation: 1.15,
skin: skinColors[4],
shirt: "#668d8a",
pants: "#78584b",
hair: hairColors[0],
dress: true
})
];
// -------------------------------------------------------------------------
// Street vendor and fruit cart
// -------------------------------------------------------------------------
const vendor = makePerson({
x: 7.25,
z: 5.35,
rotation: 0.06,
skin: skinColors[0],
shirt: "#f0d69b",
pants: "#3e5c62",
hair: hairColors[1],
apron: "#c7543f",
hat: "#d95d43"
});
const cart = new THREE.Group();
cart.position.set(9.35, 0.1, 5.3);
scene.add(cart);
cube(cart, 2.15, 0.92, 1.12, 0, 0.72, 0, "#9a5e3e");
cube(cart, 2.35, 0.16, 1.30, 0, 1.22, 0, "#d2945f");
cube(cart, 0.10, 1.55, 0.10, -1.08, 1.9, 0, "#6f513b");
cube(cart, 0.10, 1.55, 0.10, 1.08, 1.9, 0, "#6f513b");
cube(cart, 2.25, 0.12, 0.12, 0, 2.62, 0, "#6f513b");
// Small blocky wheels.
cube(cart, 0.34, 0.44, 0.28, -0.73, 0.29, -0.57, "#313a39");
cube(cart, 0.34, 0.44, 0.28, 0.73, 0.29, -0.57, "#313a39");
cube(cart, 0.34, 0.44, 0.28, -0.73, 0.29, 0.57, "#313a39");
cube(cart, 0.34, 0.44, 0.28, 0.73, 0.29, 0.57, "#313a39");
addSign(cart, "FRUTAS", 1.62, 0.48, 0, 0.82, 0.58, "#f6d985", "#8c402e");
// Fruit crates.
for (let i = 0; i < 3; i++) {
cube(cart, 0.52, 0.20, 0.62, -0.66 + i * 0.66, 1.38, 0.08, "#a96b3f");
for (let j = 0; j < 4; j++) {
const fruitColor = i === 1 ? "#86a84d" : "#e59632";
cube(
cart,
0.20,
0.20,
0.20,
-0.78 + i * 0.66 + (j % 2) * 0.23,
1.57,
-0.05 + Math.floor(j / 2) * 0.24,
fruitColor
);
}
}
// Square market umbrella with alternating warm panels.
for (let i = 0; i < 8; i++) {
const strip = cube(
cart,
0.42,
0.10,
2.55,
-1.47 + i * 0.42,
2.72 + Math.abs(i - 3.5) * 0.025,
0,
i % 2 ? "#f1c45c" : "#f5e2b4"
);
strip.rotation.z = (i - 3.5) * 0.015;
}
cube(cart, 0.09, 1.6, 0.09, 0, 1.95, 0, "#79563b");
// -------------------------------------------------------------------------
// Walking residents
// -------------------------------------------------------------------------
const walkers = [
makePerson({
skin: skinColors[2],
shirt: "#e3aa44",
pants: "#31586b",
hair: hairColors[0],
walking: true
}),
makePerson({
skin: skinColors[0],
shirt: "#c95f4e",
pants: "#4f6770",
hair: hairColors[1],
scarf: "#eac35e",
walking: true
}),
makePerson({
skin: skinColors[3],
shirt: "#6a9890",
pants: "#85654f",
hair: hairColors[2],
walking: true
}),
makePerson({
skin: skinColors[1],
shirt: "#e7d5aa",
pants: "#385e70",
hair: hairColors[0],
hat: "#bc7d40",
walking: true
})
];
const walkerOffsets = [0.07, 0.31, 0.56, 0.82];
function animateWalkers(time) {
walkers.forEach((walker, index) => {
const u = (walkerOffsets[index] + time * 0.045) % 1;
const point = routeCurve.getPointAt(u);
const tangent = routeCurve.getTangentAt(u);
walker.group.position.set(point.x, 0.1, point.z);
walker.group.rotation.y = Math.atan2(tangent.x, tangent.z);
const phase = time * 5.6 + index * 1.9;
const stride = Math.sin(phase) * 0.58;
walker.legLeft.rotation.x = stride;
walker.legRight.rotation.x = -stride;
walker.armLeft.rotation.x = -stride * 0.72;
walker.armRight.rotation.x = stride * 0.72;
walker.body.position.y = Math.abs(Math.sin(phase)) * 0.045;
});
}
// -------------------------------------------------------------------------
// Small neighborhood details
// -------------------------------------------------------------------------
function makeCat(x, z, rotation = 0, color = "#d8c7a5") {
const group = new THREE.Group();
group.position.set(x, 0.1, z);
group.rotation.y = rotation;
scene.add(group);
cube(group, 0.58, 0.30, 0.30, 0, 0.43, 0, color);
cube(group, 0.32, 0.31, 0.31, 0, 0.59, 0.26, color);
cube(group, 0.10, 0.16, 0.10, -0.11, 0.82, 0.25, color);
cube(group, 0.10, 0.16, 0.10, 0.11, 0.82, 0.25, color);
cube(group, 0.08, 0.08, 0.08, -0.15, 0.23, 0, color);
cube(group, 0.08, 0.08, 0.08, 0.15, 0.23, 0, color);
cube(group, 0.08, 0.36, 0.08, -0.20, 0.35, -0.25, color).rotation.x = -0.35;
cube(group, 0.08, 0.36, 0.08, 0.20, 0.35, -0.25, color).rotation.x = -0.35;
}
makeCat(-10.3, 2.4, 0.6, "#d5c29d");
makeCat(10.7, -2.9, -0.9, "#4a4b43");
// Street bollards along the foreground edge.
for (const x of [-8.8, -6.7, 6.8, 9.0]) {
cube(scene, 0.22, 0.72, 0.22, x, 0.36, 10.6, "#365b58");
cube(scene, 0.30, 0.12, 0.30, x, 0.76, 10.6, "#d4ac57");
}
// A shaded corner lamp.
const lamp = new THREE.Group();
lamp.position.set(11.2, 0.08, 7.4);
scene.add(lamp);
cube(lamp, 0.18, 3.4, 0.18, 0, 1.7, 0, "#365653");
cube(lamp, 0.52, 0.62, 0.52, 0, 3.45, 0, "#f0d28b");
cube(lamp, 0.68, 0.14, 0.68, 0, 3.83, 0, "#345150");
// -------------------------------------------------------------------------
// Animation and responsive rendering
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const time = clock.getElapsedTime();
animateWalkers(time);
standingPeople.forEach((person, index) => {
person.body.position.y = Math.sin(time * 1.25 + index * 1.7) * 0.012;
});
vendor.armLeft.rotation.x = -0.16 + Math.sin(time * 2.1) * 0.07;
vendor.armRight.rotation.x = -0.12 + Math.sin(time * 2.1 + 0.6) * 0.06;
vendor.body.position.y = Math.sin(time * 2.1) * 0.01;
renderer.render(scene, camera);
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
camera.aspect = width / height;
camera.updateProjectionMatrix();
if (!userAdjustedCamera && width < 720) {
cameraDistance = 48;
updateCamera();
}
}
window.addEventListener("resize", resize);
resize();
animate();
</script>
</body>
</html>
```