Prompt specification
Build or customize the Three.js 3D scene "Craft table on a Curitiba historic 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: Craft table on a Curitiba historic lane
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/craft-table-on-a-curitiba-historic-lane-x2654
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts Curitiba's Largo da Ordem historic district. Create a compact referenced lane vignette with an original craft stall, historic facade, and pedestrians. Show browsing space beside a continuous walking corridor. Voxel style.
Working Three.js Starter (craft-table-on-a-curitiba-historic-lane-x2654):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>Largo da Ordem — Curitiba Voxel Vignette</title>
<style>
:root {
--ink: #203a3c;
--paper: #f5ead0;
--paper-soft: rgba(245, 234, 208, 0.92);
--gold: #d7ad57;
--teal: #39706d;
--line: rgba(32, 58, 60, 0.22);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #b9d1c9;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#stage {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
image-rendering: pixelated;
touch-action: none;
cursor: grab;
}
canvas:active { cursor: grabbing; }
.panel {
position: fixed;
z-index: 10;
background: var(--paper-soft);
border: 1px solid rgba(255, 255, 255, 0.52);
box-shadow: 0 14px 35px rgba(31, 55, 52, 0.15);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
#title-card {
top: 22px;
left: 22px;
width: min(390px, calc(100vw - 44px));
padding: 18px 19px 16px;
border-radius: 3px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 8px;
color: var(--teal);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 23px;
height: 2px;
background: var(--gold);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(26px, 4vw, 38px);
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
.subtitle {
margin: 10px 0 13px;
color: rgba(32, 58, 60, 0.75);
font-size: 12px;
line-height: 1.45;
}
.legend {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 6px;
}
.legend span {
display: flex;
align-items: center;
gap: 7px;
min-height: 27px;
padding: 5px 7px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.25);
color: rgba(32, 58, 60, 0.82);
font-size: 10px;
font-weight: 700;
line-height: 1.15;
}
.legend i {
flex: 0 0 auto;
width: 9px;
height: 9px;
background: var(--gold);
box-shadow: 0 0 0 3px rgba(215, 173, 87, 0.17);
}
.legend span:nth-child(2) i { background: #c4785e; }
.legend span:nth-child(3) i { background: #688d78; }
.legend span:nth-child(4) i { background: #50777a; }
#reference-note {
left: 22px;
bottom: 22px;
width: min(390px, calc(100vw - 44px));
padding: 12px 15px;
border-left: 3px solid var(--gold);
border-radius: 2px;
color: rgba(32, 58, 60, 0.76);
font-size: 10px;
line-height: 1.5;
}
#reference-note strong {
display: block;
margin-bottom: 3px;
color: var(--ink);
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
#toolbar {
right: 22px;
bottom: 22px;
display: flex;
gap: 7px;
padding: 7px;
border-radius: 3px;
}
button {
appearance: none;
border: 1px solid var(--line);
border-radius: 2px;
background: rgba(255, 255, 255, 0.38);
color: var(--ink);
padding: 9px 11px;
font: inherit;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.05em;
text-transform: uppercase;
cursor: pointer;
}
button:hover {
background: var(--ink);
color: var(--paper);
}
#hotspots {
position: fixed;
inset: 0;
z-index: 5;
pointer-events: none;
transition: opacity 180ms ease;
}
.hotspot {
position: absolute;
display: flex;
align-items: center;
gap: 8px;
transform: translate(-50%, -100%);
opacity: 0;
transition: opacity 160ms ease;
white-space: nowrap;
}
.hotspot.visible { opacity: 1; }
.hotspot > span {
display: grid;
width: 25px;
height: 25px;
place-items: center;
border: 2px solid var(--paper);
border-radius: 50%;
background: var(--ink);
color: var(--paper);
box-shadow: 0 3px 9px rgba(22, 44, 42, 0.25);
font-size: 9px;
font-weight: 900;
}
.hotspot > div {
padding: 6px 8px;
border-left: 2px solid var(--gold);
background: rgba(245, 234, 208, 0.91);
box-shadow: 0 4px 12px rgba(22, 44, 42, 0.13);
color: var(--ink);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.025em;
}
.hotspot small {
display: block;
margin-top: 2px;
color: rgba(32, 58, 60, 0.66);
font-size: 8px;
font-weight: 600;
}
.hotspot::after {
content: "";
position: absolute;
left: 12px;
top: 24px;
width: 1px;
height: 20px;
background: rgba(32, 58, 60, 0.55);
}
.ui-hidden .panel,
.ui-hidden #hotspots {
opacity: 0;
pointer-events: none;
}
#help {
position: fixed;
right: 24px;
top: 22px;
z-index: 8;
padding: 8px 10px;
border-radius: 2px;
background: rgba(32, 58, 60, 0.72);
color: var(--paper);
font-size: 9px;
letter-spacing: 0.04em;
pointer-events: none;
}
@media (max-width: 700px) {
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 13px 14px;
}
.subtitle { display: none; }
.legend {
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 4px;
margin-top: 10px;
}
.legend span {
justify-content: center;
min-height: 25px;
padding: 4px;
font-size: 0;
}
.legend i {
width: 10px;
height: 10px;
}
#reference-note {
left: 12px;
bottom: 12px;
width: calc(100vw - 126px);
padding: 9px 10px;
font-size: 9px;
}
#reference-note strong { font-size: 9px; }
#toolbar {
right: 12px;
bottom: 12px;
flex-direction: column;
}
button {
padding: 8px;
font-size: 9px;
}
#help { display: none; }
.hotspot > div { display: none; }
}
</style>
</head>
<body>
<div id="stage" aria-label="Interactive voxel scene of Curitiba's Largo da Order historic district"></div>
<div id="hotspots" aria-hidden="true">
<div class="hotspot" data-point="facade">
<span>01</span>
<div>Attached historic edge<small>Pastel façades and stoop rhythm</small></div>
</div>
<div class="hotspot" data-point="stall">
<span>02</span>
<div>Original craft stall<small>Ateliê do Beco</small></div>
</div>
<div class="hotspot" data-point="route">
<span>03</span>
<div>Continuous walking corridor<small>Clear route through the vignette</small></div>
</div>
<div class="hotspot" data-point="browse">
<span>04</span>
<div>Lane-edge browsing pocket<small>Commerce stays beside the route</small></div>
</div>
</div>
<section id="title-card" class="panel">
<div class="eyebrow">Curitiba · Paraná</div>
<h1>Largo da Ordem</h1>
<p class="subtitle">
A compact voxel interpretation of the historic lane edge, combining an
attached pastel street wall, independent craft commerce, and a clear
pedestrian route.
</p>
<div class="legend" aria-label="Scene legend">
<span><i></i>Historic edge</span>
<span><i></i>Craft stall</span>
<span><i></i>Browse pocket</span>
<span><i></i>Walk corridor</span>
</div>
</section>
<aside id="reference-note" class="panel">
<strong>Referenced urban vignette</strong>
Interpretive study of the low-rise façades, shopfront rhythm, and social
street edge associated with Largo da Ordem and Rua São Francisco.
Not a surveyed architectural reconstruction.
</aside>
<nav id="toolbar" class="panel" aria-label="Scene controls">
<button id="reset-view" type="button" title="Reset the camera">Reset</button>
<button id="toggle-labels" type="button" title="Show or hide labels">Labels</button>
<button id="toggle-ui" type="button" title="Hide or show interface">UI</button>
</nav>
<div id="help">DRAG TO ORBIT · SHIFT/RIGHT-DRAG TO PAN · WHEEL TO ZOOM · R TO RESET</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ---------------------------------------------------------------------
// Renderer, camera, and direct camera controls (no external addons)
// ---------------------------------------------------------------------
const stage = document.querySelector("#stage");
const scene = new THREE.Scene();
scene.background = new THREE.Color("#bdd2ca");
scene.fog = new THREE.Fog("#bdd2ca", 64, 110);
const renderer = new THREE.WebGLRenderer({
antialias: false,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.25));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFShadowMap;
stage.appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-30, 30, 20, -20, 0.1, 180);
const controls = {
target: new THREE.Vector3(-1.5, 2.2, 0),
yaw: 0.64,
pitch: 0.98,
zoom: 1,
radius: 62
};
function updateCamera() {
const { target, yaw, pitch, radius } = controls;
camera.position.set(
target.x + radius * Math.sin(pitch) * Math.sin(yaw),
target.y + radius * Math.cos(pitch),
target.z + radius * Math.sin(pitch) * Math.cos(yaw)
);
camera.lookAt(target);
camera.zoom = controls.zoom;
camera.updateProjectionMatrix();
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
const worldHeight = Math.max(34, 61 / aspect);
camera.left = -worldHeight * aspect / 2;
camera.right = worldHeight * aspect / 2;
camera.top = worldHeight / 2;
camera.bottom = -worldHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
updateCamera();
}
window.addEventListener("resize", resize);
resize();
const pointerMap = new Map();
let interactionMode = "orbit";
let pinchDistance = 0;
renderer.domElement.addEventListener("contextmenu", event => event.preventDefault());
renderer.domElement.addEventListener("pointerdown", event => {
renderer.domElement.setPointerCapture(event.pointerId);
pointerMap.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointerMap.size === 2) {
const points = [...pointerMap.values()];
pinchDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
interactionMode = "pinch";
} else {
interactionMode =
event.button === 2 || event.shiftKey ? "pan" : "orbit";
}
});
renderer.domElement.addEventListener("pointermove", event => {
const previous = pointerMap.get(event.pointerId);
if (!previous) return;
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
pointerMap.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (interactionMode === "pinch" && pointerMap.size === 2) {
const points = [...pointerMap.values()];
const distance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
if (pinchDistance > 0) {
controls.zoom = THREE.MathUtils.clamp(
controls.zoom * distance / pinchDistance,
0.58,
2.65
);
}
pinchDistance = distance;
updateCamera();
return;
}
if (interactionMode === "orbit") {
controls.yaw -= dx * 0.006;
controls.pitch = THREE.MathUtils.clamp(
controls.pitch + dy * 0.0045,
0.48,
1.32
);
} else {
const direction = new THREE.Vector3();
camera.getWorldDirection(direction);
direction.y = 0;
direction.normalize();
const right = new THREE.Vector3()
.crossVectors(direction, camera.up)
.normalize();
const unitsPerPixel =
(camera.top - camera.bottom) /
camera.zoom /
renderer.domElement.clientHeight;
controls.target
.addScaledVector(right, -dx * unitsPerPixel)
.addScaledVector(direction, dy * unitsPerPixel);
}
updateCamera();
});
function releasePointer(event) {
pointerMap.delete(event.pointerId);
if (pointerMap.size === 1) {
interactionMode = "orbit";
} else if (pointerMap.size === 0) {
interactionMode = "orbit";
}
}
renderer.domElement.addEventListener("pointerup", releasePointer);
renderer.domElement.addEventListener("pointercancel", releasePointer);
renderer.domElement.addEventListener("wheel", event => {
event.preventDefault();
controls.zoom = THREE.MathUtils.clamp(
controls.zoom * (event.deltaY > 0 ? 0.9 : 1.1),
0.58,
2.65
);
updateCamera();
}, { passive: false });
function resetView() {
controls.target.set(-1.5, 2.2, 0);
controls.yaw = 0.64;
controls.pitch = 0.98;
controls.zoom = 1;
updateCamera();
}
document.querySelector("#reset-view").addEventListener("click", resetView);
document.querySelector("#toggle-labels").addEventListener("click", event => {
const layer = document.querySelector("#hotspots");
layer.hidden = !layer.hidden;
event.currentTarget.textContent = layer.hidden ? "Labels" : "Hide labels";
});
document.querySelector("#toggle-ui").addEventListener("click", event => {
document.body.classList.toggle("ui-hidden");
event.currentTarget.textContent =
document.body.classList.contains("ui-hidden") ? "Show UI" : "UI";
});
window.addEventListener("keydown", event => {
if (event.key.toLowerCase() === "r") resetView();
if (event.key.toLowerCase() === "h") {
document.body.classList.toggle("ui-hidden");
}
});
// ---------------------------------------------------------------------
// Voxel construction helpers
// ---------------------------------------------------------------------
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const materialCache = new Map();
function material(color) {
if (color && color.isMaterial) return color;
const key = String(color);
if (!materialCache.has(key)) {
materialCache.set(
key,
new THREE.MeshStandardMaterial({
color,
roughness: 0.92,
metalness: 0,
flatShading: true
})
);
}
return materialCache.get(key);
}
function box(w, h, d, color, x = 0, y = 0, z = 0, parent = scene) {
const mesh = new THREE.Mesh(cubeGeometry, material(color));
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeTextSign(text, width, height, background, foreground, parent) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 192;
const context = canvas.getContext("2d");
context.fillStyle = background;
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = foreground;
context.lineWidth = 7;
context.strokeRect(12, 12, canvas.width - 24, canvas.height - 24);
context.fillStyle = foreground;
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "700 68px Arial, sans-serif";
context.fillText(text, canvas.width / 2, canvas.height / 2 + 3);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.magFilter = THREE.NearestFilter;
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: texture })
);
parent.add(mesh);
return mesh;
}
function paverGrid(x0, x1, z0, z1, step, size, y, colors) {
const columns = Math.max(1, Math.floor((x1 - x0) / step));
const rows = Math.max(1, Math.floor((z1 - z0) / step));
const count = columns * rows;
const mesh = new THREE.InstancedMesh(
cubeGeometry,
material("#ffffff"),
count
);
const dummy = new THREE.Object3D();
const color = new THREE.Color();
let index = 0;
for (let row = 0; row < rows; row++) {
for (let column = 0; column < columns; column++) {
dummy.position.set(
x0 + column * step + step / 2,
y,
z0 + row * step + step / 2
);
dummy.scale.set(size, 0.11, size);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
color.set(colors[(column * 7 + row * 3) % colors.length]);
mesh.setColorAt(index, color);
index++;
}
}
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
// ---------------------------------------------------------------------
// Lighting and base
// ---------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight("#fff4d7", "#536c61", 2.2);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight("#fff1cf", 3.25);
sun.position.set(-18, 31, 24);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -35;
sun.shadow.camera.right = 35;
sun.shadow.camera.top = 30;
sun.shadow.camera.bottom = -30;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 90;
sun.shadow.bias = -0.00045;
scene.add(sun);
const fill = new THREE.DirectionalLight("#b9dbe1", 0.75);
fill.position.set(24, 14, -20);
scene.add(fill);
box(150, 0.3, 150, "#9bb4a5", 0, -1.35, 0);
box(58, 1.1, 30, "#584e45", 0, -0.68, 0);
box(57.6, 0.18, 29.6, "#8fa487", 0, -0.04, 0);
// Continuous pedestrian corridor.
paverGrid(
-27, 27, -2.7, 2.7, 1.14, 1.08, 0.13,
["#b8ad92", "#c0b69d", "#b1a68c", "#c6bca3"]
);
box(56, 0.075, 0.14, "#d1b266", 0, 0.17, -2.83);
box(56, 0.075, 0.14, "#d1b266", 0, 0.17, 2.83);
// Subtle inlaid markers preserve a visibly uninterrupted route.
for (let x = -24; x <= 24; x += 6) {
box(0.42, 0.03, 0.42, "#d8bd72", x, 0.205, 0);
}
// Historic-side footway.
paverGrid(
-27, 24, -5.7, -2.85, 1.12, 1.06, 0.12,
["#c5b99e", "#cfc1a5", "#bdb298"]
);
// Distinct craft-browsing pocket outside the through-route.
paverGrid(
2.1, 14.1, 3.05, 9.7, 1.15, 1.08, 0.13,
["#c9906e", "#d39b78", "#bd8265", "#d6a17e"]
);
// A small pocket-park edge on the opposite side.
box(18.5, 0.12, 7.3, "#789479", -14.2, 0.12, 5.5);
box(18.8, 0.18, 0.22, "#d0c09d", -14.2, 0.19, 2.93);
// ---------------------------------------------------------------------
// Historic attached facades
// ---------------------------------------------------------------------
function addWindow(parent, x, y, z, width, height, shutterColor) {
box(width, height, 0.10, "#29464a", x, y, z, parent);
const frame = "#f1dfb8";
box(width + 0.22, 0.11, 0.13, frame, x, y + height / 2, z + 0.035, parent);
box(width + 0.22, 0.11, 0.13, frame, x, y - height / 2, z + 0.035, parent);
box(0.11, height, 0.13, frame, x - width / 2, y, z + 0.035, parent);
box(0.11, height, 0.13, frame, x + width / 2, y, z + 0.035, parent);
box(0.08, height, 0.10, frame, x, y, z + 0.075, parent);
box(width, 0.08, 0.10, frame, x, y, z + 0.075, parent);
box(width / 2 + 0.18, height + 0.08, 0.09, shutterColor,
x - width * 0.72, y, z + 0.02, parent);
box(width / 2 + 0.18, height + 0.08, 0.09, shutterColor,
x + width * 0.72, y, z + 0.02, parent);
}
function createBuilding({
x,
width,
height,
depth,
color,
trim,
shutters,
hero = false,
signText = ""
}) {
const group = new THREE.Group();
group.position.set(x, 0, -9.25);
scene.add(group);
const front = depth / 2;
box(width, height, depth, color, 0, height / 2 + 0.1, 0, group);
box(width + 0.18, 0.7, depth + 0.18, "#776e5d", 0, 0.45, 0, group);
// Horizontal string courses.
box(width + 0.12, 0.15, 0.16, trim, 0, 3.18, front + 0.08, group);
if (height > 9) {
box(width + 0.12, 0.14, 0.16, trim, 0, 6.45, front + 0.08, group);
}
// Pale corner pilasters.
box(0.28, height - 0.2, 0.18, trim,
-width / 2 + 0.18, height / 2 + 0.1, front + 0.09, group);
box(0.28, height - 0.2, 0.18, trim,
width / 2 - 0.18, height / 2 + 0.1, front + 0.09, group);
// Roof, parapet, and small terracotta roof plane.
box(width + 0.32, 0.28, depth + 0.32, "#a75b46", 0, height + 0.24, 0, group);
box(width - 0.3, 0.09, depth - 0.3, "#8e493a", 0, height + 0.42, 0, group);
box(width + 0.28, 0.55, 0.28, trim, 0, height + 0.53, front, group);
box(width + 0.28, 0.55, 0.28, trim, 0, height + 0.53, -front, group);
box(0.28, 0.55, depth, trim, -width / 2, height + 0.53, 0, group);
box(0.28, 0.55, depth, trim, width / 2, height + 0.53, 0, group);
// Dentil-like cornice blocks.
for (let dx = -width / 2 + 0.5; dx < width / 2; dx += 0.75) {
box(0.28, 0.25, 0.32, trim, dx, height + 0.18, front + 0.08, group);
}
// Upper-floor windows.
const levels = height > 9 ? [4.2, 7.25] : [4.15, 6.85];
for (const level of levels) {
for (const wx of [-width * 0.29, 0, width * 0.29]) {
addWindow(group, wx, level, front + 0.12, 1.22, 1.65, shutters);
}
}
// Ground-floor door and shop windows.
box(1.52, 2.55, 0.13, "#354944", 0, 1.4, front + 0.12, group);
box(1.76, 0.14, 0.18, trim, 0, 2.72, front + 0.17, group);
box(0.13, 2.7, 0.18, trim, -0.82, 1.4, front + 0.17, group);
box(0.13, 2.7, 0.18, trim, 0.82, 1.4, front + 0.17, group);
box(0.11, 2.48, 0.11, "#9f8158", 0, 1.39, front + 0.23, group);
box(1.85, 0.18, 0.72, "#c2b49a", 0, 0.17, front + 0.42, group);
addWindow(group, -width * 0.29, 1.38, front + 0.12, 1.62, 1.65, shutters);
addWindow(group, width * 0.29, 1.38, front + 0.12, 1.62, 1.65, shutters);
// Wall drain and a few masonry accents.
box(0.13, height - 0.8, 0.16, "#5e6259",
width / 2 - 0.37, height / 2 + 0.1, front + 0.19, group);
for (let y = 1; y < height - 0.8; y += 1.15) {
box(0.42, 0.18, 0.13, trim,
-width / 2 + 0.18, y, front + 0.19, group);
}
if (hero) {
// Shallow balcony and rail.
box(4.7, 0.22, 1.12, "#d8c7a4", 0, 5.35, front + 0.53, group);
box(4.7, 0.12, 0.12, "#365c58", 0, 5.83, front + 1.04, group);
for (let bx = -2.1; bx <= 2.1; bx += 0.7) {
box(0.09, 0.52, 0.09, "#365c58", bx, 5.59, front + 1.04, group);
}
// A small striped awning.
for (let ax = -1.65; ax <= 1.65; ax += 0.55) {
box(0.52, 0.16, 1.18,
Math.round(ax * 10) % 2 === 0 ? "#e9d7ae" : "#648a78",
ax, 2.94, front + 0.68, group);
}
if (signText) {
const sign = makeTextSign(
signText, 4.25, 0.9, "#efe0b9", "#284b49", group
);
sign.position.set(0, 4.45, front + 0.31);
}
}
return group;
}
createBuilding({
x: -20.1,
width: 8.1,
height: 8.35,
depth: 7.1,
color: "#d77f69",
trim: "#efd2a2",
shutters: "#597469"
});
createBuilding({
x: -10.7,
width: 9.1,
height: 10.15,
depth: 7.5,
color: "#d0a04e",
trim: "#f3dfb2",
shutters: "#567368",
hero: true,
signText: "CASA DO LARGO"
});
createBuilding({
x: -1.0,
width: 9.0,
height: 8.9,
depth: 7.2,
color: "#d7c096",
trim: "#a85e49",
shutters: "#7a8a6c"
});
createBuilding({
x: 8.7,
width: 9.0,
height: 8.05,
depth: 7.0,
color: "#b9785e",
trim: "#ead2a6",
shutters: "#496f68"
});
createBuilding({
x: 17.8,
width: 7.4,
height: 9.35,
depth: 7.4,
color: "#c8aa78",
trim: "#f0d9ad",
shutters: "#58776d"
});
// ---------------------------------------------------------------------
// Original craft stall: Ateliê do Beco
// ---------------------------------------------------------------------
const stall = new THREE.Group();
stall.position.set(7.7, 0.12, 6.15);
scene.add(stall);
const wood = "#704832";
const darkWood = "#4c3529";
// Posts and frame.
for (const px of [-3.45, 3.45]) {
for (const pz of [-1.28, 1.28]) {
box(0.22, 3.45, 0.22, wood, px, 1.72, pz, stall);
}
}
box(7.25, 0.22, 0.22, darkWood, 0, 3.38, -1.28, stall);
box(7.25, 0.22, 0.22, darkWood, 0, 3.38, 1.28, stall);
// Stepped voxel canopy.
for (let stripe = -7; stripe <= 7; stripe++) {
const color = stripe % 2 === 0 ? "#e8d5aa" : "#b75f49";
box(0.52, 0.24, 3.35, color, stripe * 0.53, 3.57, 0, stall);
}
box(8.1, 0.17, 0.32, "#b65d48", 0, 3.48, 1.65, stall);
box(8.1, 0.17, 0.32, "#b65d48", 0, 3.48, -1.65, stall);
for (let fringe = -3.6; fringe <= 3.6; fringe += 0.6) {
box(0.3, 0.25, 0.08, "#e8d5aa", fringe, 3.31, 1.78, stall);
}
// Counter and display shelf.
box(7.1, 0.24, 0.88, "#845637", 0, 1.3, 1.18, stall);
box(7.1, 0.7, 0.18, "#6b4933", 0, 0.84, 1.42, stall);
for (const lx of [-3.1, -1.05, 1.05, 3.1]) {
box(0.18, 1.3, 0.7, darkWood, lx, 0.65, 1.18, stall);
}
box(6.8, 0.18, 0.58, wood, 0, 2.2, -1.08, stall);
// Hanging woven pieces on the rear rack.
const textileColors = ["#b85e4c", "#d4a84f", "#557f73", "#d8c7a2"];
for (let textile = 0; textile < 7; textile++) {
box(
0.73, 1.45 + (textile % 2) * 0.25, 0.08,
textileColors[textile % textileColors.length],
-2.65 + textile * 0.88, 2.08, -1.19,
stall
);
box(0.73, 0.12, 0.1, "#f0dfba",
-2.65 + textile * 0.88, 1.43, -1.24, stall);
}
// Ceramic vessels, reduced to stacked voxel silhouettes.
const ceramicColors = ["#b95e45", "#e0a556", "#5f817c", "#d6c4a0"];
for (let item = 0; item < 8; item++) {
const px = -2.95 + item * 0.84;
const pc = ceramicColors[item % ceramicColors.length];
box(0.5, 0.34, 0.5, pc, px, 1.59, 1.17, stall);
box(0.38, 0.28, 0.38, pc, px, 1.9, 1.17, stall);
box(0.23, 0.15, 0.23, pc, px, 2.11, 1.17, stall);
box(0.28, 0.08, 0.28, "#76513c", px, 2.21, 1.17, stall);
}
// Small wooden boxes and paper cards.
box(0.76, 0.42, 0.62, "#a77b4d", -2.5, 2.42, -1.05, stall);
box(0.72, 0.35, 0.58, "#d2b071", 2.45, 2.39, -1.05, stall);
for (let card = 0; card < 5; card++) {
box(
0.42, 0.6, 0.04,
card % 2 ? "#e8d8b3" : "#d7b867",
-1.65 + card * 0.82, 2.64, -0.98,
stall
);
}
// Original stall sign.
const stallSign = makeTextSign(
"ATELIÊ DO BECO", 4.9, 0.82, "#f0dfba", "#365c58", stall
);
stallSign.position.set(0, 2.88, 1.44);
// Crates below the counter.
for (let crate = 0; crate < 4; crate++) {
const px = -2.45 + crate * 1.55;
box(1.05, 0.62, 0.95, "#8b603c", px, 0.45, 1.12, stall);
box(1.08, 0.12, 0.98, "#b17c4e", px, 0.75, 1.12, stall);
}
// ---------------------------------------------------------------------
// Voxel pedestrians
// ---------------------------------------------------------------------
function createPerson(x, z, options = {}) {
const {
shirt = "#557f78",
pants = "#334b50",
skin = "#c98662",
hair = "#49352c",
rotation = 0,
scale = 1,
hat = false,
bag = false,
stride = 0,
raisedArm = false
} = options;
const person = new THREE.Group();
person.position.set(x, 0.18, z);
person.rotation.y = rotation;
person.scale.setScalar(scale);
scene.add(person);
const leftLeg = box(0.25, 0.74, 0.29, pants, -0.18, 0.46, 0, person);
const rightLeg = box(0.25, 0.74, 0.29, pants, 0.18, 0.46, 0, person);
leftLeg.rotation.x = stride;
rightLeg.rotation.x = -stride;
box(0.30, 0.16, 0.46, "#29383a", -0.18, 0.08, 0.07, person);
box(0.30, 0.16, 0.46, "#29383a", 0.18, 0.08, 0.07, person);
box(0.62, 0.30, 0.38, pants, 0, 0.91, 0, person);
box(0.70, 0.82, 0.43, shirt, 0, 1.43, 0, person);
const leftArm = box(0.22, 0.72, 0.25, shirt, -0.47, 1.42, 0, person);
const rightArm = box(0.22, 0.72, 0.25, shirt, 0.47, 1.42, 0, person);
leftArm.rotation.x = stride * 0.6;
rightArm.rotation.x = -stride * 0.6;
if (raisedArm) rightArm.rotation.x = -0.9;
box(0.22, 0.24, 0.24, skin, -0.47, 1.0, 0, person);
box(0.22, 0.24, 0.24, skin, 0.47, 1.0, 0, person);
box(0.54, 0.56, 0.52, skin, 0, 2.11, 0, person);
box(0.57, 0.20, 0.55, hair, 0, 2.40, -0.015, person);
box(0.13, 0.12, 0.10, skin, 0, 2.09, 0.30, person);
box(0.07, 0.07, 0.04, "#283436", -0.13, 2.16, 0.27, person);
box(0.07, 0.07, 0.04, "#283436", 0.13, 2.16, 0.27, person);
if (hat) {
box(0.70, 0.12, 0.66, "#d8b15f", 0, 2.50, 0, person);
box(0.48, 0.28, 0.48, "#d8b15f", 0, 2.65, 0, person);
}
if (bag) {
box(0.44, 0.52, 0.26, "#b6674e", 0.60, 0.82, 0.03, person);
box(0.07, 0.70, 0.07, "#73452f", 0.45, 1.25, 0.03, person);
}
return person;
}
createPerson(-16.0, 0.35, {
shirt: "#d5a649",
pants: "#3c5153",
skin: "#a8664d",
hair: "#302b28",
rotation: 1.47,
stride: 0.28,
bag: true
});
createPerson(-1.2, -0.75, {
shirt: "#6f8d82",
pants: "#4b4b58",
skin: "#e0aa83",
hair: "#69513a",
rotation: -1.55,
stride: -0.22
});
createPerson(12.6, 0.85, {
shirt: "#c66f59",
pants: "#334b50",
skin: "#bd7759",
hair: "#493329",
rotation: 1.48,
stride: 0.25,
hat: true
});
createPerson(21.4, -0.55, {
shirt: "#466f72",
pants: "#b08b5a",
skin: "#dfa27d",
hair: "#6b4c36",
rotation: -1.5,
stride: -0.2,
bag: true
});
createPerson(-24.0, -1.25, {
shirt: "#8b9b68",
pants: "#43515a",
skin: "#9f6148",
hair: "#292827",
rotation: 1.4,
stride: 0.2
});
// Browsing customer faces back toward the stall.
createPerson(6.25, 8.05, {
shirt: "#b66b72",
pants: "#42515b",
skin: "#d99a74",
hair: "#4a332b",
rotation: Math.PI,
raisedArm: true,
bag: true
});
createPerson(9.15, 7.55, {
shirt: "#d6b256",
pants: "#4e6063",
skin: "#85533f",
hair: "#282727",
rotation: Math.PI,
stride: 0.12
});
// Stall vendor.
const vendor = createPerson(7.75, 5.1, {
shirt: "#486f69",
pants: "#54423a",
skin: "#bd7958",
hair: "#49372e",
rotation: 0
});
vendor.scale.setScalar(0.96);
// A child and guardian in the pocket park.
createPerson(-11.4, 4.6, {
shirt: "#dc8067",
pants: "#496171",
skin: "#c88b68",
hair: "#513b30",
rotation: 0.25,
bag: true
});
createPerson(-10.2, 5.0, {
shirt: "#e2c456",
pants: "#59636b",
skin: "#dca37d",
hair: "#70503a",
rotation: 0.3,
scale: 0.72,
stride: 0.18
});
// ---------------------------------------------------------------------
// Pocket-park furniture, trees, lights, and cafe details
// ---------------------------------------------------------------------
function createTree(x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0.2, z);
tree.scale.setScalar(scale);
scene.add(tree);
box(2.5, 0.48, 2.5, "#b7aa8c", 0, 0.24, 0, tree);
box(2.16, 0.13, 2.16, "#665542", 0, 0.51, 0, tree);
box(0.48, 2.8, 0.48, "#6f4c32", 0, 1.85, 0, tree);
box(2.25, 1.45, 1.8, "#52765d", 0, 3.65, 0, tree);
box(1.65, 1.2, 2.0, "#668863", -0.65, 4.35, 0.15, tree);
box(1.7, 1.05, 1.5, "#75956d", 0.65, 4.5, -0.15, tree);
box(1.1, 0.9, 1.2, "#456d59", 0.05, 5.1, 0.05, tree);
}
createTree(-20.5, 5.55, 1.05);
createTree(23.3, 5.3, 0.9);
function createBench(x, z, rotation = 0) {
const bench = new THREE.Group();
bench.position.set(x, 0.2, z);
bench.rotation.y = rotation;
scene.add(bench);
box(2.7, 0.16, 0.62, "#805b3d", 0, 0.67, 0, bench);
box(2.7, 0.68, 0.14, "#936846", 0, 1.12, -0.28, bench);
for (const bx of [-1.05, 1.05]) {
box(0.15, 0.68, 0.48, "#3f5555", bx, 0.34, 0, bench);
box(0.14, 0.14, 0.56, "#3f5555", bx, 1.12, -0.28, bench);
}
}
createBench(-16.4, 4.9, 0);
createBench(-7.2, 5.5, Math.PI);
function createLamp(x, z) {
const lamp = new THREE.Group();
lamp.position.set(x, 0.16, z);
scene.add(lamp);
box(0.42, 0.22, 0.42, "#395456", 0, 0.11, 0, lamp);
box(0.16, 3.7, 0.16, "#395456", 0, 1.98, 0, lamp);
const glow = new THREE.MeshStandardMaterial({
color: "#f1c96f",
emissive: "#d8973c",
emissiveIntensity: 0.45,
roughness: 0.7
});
box(0.58, 0.72, 0.58, glow, 0, 3.95, 0, lamp);
box(0.82, 0.15, 0.82, "#2f494b", 0, 4.37, 0, lamp);
box(0.70, 0.12, 0.70, "#2f494b", 0, 3.55, 0, lamp);
}
createLamp(-25.0, -3.65);
createLamp(14.8, -3.65);
createLamp(22.4, 3.0);
// Small cafe table and block chairs.
const cafe = new THREE.Group();
cafe.position.set(16.7, 0.15, 6.45);
scene.add(cafe);
box(1.5, 0.13, 1.5, "#d8c59f", 0, 1.1, 0, cafe);
box(0.18, 1.05, 0.18, "#3f5657", 0, 0.53, 0, cafe);
box(0.82, 0.13, 0.82, "#3f5657", 0, 0.08, 0, cafe);
for (const side of [-1, 1]) {
box(0.75, 0.15, 0.75, "#658174", side * 1.25, 0.58, 0, cafe);
box(0.15, 0.8, 0.75, "#658174", side * 1.58, 0.95, 0, cafe);
box(0.12, 0.58, 0.12, "#3f5657", side * 1.25, 0.3, 0, cafe);
}
// Street-name plaque gives the scene an explicit local reference.
const streetSign = new THREE.Group();
streetSign.position.set(-25.0, 0.15, -3.5);
scene.add(streetSign);
box(0.16, 3.0, 0.16, "#3c5353", 0, 1.5, 0, streetSign);
const plaque = makeTextSign(
"LARGO DA ORDEM", 3.7, 0.82, "#e7d8b6", "#335654", streetSign
);
plaque.position.set(0, 3.15, 0.12);
box(4.05, 1.05, 0.12, "#48625e", 0, 3.15, 0, streetSign);
// Bollards define the browsing edge without blocking the walking route.
for (let x = -24; x <= 24; x += 8) {
box(0.22, 0.88, 0.22, "#3d5656", x, 0.6, 3.03);
box(0.28, 0.13, 0.28, "#d0aa59", x, 1.07, 3.03);
}
// ---------------------------------------------------------------------
// Annotation anchors
// ---------------------------------------------------------------------
const anchors = {
facade: new THREE.Vector3(-10.7, 11.4, -5.4),
stall: new THREE.Vector3(7.7, 4.4, 6.2),
route: new THREE.Vector3(-5.5, 0.5, 0),
browse: new THREE.Vector3(7.0, 2.3, 8.2)
};
const hotspotElements = [...document.querySelectorAll(".hotspot")].map(element => ({
element,
point: anchors[element.dataset.point]
}));
function updateHotspots() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const hotspot of hotspotElements) {
const projected = hotspot.point.clone().project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
projected.x > -1.08 &&
projected.x < 1.08 &&
projected.y > -1.08 &&
projected.y < 1.08;
hotspot.element.classList.toggle("visible", visible);
if (visible) {
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
hotspot.element.style.left = `${x}px`;
hotspot.element.style.top = `${y}px`;
}
}
}
// ---------------------------------------------------------------------
// Render
// ---------------------------------------------------------------------
renderer.setAnimationLoop(() => {
updateHotspots();
renderer.render(scene, camera);
});
</script>
</body>
</html>
```