Prompt specification
Build or customize the Three.js 3D scene "Lapa arches and surrounding square fragment" 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: Lapa arches and surrounding square fragment
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/lapa-arches-and-surrounding-square-fragment-x2699
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring the Lapa arches in Rio de Janeiro. Build a recognizable low-poly slice with several aqueduct arches, adjacent open space, and a few street facades. Use a restricted footprint and preserve the landmark's horizontal rhythm. Low-poly.
Working Three.js Starter (lapa-arches-and-surrounding-square-fragment-x2699):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arco da Lapa — Low-Poly Rio</title>
<style>
:root {
color-scheme: light;
--ink: #18312f;
--paper: rgba(250, 246, 234, 0.88);
--accent: #bd6746;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d5e2df;
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;
outline: none;
}
.title-card {
position: fixed;
z-index: 10;
top: 24px;
left: 24px;
width: min(340px, calc(100vw - 48px));
padding: 18px 20px 16px;
border: 1px solid rgba(24, 49, 47, 0.12);
border-radius: 4px;
background: var(--paper);
box-shadow: 0 16px 42px rgba(34, 54, 48, 0.14);
backdrop-filter: blur(10px);
pointer-events: none;
}
.eyebrow {
margin: 0 0 7px;
color: var(--accent);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0;
color: var(--ink);
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(26px, 4vw, 38px);
font-weight: 500;
line-height: 1;
}
.subtitle {
margin: 9px 0 0;
color: rgba(24, 49, 47, 0.68);
font-size: 12px;
line-height: 1.45;
}
.controls-card {
position: fixed;
z-index: 10;
right: 24px;
bottom: 22px;
display: flex;
align-items: center;
gap: 14px;
padding: 10px 12px 10px 15px;
border: 1px solid rgba(24, 49, 47, 0.12);
border-radius: 4px;
background: var(--paper);
box-shadow: 0 12px 36px rgba(34, 54, 48, 0.14);
backdrop-filter: blur(10px);
color: rgba(24, 49, 47, 0.72);
font-size: 11px;
letter-spacing: 0.015em;
}
.controls-card strong {
color: var(--ink);
font-weight: 700;
}
.separator {
width: 1px;
height: 18px;
background: rgba(24, 49, 47, 0.16);
}
button {
border: 0;
border-radius: 3px;
padding: 8px 10px;
background: var(--ink);
color: #faf6ea;
font: inherit;
font-size: 11px;
font-weight: 700;
cursor: pointer;
transition: background 140ms ease, transform 140ms ease;
}
button:hover {
background: #28504c;
}
button:active {
transform: translateY(1px);
}
.vignette {
position: fixed;
z-index: 5;
inset: 0;
pointer-events: none;
background:
radial-gradient(
circle at 50% 42%,
transparent 48%,
rgba(25, 52, 48, 0.09) 100%
);
}
#loading {
position: fixed;
z-index: 30;
inset: 0;
display: grid;
place-items: center;
background: #d5e2df;
color: var(--ink);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 620px) {
.title-card {
top: 14px;
left: 14px;
width: calc(100vw - 28px);
padding: 14px 16px;
}
.subtitle {
max-width: 270px;
}
.controls-card {
right: 14px;
bottom: 14px;
left: 14px;
justify-content: space-between;
gap: 8px;
}
.desktop-hint {
display: none;
}
}
</style>
</head>
<body>
<div id="loading">Building the Lapa scene…</div>
<header class="title-card">
<p class="eyebrow">Rio de Janeiro · Brazil</p>
<h1>Arco da Lapa</h1>
<p class="subtitle">
A low-poly urban slice inspired by the historic Santa Teresa aqueduct,
with its stacked arches, open plaza, and colorful street facades.
</p>
</header>
<div class="vignette"></div>
<div class="controls-card">
<span>
<strong>Drag</strong> orbit
<span class="desktop-hint"> · <strong>Shift-drag</strong> pan · <strong>Scroll</strong> zoom</span>
</span>
<span class="separator"></span>
<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";
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd5e2df);
scene.fog = new THREE.Fog(0xd5e2df, 48, 102);
const renderer = new THREE.WebGLRenderer({
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.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly scene of the Lapa arches in Rio de Janeiro"
);
renderer.domElement.tabIndex = 0;
document.body.prepend(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
37,
window.innerWidth / window.innerHeight,
0.1,
160
);
// -------------------------------------------------------------------------
// Camera controls implemented directly, without Three.js addons.
// -------------------------------------------------------------------------
const target = new THREE.Vector3(-2.2, 2.8, -1.4);
let theta = 0.51;
let phi = 0.98;
let radius = 65;
function defaultRadius() {
return window.innerWidth / window.innerHeight < 1 ? 82 : 65;
}
function resetCamera() {
target.set(-2.2, 2.8, -1.4);
theta = 0.51;
phi = 0.98;
radius = defaultRadius();
}
function updateCamera() {
phi = THREE.MathUtils.clamp(phi, 0.34, 1.38);
radius = THREE.MathUtils.clamp(radius, 32, 96);
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(target);
}
let dragging = false;
let dragMode = "orbit";
let lastX = 0;
let lastY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("contextmenu", (event) => event.preventDefault());
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
dragMode = event.shiftKey || event.button === 2 ? "pan" : "orbit";
lastX = event.clientX;
lastY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.focus({ preventScroll: true });
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
if (dragMode === "orbit") {
theta -= dx * 0.0055;
phi -= dy * 0.0045;
} else {
const panScale = radius * 0.00125;
const right = new THREE.Vector3(Math.cos(theta), 0, -Math.sin(theta));
const forward = new THREE.Vector3(-Math.sin(theta), 0, -Math.cos(theta));
target.addScaledVector(right, -dx * panScale);
target.addScaledVector(forward, dy * panScale);
target.x = THREE.MathUtils.clamp(target.x, -23, 22);
target.z = THREE.MathUtils.clamp(target.z, -15, 16);
target.y = THREE.MathUtils.clamp(target.y, 0.5, 9);
}
updateCamera();
});
function stopDragging(event) {
dragging = false;
if (event && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener("lostpointercapture", () => {
dragging = false;
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
radius *= Math.exp(event.deltaY * 0.001);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetCamera);
window.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
theta += 0.08;
break;
case "ArrowRight":
theta -= 0.08;
break;
case "ArrowUp":
phi -= 0.06;
break;
case "ArrowDown":
phi += 0.06;
break;
case "+":
case "=":
radius *= 0.92;
break;
case "-":
case "_":
radius *= 1.08;
break;
case "r":
case "R":
resetCamera();
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
updateCamera();
}
});
document.getElementById("reset").addEventListener("click", resetCamera);
resetCamera();
// -------------------------------------------------------------------------
// Lighting
// -------------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(0xfff5dc, 0x667c68, 2.0);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe1ae, 3.2);
sun.position.set(-20, 34, 24);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -38;
sun.shadow.camera.right = 38;
sun.shadow.camera.top = 32;
sun.shadow.camera.bottom = -28;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 90;
sun.shadow.bias = -0.00025;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xb8d8e0, 0.75);
fill.position.set(28, 16, -18);
scene.add(fill);
// -------------------------------------------------------------------------
// Materials and reusable geometry helpers
// -------------------------------------------------------------------------
function standard(color, roughness = 0.86, extra = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness,
flatShading: true,
...extra
});
}
const materials = {
base: standard(0x716d5b),
ground: standard(0x87997a),
grass: standard(0x819676),
road: standard(0x555b58),
plaza: standard(0xb8ad91),
stone: standard(0xd8ccb5),
stoneWarm: standard(0xcbbca2),
stoneLight: standard(0xe2d8c5),
stoneDark: standard(0xb6a68d),
joint: standard(0x8b7e69),
roof: standard(0x59615d),
wood: standard(0x77503a),
woodLight: standard(0xa16b49),
metal: standard(0x3e4b48),
water: standard(0x4f9aa0, 0.32, {
metalness: 0.08,
transparent: true,
opacity: 0.88
}),
leaf: standard(0x507258),
leafLight: standard(0x78906a),
trunk: standard(0x75513b)
};
function box(
width,
height,
depth,
material,
x = 0,
y = 0,
z = 0,
parent = scene
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(
topRadius,
bottomRadius,
height,
segments,
material,
x = 0,
y = 0,
z = 0,
parent = scene
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
topRadius,
bottomRadius,
height,
segments
),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function extrudedShape(shape, depth, material, parent, x = 0, y = 0, z = 0) {
const geometry = new THREE.ExtrudeGeometry(shape, {
depth,
bevelEnabled: false,
steps: 1,
curveSegments: 1
});
geometry.translate(0, 0, -depth / 2);
geometry.computeVertexNormals();
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// -------------------------------------------------------------------------
// Restricted diorama base
// -------------------------------------------------------------------------
box(58, 0.75, 35, materials.base, 0, -0.42, 1.0);
const groundGeometry = new THREE.PlaneGeometry(58, 35, 10, 6);
groundGeometry.rotateX(-Math.PI / 2);
const groundColors = [];
const groundPalette = [
new THREE.Color(0x87997a),
new THREE.Color(0x819474),
new THREE.Color(0x91a080),
new THREE.Color(0x7d916f)
];
const groundPositions = groundGeometry.attributes.position;
for (let i = 0; i < groundPositions.count; i++) {
const color =
groundPalette[
Math.abs(
Math.floor(groundPositions.getX(i) * 0.7) +
Math.floor(groundPositions.getZ(i) * 0.9)
) % groundPalette.length
];
groundColors.push(color.r, color.g, color.b);
}
groundGeometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(groundColors, 3)
);
const ground = new THREE.Mesh(
groundGeometry,
standard(0xffffff, 0.96, { vertexColors: true })
);
ground.position.y = -0.025;
ground.receiveShadow = true;
scene.add(ground);
// A narrow street passes through the arches and meets the square.
box(7.2, 0.07, 15.7, materials.road, -7.0, 0.025, -7.8);
box(7.55, 0.15, 0.24, materials.stoneLight, -7.0, 0.08, 0.02);
// -------------------------------------------------------------------------
// Open plaza and low-poly paving
// -------------------------------------------------------------------------
box(40.2, 0.08, 15.3, materials.plaza, 6.75, 0.015, 6.0);
const tileGeometry = new THREE.BoxGeometry(1.43, 0.075, 1.33);
const tileMaterial = standard(0xffffff, 0.95);
const tileCount = 27 * 11;
const tiles = new THREE.InstancedMesh(tileGeometry, tileMaterial, tileCount);
const dummy = new THREE.Object3D();
const tileColors = [
new THREE.Color(0xc4b99d),
new THREE.Color(0xb9ad91),
new THREE.Color(0xcec2a6),
new THREE.Color(0xb3aa93)
];
let tileIndex = 0;
for (let row = 0; row < 11; row++) {
for (let col = 0; col < 27; col++) {
dummy.position.set(
-12.75 + col * 1.5,
0.075,
-0.75 + row * 1.4
);
dummy.rotation.y = ((row + col) % 2) * 0.008;
dummy.updateMatrix();
tiles.setMatrixAt(tileIndex, dummy.matrix);
tiles.setColorAt(
tileIndex,
tileColors[(col * 3 + row * 5) % tileColors.length]
);
tileIndex++;
}
}
tiles.receiveShadow = true;
scene.add(tiles);
// -------------------------------------------------------------------------
// The Lapa aqueduct: two stacked tiers of repeated semicircular arches
// -------------------------------------------------------------------------
function makeSpandrelShape(bayWidth, springY, radius, topY, segments = 12) {
const shape = new THREE.Shape();
const halfBay = bayWidth / 2;
shape.moveTo(-halfBay, springY);
shape.lineTo(-radius, springY);
for (let i = 0; i <= segments; i++) {
const angle = Math.PI - (i / segments) * Math.PI;
shape.lineTo(
Math.cos(angle) * radius,
springY + Math.sin(angle) * radius
);
}
shape.lineTo(halfBay, springY);
shape.lineTo(halfBay, topY);
shape.lineTo(-halfBay, topY);
shape.closePath();
return shape;
}
function makeArchRingShape(radius, thickness, springY, segments = 12) {
const shape = new THREE.Shape();
const outer = radius + thickness;
shape.moveTo(-outer, springY);
for (let i = 0; i <= segments; i++) {
const angle = Math.PI - (i / segments) * Math.PI;
shape.lineTo(
Math.cos(angle) * outer,
springY + Math.sin(angle) * outer
);
}
shape.lineTo(radius, springY);
for (let i = 0; i <= segments; i++) {
const angle = (i / segments) * Math.PI;
shape.lineTo(
Math.cos(angle) * radius,
springY + Math.sin(angle) * radius
);
}
shape.closePath();
return shape;
}
const aqueduct = new THREE.Group();
aqueduct.position.set(-3.4, 0, -8.6);
scene.add(aqueduct);
const bayCount = 17;
const bayWidth = 2.45;
const aqueductLength = bayCount * bayWidth;
const wallDepth = 1.55;
const startX = -aqueductLength / 2;
const lowerSpring = 2.65;
const lowerRadius = 1.04;
const lowerTop = 3.94;
const middleBand = 4.15;
const upperSpring = 6.55;
const upperRadius = 0.78;
const upperTop = 8.82;
const stoneVariants = [
materials.stone,
materials.stoneWarm,
materials.stoneLight,
standard(0xd1c3aa)
];
// Foundation and continuous horizontal bands.
box(
aqueductLength + 0.4,
0.34,
wallDepth + 0.18,
materials.stoneDark,
0,
0.17,
0,
aqueduct
);
box(
aqueductLength + 0.28,
0.44,
wallDepth + 0.16,
materials.stoneLight,
0,
middleBand,
0,
aqueduct
);
box(
aqueductLength + 0.28,
0.09,
wallDepth + 0.18,
materials.joint,
0,
middleBand - 0.18,
0,
aqueduct
);
box(
aqueductLength + 0.5,
0.34,
wallDepth + 0.24,
materials.stoneLight,
0,
8.88,
0,
aqueduct
);
box(
aqueductLength + 0.72,
0.18,
wallDepth + 0.38,
materials.stone,
0,
9.11,
0,
aqueduct
);
// A restrained upper parapet emphasizes the long horizontal silhouette.
box(
aqueductLength - 0.2,
0.32,
0.22,
materials.stoneWarm,
0,
9.34,
0,
aqueduct
);
for (let i = 0; i < bayCount; i++) {
const centerX = startX + (i + 0.5) * bayWidth;
const variant = stoneVariants[i % stoneVariants.length];
// Lower tier.
extrudedShape(
makeSpandrelShape(
bayWidth,
lowerSpring,
lowerRadius,
lowerTop
),
wallDepth,
variant,
aqueduct,
centerX
);
extrudedShape(
makeArchRingShape(lowerRadius, 0.17, lowerSpring),
0.11,
materials.stoneDark,
aqueduct,
centerX,
0,
wallDepth / 2 + 0.035
);
// Upper tier.
extrudedShape(
makeSpandrelShape(
bayWidth,
upperSpring,
upperRadius,
upperTop
),
wallDepth,
stoneVariants[(i + 2) % stoneVariants.length],
aqueduct,
centerX
);
extrudedShape(
makeArchRingShape(upperRadius, 0.14, upperSpring),
0.11,
materials.stoneDark,
aqueduct,
centerX,
0,
wallDepth / 2 + 0.035
);
}
// Vertical supports and impost blocks make the rhythm legible.
for (let i = 0; i <= bayCount; i++) {
const x = startX + i * bayWidth;
box(
0.38,
lowerSpring,
wallDepth + 0.035,
stoneVariants[i % stoneVariants.length],
x,
lowerSpring / 2,
0,
aqueduct
);
box(
0.35,
upperSpring - (middleBand + 0.22),
wallDepth + 0.035,
stoneVariants[(i + 1) % stoneVariants.length],
x,
(upperSpring + middleBand + 0.22) / 2,
0,
aqueduct
);
box(
0.56,
0.15,
wallDepth + 0.18,
materials.stoneLight,
x,
lowerSpring,
0,
aqueduct
);
box(
0.49,
0.13,
wallDepth + 0.18,
materials.stoneLight,
x,
upperSpring,
0,
aqueduct
);
}
// -------------------------------------------------------------------------
// Small neighborhood facades
// -------------------------------------------------------------------------
function makeLabel(text, width, height, background = "#243b38", foreground = "#fff4db") {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 160;
const context = canvas.getContext("2d");
context.fillStyle = background;
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = "rgba(255,255,255,0.25)";
context.lineWidth = 5;
context.strokeRect(8, 8, canvas.width - 16, canvas.height - 16);
context.fillStyle = foreground;
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "700 58px Arial, sans-serif";
context.fillText(text, canvas.width / 2, canvas.height / 2 + 2);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: texture })
);
}
function createFacade({
x,
z,
width,
depth,
height,
color,
roofColor = 0x5c625d,
sign = ""
}) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
const facadeMaterial = standard(color, 0.92);
const trimMaterial = standard(0xf0e5ce, 0.88);
const darkMaterial = standard(0x344744, 0.74);
const shutterMaterial = standard(color, 0.95);
const front = depth / 2 + 0.055;
box(width, height, depth, facadeMaterial, 0, height / 2, 0, group);
box(width + 0.12, 0.42, depth + 0.08, trimMaterial, 0, 0.21, 0, group);
box(width + 0.18, 0.22, depth + 0.14, trimMaterial, 0, height - 0.2, 0, group);
box(width + 0.32, 0.18, depth + 0.22, standard(roofColor), 0, height, 0, group);
// Ground-floor doorway.
box(
0.88,
1.8,
0.12,
darkMaterial,
-width * 0.18,
0.98,
front,
group
);
box(
0.96,
0.12,
0.18,
trimMaterial,
-width * 0.18,
1.92,
front + 0.02,
group
);
// Upper windows and shutters.
const floors = Math.max(2, Math.floor((height - 2) / 2.15));
const columns = width > 4 ? 2 : 1;
for (let floor = 0; floor < floors; floor++) {
const y = 3.35 + floor * 2.15;
for (let column = 0; column < columns; column++) {
const windowX =
columns === 1
? 0
: (column === 0 ? -width * 0.24 : width * 0.24);
box(
0.72,
1.02,
0.11,
darkMaterial,
windowX,
y,
front,
group
);
box(
0.30,
0.88,
0.10,
shutterMaterial,
windowX - 0.48,
y,
front + 0.025,
group
);
box(
0.30,
0.88,
0.10,
shutterMaterial,
windowX + 0.48,
y,
front + 0.025,
group
);
box(
0.82,
0.11,
0.24,
trimMaterial,
windowX,
y - 0.55,
front + 0.06,
group
);
}
}
// Simple projecting awning.
const awning = box(
width * 0.66,
0.12,
0.72,
standard(0xb86449),
0,
2.55,
front + 0.27,
group
);
awning.rotation.x = -0.08;
if (sign) {
const signMesh = makeLabel(sign, Math.min(width * 0.78, 3.5), 0.64);
signMesh.position.set(0, 2.68, front + 0.10);
group.add(signMesh);
}
// Faceted rooftop water tank.
const tankX = width * 0.23;
box(0.12, 0.65, 0.12, materials.metal, tankX - 0.35, height + 0.4, 0, group);
box(0.12, 0.65, 0.12, materials.metal, tankX + 0.35, height + 0.4, 0, group);
cylinder(
0.56,
0.56,
1.05,
8,
standard(0x8f9b91),
tankX,
height + 1.14,
0,
group
);
cylinder(
0.59,
0.59,
0.12,
8,
materials.metal,
tankX,
height + 1.7,
0,
group
);
return group;
}
createFacade({
x: 19.75,
z: -10.1,
width: 3.8,
depth: 4.8,
height: 8.1,
color: 0xc97859,
roofColor: 0x555d59,
sign: "CAFÉ"
});
createFacade({
x: 23.65,
z: -9.7,
width: 3.8,
depth: 5.0,
height: 9.3,
color: 0xc8b578,
roofColor: 0x62594f,
sign: "SANTA TERESA"
});
createFacade({
x: 27.3,
z: -10.4,
width: 2.9,
depth: 4.4,
height: 7.3,
color: 0x6d9994,
roofColor: 0x475955
});
createFacade({
x: -27.0,
z: -10.2,
width: 3.3,
depth: 4.8,
height: 7.4,
color: 0xc4a06e,
roofColor: 0x5b5d58
});
// -------------------------------------------------------------------------
// Fountain
// -------------------------------------------------------------------------
const fountain = new THREE.Group();
fountain.position.set(7.0, 0, 5.2);
scene.add(fountain);
cylinder(2.85, 3.05, 0.46, 16, materials.stoneLight, 0, 0.3, 0, fountain);
cylinder(2.57, 2.57, 0.055, 20, materials.water, 0, 0.56, 0, fountain);
cylinder(0.34, 0.52, 1.08, 10, materials.stone, 0, 0.98, 0, fountain);
cylinder(1.12, 0.48, 0.28, 12, materials.stoneLight, 0, 1.55, 0, fountain);
cylinder(0.38, 0.48, 0.65, 8, materials.stone, 0, 1.98, 0, fountain);
// -------------------------------------------------------------------------
// Trees, benches, lamps, people, and a small landmark sign
// -------------------------------------------------------------------------
function createTree(x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0, z);
tree.scale.setScalar(scale);
scene.add(tree);
cylinder(0.18, 0.25, 2.4, 7, materials.trunk, 0, 1.2, 0, tree);
const crown = new THREE.Mesh(
new THREE.IcosahedronGeometry(1.35, 0),
materials.leaf
);
crown.position.set(0, 2.75, 0);
crown.scale.set(1, 1.15, 0.92);
crown.rotation.set(0.2, 0.4, 0.1);
crown.castShadow = true;
tree.add(crown);
const crown2 = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.92, 0),
materials.leafLight
);
crown2.position.set(0.63, 2.42, 0.12);
crown2.castShadow = true;
tree.add(crown2);
const crown3 = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.8, 0),
materials.leaf
);
crown3.position.set(-0.62, 2.55, -0.1);
crown3.castShadow = true;
tree.add(crown3);
}
createTree(-13.4, 10.8, 1.05);
createTree(21.8, 10.6, 1.14);
createTree(24.0, 1.0, 0.84);
createTree(-18.0, -3.0, 0.92);
function createBench(x, z, rotation = 0) {
const bench = new THREE.Group();
bench.position.set(x, 0, z);
bench.rotation.y = rotation;
scene.add(bench);
box(2.6, 0.16, 0.58, materials.woodLight, 0, 0.65, 0, bench);
box(2.6, 0.56, 0.12, materials.wood, 0, 1.0, -0.25, bench);
box(0.18, 0.62, 0.48, materials.metal, -0.95, 0.31, 0, bench);
box(0.18, 0.62, 0.48, materials.metal, 0.95, 0.31, 0, bench);
}
createBench(-2.0, 4.0, -0.08);
createBench(14.6, 8.4, Math.PI);
createBench(1.1, 10.3, Math.PI / 2);
function createLamp(x, z) {
const lamp = new THREE.Group();
lamp.position.set(x, 0, z);
scene.add(lamp);
cylinder(0.07, 0.1, 3.8, 8, materials.metal, 0, 1.9, 0, lamp);
box(0.42, 0.10, 0.42, materials.metal, 0, 3.85, 0, lamp);
const bulbMaterial = standard(0xffe7ad, 0.4, {
emissive: 0xffd27a,
emissiveIntensity: 0.8
});
box(0.29, 0.28, 0.29, bulbMaterial, 0, 3.67, 0, lamp);
}
createLamp(-13.2, -2.1);
createLamp(3.0, -2.1);
createLamp(16.8, -2.1);
createLamp(24.0, 8.8);
function createPerson(x, z, color, rotation = 0, scale = 1) {
const person = new THREE.Group();
person.position.set(x, 0, z);
person.rotation.y = rotation;
person.scale.setScalar(scale);
scene.add(person);
const clothes = standard(color, 0.9);
const skin = standard(0xa96e4c, 0.95);
box(0.13, 0.65, 0.14, materials.metal, -0.13, 0.35, 0, person);
box(0.13, 0.65, 0.14, materials.metal, 0.13, 0.35, 0, person);
cylinder(0.25, 0.32, 0.78, 6, clothes, 0, 1.04, 0, person);
const head = new THREE.Mesh(
new THREE.SphereGeometry(0.2, 7, 5),
skin
);
head.position.y = 1.62;
head.castShadow = true;
person.add(head);
}
createPerson(-4.2, 2.8, 0xc55e48, 0.8, 0.98);
createPerson(3.3, 7.6, 0x527f8d, -0.5, 1.04);
createPerson(11.3, 2.6, 0xe0b052, 2.1, 0.92);
createPerson(17.1, 6.5, 0x6e8660, 1.4, 1.0);
createPerson(-8.1, -0.1, 0x7b708d, 0.1, 0.9);
createPerson(8.7, -3.4, 0xc99d68, 2.6, 0.95);
// Freestanding landmark sign.
const signGroup = new THREE.Group();
signGroup.position.set(-12.0, 0, 1.7);
signGroup.rotation.y = 0.12;
scene.add(signGroup);
box(0.13, 1.8, 0.13, materials.wood, -0.78, 0.9, 0, signGroup);
box(0.13, 1.8, 0.13, materials.wood, 0.78, 0.9, 0, signGroup);
box(2.25, 0.95, 0.15, materials.wood, 0, 1.55, 0, signGroup);
const landmarkLabel = makeLabel("ARCO DA LAPA", 2.05, 0.64);
landmarkLabel.position.set(0, 1.55, 0.085);
signGroup.add(landmarkLabel);
// -------------------------------------------------------------------------
// Small details around the aqueduct
// -------------------------------------------------------------------------
// Low edge blocks emphasize the ends of the slice.
box(0.55, 0.7, 2.1, materials.stoneDark, -24.15, 0.35, -8.6);
box(0.55, 0.7, 2.1, materials.stoneDark, 17.35, 0.35, -8.6);
// Simple bollards around the plaza/street transition.
const bollardMaterial = standard(0x40534e);
for (let i = 0; i < 7; i++) {
const x = -11.2 + i * 2.0;
cylinder(0.11, 0.15, 0.62, 8, bollardMaterial, x, 0.31, -0.45);
}
// -------------------------------------------------------------------------
// Render loop and resize
// -------------------------------------------------------------------------
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);
updateCamera();
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
requestAnimationFrame(() => {
document.getElementById("loading").classList.add("hidden");
setTimeout(() => document.getElementById("loading").remove(), 400);
});
</script>
</body>
</html>
```