Prompt specification
Build or customize the Three.js 3D scene "Market visitor crossing a layered Athens square" 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: Market visitor crossing a layered Athens square
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/market-visitor-crossing-a-layered-athens-square-x2806
Scene Description Prompt:
Create a compact Monastiraki vignette with original vendor, pedestrians, and referenced historic backdrop. Show a clear route between transit arrival and the adjacent shopping lane. Build this with Three.js from cdnjs as a low-poly scene in one self-contained HTML file.
Working Three.js Starter (market-visitor-crossing-a-layered-athens-square-x2806):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Monastiraki Route Vignette</title>
<style>
:root {
--ink: #17343c;
--paper: #fffaf0;
--route: #00a99d;
--accent: #ef6f4d;
--glass: rgba(255, 250, 240, 0.93);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #b9dce4;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--ink);
}
#scene {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene:active { cursor: grabbing; }
#labels {
position: fixed;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.panel {
position: fixed;
z-index: 10;
background: var(--glass);
border: 1px solid rgba(23, 52, 60, 0.12);
box-shadow: 0 12px 35px rgba(34, 63, 67, 0.14);
backdrop-filter: blur(10px);
}
#title-card {
top: 20px;
left: 20px;
width: min(390px, calc(100vw - 40px));
padding: 18px 20px 16px;
border-radius: 18px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 7px;
color: var(--route);
font-size: 11px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 24px;
height: 3px;
border-radius: 2px;
background: var(--route);
}
h1 {
margin: 0;
font-size: clamp(24px, 3vw, 36px);
line-height: 0.98;
letter-spacing: -0.045em;
}
#title-card p {
margin: 10px 0 0;
max-width: 340px;
color: #587078;
font-size: 13px;
line-height: 1.45;
}
#route-card {
left: 20px;
bottom: 20px;
width: min(390px, calc(100vw - 40px));
padding: 16px;
border-radius: 18px;
}
.route-head {
display: flex;
justify-content: space-between;
gap: 12px;
align-items: center;
margin-bottom: 10px;
}
#route-title {
margin: 0;
font-size: 16px;
letter-spacing: -0.02em;
}
#walk-time {
padding: 5px 8px;
border-radius: 999px;
color: #006f67;
background: rgba(0, 169, 157, 0.11);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
white-space: nowrap;
}
#route-copy {
min-height: 43px;
margin: 0 0 12px;
color: #587078;
font-size: 12px;
line-height: 1.45;
}
#steps {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
}
#steps button {
min-height: 40px;
padding: 7px;
border: 1px solid rgba(23, 52, 60, 0.13);
border-radius: 10px;
background: rgba(255, 255, 255, 0.68);
color: var(--ink);
font: inherit;
font-size: 11px;
font-weight: 750;
cursor: pointer;
transition: 160ms ease;
}
#steps button:hover,
#steps button.active {
border-color: var(--route);
background: var(--route);
color: white;
transform: translateY(-1px);
}
#controls {
top: 20px;
right: 20px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
max-width: min(330px, calc(100vw - 40px));
padding: 8px;
border-radius: 15px;
}
#controls button {
padding: 9px 11px;
border: 0;
border-radius: 10px;
background: rgba(23, 52, 60, 0.08);
color: var(--ink);
font: inherit;
font-size: 11px;
font-weight: 750;
cursor: pointer;
transition: 150ms ease;
}
#controls button:hover {
background: var(--route);
color: white;
}
#hint {
position: fixed;
z-index: 8;
right: 20px;
bottom: 20px;
padding: 9px 12px;
border-radius: 999px;
background: rgba(23, 52, 60, 0.78);
color: white;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.03em;
pointer-events: none;
}
.world-pin {
position: absolute;
left: 0;
top: 0;
display: flex;
align-items: center;
gap: 7px;
padding: 6px 9px 6px 6px;
border: 1px solid rgba(255, 255, 255, 0.7);
border-radius: 999px;
background: rgba(255, 250, 240, 0.94);
box-shadow: 0 7px 20px rgba(23, 52, 60, 0.2);
color: var(--ink);
font: inherit;
font-size: 11px;
font-weight: 800;
white-space: nowrap;
pointer-events: auto;
cursor: pointer;
will-change: transform;
}
.world-pin .number {
display: grid;
place-items: center;
width: 23px;
height: 23px;
border-radius: 50%;
background: var(--route);
color: white;
font-size: 11px;
}
.world-pin.active {
border-color: var(--route);
box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.18),
0 7px 20px rgba(23, 52, 60, 0.2);
}
.historic-label {
position: absolute;
left: 0;
top: 0;
padding: 6px 9px;
border-radius: 8px;
background: rgba(23, 52, 60, 0.72);
color: white;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
will-change: transform;
}
@media (max-width: 700px) {
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 14px 16px;
}
#title-card p { display: none; }
#controls {
top: 105px;
right: 12px;
max-width: calc(100vw - 24px);
}
#route-card {
left: 12px;
bottom: 12px;
width: calc(100vw - 24px);
}
#hint { display: none; }
.world-pin { font-size: 10px; }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive low-poly Monastiraki street vignette"></canvas>
<div id="labels">
<button class="world-pin active" id="pin-0" data-step="0">
<span class="number">1</span><span>Metro arrival</span>
</button>
<button class="world-pin" id="pin-1" data-step="1">
<span class="number">2</span><span>Zisi’s lemons</span>
</button>
<button class="world-pin" id="pin-2" data-step="2">
<span class="number">3</span><span>Shopping lane</span>
</button>
<div class="historic-label" id="historic-label">
Stylized Acropolis reference
</div>
</div>
<section id="title-card" class="panel">
<div class="eyebrow">Athens · compact walk study</div>
<h1>Monastiraki<br>Arrival to Lane</h1>
<p>
A low-poly pedestrian vignette connecting a transit landing, an original
produce vendor, and the neighboring old-town shopping street.
</p>
</section>
<section id="route-card" class="panel" aria-live="polite">
<div class="route-head">
<h2 id="route-title">Begin at the metro landing</h2>
<span id="walk-time">2 MIN WALK</span>
</div>
<p id="route-copy">
Follow the turquoise line from the stair entrance toward the lane.
The luminous arrows show the direction of travel.
</p>
<div id="steps">
<button class="active" data-step="0">1 · Arrival</button>
<button data-step="1">2 · Vendor</button>
<button data-step="2">3 · Shopping</button>
</div>
</section>
<nav id="controls" class="panel" aria-label="Scene controls">
<button id="overview">Overview</button>
<button id="street">Street view</button>
<button id="route-toggle">Hide route</button>
</nav>
<div id="hint">Drag to orbit · Scroll to zoom · Click a numbered marker</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
/* ------------------------------------------------------------------
Renderer and palette
------------------------------------------------------------------ */
const canvas = document.querySelector("#scene");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.75));
renderer.setSize(innerWidth, innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xb9dce4);
scene.fog = new THREE.Fog(0xc7dfe3, 25, 65);
const camera = new THREE.PerspectiveCamera(43, innerWidth / innerHeight, 0.1, 120);
const hemi = new THREE.HemisphereLight(0xdaf3ff, 0xb69468, 2.0);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe6bd, 3.25);
sun.position.set(-11, 19, 13);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -20;
sun.shadow.camera.right = 20;
sun.shadow.camera.top = 18;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 55;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x8ed8eb, 0.55);
fill.position.set(13, 8, -7);
scene.add(fill);
function standard(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.86,
metalness: 0,
flatShading: true,
...options
});
}
const M = {
ground: standard(0xc8b58f),
paving: standard(0xd8c9aa),
curb: standard(0xe9dcc2),
cream: standard(0xf1dfbd),
trim: standard(0xfff0d7),
shadow: standard(0x253a40),
glass: standard(0x294a57, { roughness: 0.28, metalness: 0.25 }),
teal: standard(0x138f88),
route: new THREE.MeshBasicMaterial({ color: 0x00c5b3 }),
routeDark: new THREE.MeshBasicMaterial({
color: 0x145b59,
transparent: true,
opacity: 0.24,
depthWrite: false
}),
wood: standard(0x9c6540),
darkWood: standard(0x5f3b2d),
orange: standard(0xf39a32),
lemon: standard(0xf4ca45),
leaf: standard(0x547c53),
darkLeaf: standard(0x315c45),
skin: standard(0xc98964),
skinLight: standard(0xe0aa83),
hair: standard(0x382d2a),
navy: standard(0x254a64),
rust: standard(0xb85843),
white: standard(0xfff7e9)
};
function addMesh(parent, geometry, material, x = 0, y = 0, z = 0, cast = true) {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = cast;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBox(parent, size, position, material) {
return addMesh(
parent,
new THREE.BoxGeometry(...size),
material,
...position
);
}
function addCylinder(parent, top, bottom, height, sides, position, material) {
return addMesh(
parent,
new THREE.CylinderGeometry(top, bottom, height, sides),
material,
...position
);
}
/* ------------------------------------------------------------------
Procedural pavement and label textures
------------------------------------------------------------------ */
function makeCobbleTexture() {
const c = document.createElement("canvas");
c.width = c.height = 512;
const ctx = c.getContext("2d");
ctx.fillStyle = "#c9b99b";
ctx.fillRect(0, 0, 512, 512);
const colors = ["#d7c8aa", "#bead90", "#e1d3b5", "#cdbb9d", "#b9aa8f"];
let seed = 191;
const rand = () => {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
};
for (let row = 0; row < 9; row++) {
let x = -35 + (row % 2) * 22;
while (x < 512) {
const w = 42 + rand() * 28;
const h = 32 + rand() * 11;
ctx.fillStyle = colors[Math.floor(rand() * colors.length)];
ctx.fillRect(x + 2, row * 57 + 2, w - 4, h - 4);
ctx.strokeStyle = "rgba(87,76,59,.13)";
ctx.strokeRect(x + 2, row * 57 + 2, w - 4, h - 4);
x += w;
}
}
const texture = new THREE.CanvasTexture(c);
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(9, 2.2);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function makePavingTexture() {
const c = document.createElement("canvas");
c.width = c.height = 512;
const ctx = c.getContext("2d");
ctx.fillStyle = "#d4c2a2";
ctx.fillRect(0, 0, 512, 512);
for (let y = 0; y < 512; y += 64) {
for (let x = 0; x < 512; x += 64) {
const shift = (y / 64) % 2 ? 32 : 0;
ctx.fillStyle = (x + y) % 3 ? "#d8c7a8" : "#cfbc9c";
ctx.fillRect(x + shift + 2, y + 2, 60, 60);
}
}
const texture = new THREE.CanvasTexture(c);
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(7, 6);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function makeTextTexture(text, bg = "#17343c", fg = "#fff7e9", fontSize = 52) {
const c = document.createElement("canvas");
c.width = 768;
c.height = 160;
const ctx = c.getContext("2d");
ctx.fillStyle = bg;
ctx.fillRect(0, 0, c.width, c.height);
ctx.strokeStyle = "rgba(255,255,255,.22)";
ctx.lineWidth = 8;
ctx.strokeRect(8, 8, c.width - 16, c.height - 16);
ctx.fillStyle = fg;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = `800 ${fontSize}px Arial, sans-serif`;
ctx.fillText(text, c.width / 2, c.height / 2 + 3, c.width - 50);
const texture = new THREE.CanvasTexture(c);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function addSign(parent, text, width, height, position, options = {}) {
const {
bg = "#17343c",
fg = "#fff7e9",
fontSize = 52
} = options;
const material = new THREE.MeshBasicMaterial({
map: makeTextTexture(text, bg, fg, fontSize),
toneMapped: false,
side: THREE.DoubleSide
});
return addMesh(
parent,
new THREE.PlaneGeometry(width, height),
material,
...position,
false
);
}
/* ------------------------------------------------------------------
Ground, sky and street surfaces
------------------------------------------------------------------ */
const sky = new THREE.Mesh(
new THREE.SphereGeometry(78, 20, 12),
new THREE.ShaderMaterial({
side: THREE.BackSide,
depthWrite: false,
uniforms: {
top: { value: new THREE.Color(0x78b9d0) },
bottom: { value: new THREE.Color(0xf3dfbd) }
},
vertexShader: `
varying vec3 vDir;
void main() {
vDir = normalize(position);
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
uniform vec3 top;
uniform vec3 bottom;
varying vec3 vDir;
void main() {
float h = clamp(vDir.y * 0.5 + 0.5, 0.0, 1.0);
gl_FragColor = vec4(mix(bottom, top, pow(h, 0.72)), 1.0);
}
`
})
);
scene.add(sky);
addBox(scene, [31, 0.45, 24], [0, -0.28, -1.5], M.ground);
const plaza = addMesh(
scene,
new THREE.PlaneGeometry(29.5, 22.5),
standard(0xffffff, { map: makePavingTexture() }),
0, 0.005, -1.5,
false
);
plaza.rotation.x = -Math.PI / 2;
const lane = addMesh(
scene,
new THREE.PlaneGeometry(25.5, 5.1),
standard(0xffffff, { map: makeCobbleTexture() }),
0, 0.035, 0.25,
false
);
lane.rotation.x = -Math.PI / 2;
addBox(scene, [26, 0.16, 0.18], [0, 0.07, 2.86], M.curb);
addBox(scene, [26, 0.16, 0.18], [0, 0.07, -2.36], M.curb);
// Distant city fragments create a compact but layered skyline.
for (let i = 0; i < 12; i++) {
const x = -18 + i * 3.25;
const h = 3.2 + (i % 4) * 0.8;
const color = i % 2 ? 0xd7c5a8 : 0xcbb89c;
addBox(scene, [2.7, h, 3.0], [x, h / 2, -20.2 - (i % 2)], standard(color));
}
/* ------------------------------------------------------------------
Neoclassical shopping-lane facades
------------------------------------------------------------------ */
function makeBuilding(x, z, width, height, depth, color, shopName, awningColor) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
const facade = standard(color);
const trim = standard(0xf5e7cb);
const shutters = standard(x % 2 ? 0x668c83 : 0x537783);
addBox(group, [width, height, depth], [0, height / 2, 0], facade);
addBox(group, [width + 0.18, 0.25, depth + 0.16], [0, height + 0.05, 0], trim);
addBox(group, [width - 0.12, 0.28, depth + 0.1], [0, 0.15, 0], trim);
// Upper-floor windows and shutters.
const rowYs = height > 8.4 ? [4.25, 6.45] : [4.1];
rowYs.forEach((wy, row) => {
const columns = width > 3.8 ? 3 : 2;
for (let i = 0; i < columns; i++) {
const wx = columns === 3
? (i - 1) * (width * 0.27)
: (i - 0.5) * (width * 0.36);
addBox(group, [0.72, 1.04, 0.12], [wx, wy, depth / 2 + 0.06], M.shadow);
addBox(group, [0.58, 0.87, 0.13], [wx, wy, depth / 2 + 0.13], M.glass);
addBox(group, [0.86, 0.09, 0.18], [wx, wy - 0.58, depth / 2 + 0.16], trim);
addBox(group, [0.08, 0.94, 0.12], [wx, wy, depth / 2 + 0.16], trim);
addBox(group, [0.22, 1.02, 0.09], [wx - 0.47, wy, depth / 2 + 0.15], shutters);
addBox(group, [0.22, 1.02, 0.09], [wx + 0.47, wy, depth / 2 + 0.15], shutters);
}
if (row === 0) {
addBox(group, [width * 0.72, 0.11, 0.72], [0, wy - 0.69, depth / 2 + 0.3], trim);
for (let j = 0; j < 8; j++) {
addBox(
group,
[0.055, 0.65, 0.055],
[-width * 0.31 + j * (width * 0.62 / 7), wy - 0.32, depth / 2 + 0.62],
M.darkWood
);
}
addBox(group, [width * 0.72, 0.06, 0.06], [0, wy, depth / 2 + 0.62], M.darkWood);
}
});
// Shopfront, door and classical side columns.
addBox(group, [width * 0.78, 1.95, 0.12], [0, 1.22, depth / 2 + 0.07], M.glass);
addBox(group, [0.08, 2.03, 0.18], [0, 1.22, depth / 2 + 0.15], trim);
addBox(group, [width * 0.78, 0.12, 0.17], [0, 2.22, depth / 2 + 0.15], trim);
addCylinder(group, 0.13, 0.15, 2.45, 8,
[-width * 0.44, 1.25, depth / 2 + 0.35], trim);
addCylinder(group, 0.13, 0.15, 2.45, 8,
[width * 0.44, 1.25, depth / 2 + 0.35], trim);
// Striped canvas awning.
const stripeCount = 8;
const stripeWidth = width / stripeCount;
for (let i = 0; i < stripeCount; i++) {
const material = standard(i % 2 ? awningColor : 0xf7e8cb);
const stripe = addBox(
group,
[stripeWidth + 0.015, 0.08, 0.92],
[-width / 2 + stripeWidth * (i + 0.5), 2.57, depth / 2 + 0.43],
material
);
stripe.rotation.x = 0.12;
addBox(
group,
[stripeWidth + 0.01, 0.24, 0.08],
[-width / 2 + stripeWidth * (i + 0.5), 2.38, depth / 2 + 0.86],
material
);
}
addSign(
group,
shopName,
width * 0.72,
0.56,
[0, 3.15, depth / 2 + 0.12],
{ bg: "#17343c", fg: "#fff4dc", fontSize: 48 }
);
// Roof details.
addBox(group, [0.55, 0.7, 0.65], [-width * 0.23, height + 0.48, 0.05], M.rust);
addBox(group, [0.75, 0.16, 0.7], [width * 0.2, height + 0.18, -0.1], M.trim);
return group;
}
makeBuilding(-9.0, -4.8, 3.55, 8.0, 4.5, 0xd9b99a, "KOΣΜΟΣ", 0xbc6753);
makeBuilding(-5.3, -4.8, 3.55, 9.1, 4.5, 0xc9d0b4, "BOOKS", 0x397d79);
makeBuilding(-1.6, -4.8, 3.45, 7.8, 4.5, 0xe3c7a0, "KERA", 0xc85345);
makeBuilding(2.2, -4.8, 3.55, 8.6, 4.5, 0xb9c4b4, "CAFE 24", 0x547e9a);
makeBuilding(6.5, -4.8, 4.0, 9.3, 4.5, 0xd8b9aa, "ATELIER 24", 0x2b8a83);
/* ------------------------------------------------------------------
Metro arrival stair and shelter
------------------------------------------------------------------ */
const metro = new THREE.Group();
metro.position.set(-7.8, 0, 5.25);
scene.add(metro);
addBox(metro, [3.0, 0.09, 2.15], [0, 0.07, -0.05], M.shadow);
for (let i = 0; i < 5; i++) {
addBox(
metro,
[2.55, 0.11 + i * 0.055, 0.34],
[0, 0.1 + (i * 0.055) / 2, -0.73 + i * 0.32],
M.curb
);
}
addBox(metro, [0.12, 1.15, 0.12], [-1.22, 0.72, 0.86], M.teal);
addBox(metro, [0.12, 1.15, 0.12], [1.22, 0.72, 0.86], M.teal);
addBox(metro, [2.65, 0.13, 0.72], [0, 2.62, 0.73], M.teal);
addSign(metro, "M METRO / ARRIVAL", 2.42, 0.47, [0, 2.6, 1.12], {
bg: "#087f7a", fg: "#fff7e9", fontSize: 45
});
for (const side of [-1, 1]) {
addBox(metro, [0.08, 0.72, 1.8], [side * 1.35, 0.72, 0.02], M.glass);
addBox(metro, [0.07, 0.07, 1.85], [side * 1.35, 1.08, 0.02], M.teal);
}
addBox(metro, [0.78, 0.12, 0.55], [-1.95, 1.1, 0.0], M.rust);
addBox(metro, [0.08, 1.1, 0.08], [-1.95, 0.55, 0.0], M.darkWood);
/* ------------------------------------------------------------------
Original produce vendor and cart
------------------------------------------------------------------ */
const cart = new THREE.Group();
cart.position.set(-1.6, 0, 1.92);
cart.rotation.y = -0.07;
scene.add(cart);
addBox(cart, [2.05, 0.18, 0.95], [0, 0.87, 0], M.wood);
addBox(cart, [1.95, 0.48, 0.88], [0, 0.6, 0], M.darkWood);
addBox(cart, [2.15, 0.09, 1.04], [0, 1.14, 0], M.cream);
for (const x of [-0.9, 0.9]) {
for (const z of [-0.38, 0.38]) {
addBox(cart, [0.075, 1.22, 0.075], [x, 1.68, z], M.teal);
}
const wheel = addCylinder(cart, 0.31, 0.31, 0.12, 12, [x, 0.43, 0.43], M.shadow);
wheel.rotation.x = Math.PI / 2;
const hub = addCylinder(cart, 0.08, 0.08, 0.14, 10, [x, 0.43, 0.44], M.cream);
hub.rotation.x = Math.PI / 2;
}
// Six narrow canopy panels form an original striped cover.
for (let i = 0; i < 6; i++) {
const mat = standard(i % 2 ? 0xf4e5c6 : 0xd86549);
addBox(
cart,
[0.37, 0.08, 1.2],
[-0.925 + i * 0.37, 2.32, 0],
mat
);
addBox(
cart,
[0.37, 0.18, 0.07],
[-0.925 + i * 0.37, 2.18, 0.61],
mat
);
}
addSign(cart, "ZISI’S LEMONS", 1.92, 0.42, [0, 2.02, 0.62], {
bg: "#fff0d1", fg: "#25463f", fontSize: 47
});
// Crates and angular produce.
for (const x of [-0.55, 0.52]) {
addBox(cart, [0.78, 0.24, 0.63], [x, 1.28, 0], M.wood);
for (let i = 0; i < 7; i++) {
const fruit = addMesh(
cart,
new THREE.IcosahedronGeometry(0.12, 0),
i % 3 === 0 ? M.lemon : M.orange,
x - 0.25 + (i % 4) * 0.16,
1.47 + (i > 3 ? 0.13 : 0),
-0.13 + Math.floor(i / 4) * 0.25
);
fruit.rotation.set(i * 0.7, i, i * 0.3);
}
}
/* ------------------------------------------------------------------
Low-poly pedestrians
------------------------------------------------------------------ */
const people = [];
function createPerson({
x = 0,
z = 0,
rotation = 0,
shirt = M.navy,
pants = M.shadow,
skin = M.skin,
hair = M.hair,
walking = false,
phase = 0,
speed = 5,
range = 0,
scale = 1
} = {}) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
const torso = addCylinder(group, 0.23, 0.29, 0.57, 6, [0, 1.12, 0], shirt);
addBox(group, [0.4, 0.19, 0.27], [0, 0.79, 0], pants);
const head = addMesh(group, new THREE.IcosahedronGeometry(0.21, 1), skin, 0, 1.57, 0);
head.scale.set(0.94, 1.08, 0.92);
const hairMesh = addMesh(
group,
new THREE.IcosahedronGeometry(0.215, 1),
hair,
0, 1.69, -0.015
);
hairMesh.scale.set(1, 0.63, 0.96);
const legL = new THREE.Group();
const legR = new THREE.Group();
legL.position.set(-0.12, 0.8, 0);
legR.position.set(0.12, 0.8, 0);
group.add(legL, legR);
addCylinder(legL, 0.085, 0.095, 0.58, 6, [0, -0.29, 0], pants);
addCylinder(legR, 0.085, 0.095, 0.58, 6, [0, -0.29, 0], pants);
addBox(legL, [0.18, 0.11, 0.3], [0, -0.6, 0.06], M.shadow);
addBox(legR, [0.18, 0.11, 0.3], [0, -0.6, 0.06], M.shadow);
const armL = new THREE.Group();
const armR = new THREE.Group();
armL.position.set(-0.28, 1.34, 0);
armR.position.set(0.28, 1.34, 0);
group.add(armL, armR);
addCylinder(armL, 0.065, 0.075, 0.49, 6, [0, -0.245, 0], shirt);
addCylinder(armR, 0.065, 0.075, 0.49, 6, [0, -0.245, 0], shirt);
addMesh(armL, new THREE.IcosahedronGeometry(0.08, 0), skin, 0, -0.51, 0);
addMesh(armR, new THREE.IcosahedronGeometry(0.08, 0), skin, 0, -0.51, 0);
people.push({
group, legL, legR, armL, armR,
walking, phase, speed, range,
baseX: x
});
return group;
}
// Vendor beside the cart, with apron and cap.
const vendor = createPerson({
x: -2.78, z: 1.9, rotation: 0.12,
shirt: M.teal, pants: M.darkWood,
skin: M.skinLight, hair: M.hair,
walking: false, phase: 1.2
});
addBox(vendor, [0.36, 0.48, 0.07], [0, 1.04, 0.25], standard(0xf1d99f));
addBox(vendor, [0.36, 0.12, 0.34], [0, 1.72, 0], M.cream);
createPerson({
x: -6.6, z: 2.0, rotation: 0.1,
shirt: M.rust, pants: M.navy, skin: M.skin,
walking: true, phase: 0.2, speed: 5.8, range: 0.55
});
createPerson({
x: -4.0, z: 0.25, rotation: Math.PI / 2,
shirt: standard(0xcf9c55), pants: M.shadow, skin: M.skinLight,
walking: true, phase: 1.7, speed: 4.8, range: 0.8
});
createPerson({
x: 0.8, z: -0.35, rotation: Math.PI / 2,
shirt: standard(0x6c7fa5), pants: M.teal, skin: M.skin,
walking: true, phase: 3.1, speed: 5.4, range: 1.05
});
createPerson({
x: 3.7, z: 2.25, rotation: -0.8,
shirt: M.white, pants: M.rust, skin: M.skinLight,
walking: true, phase: 4.0, speed: 4.4, range: 0.4
});
createPerson({
x: 8.2, z: 0.65, rotation: -Math.PI / 2,
shirt: M.teal, pants: M.shadow, skin: M.skin,
walking: true, phase: 5.2, speed: 5.0, range: 0.85
});
createPerson({
x: 8.8, z: -1.2, rotation: 2.8,
shirt: standard(0xa95650), pants: M.navy, skin: M.skinLight,
walking: false, phase: 2.5
});
/* ------------------------------------------------------------------
Stylized Acropolis and Parthenon reference backdrop
------------------------------------------------------------------ */
const hillMaterial = standard(0x8e8867);
const hill = addMesh(
scene,
new THREE.DodecahedronGeometry(1, 0),
hillMaterial,
-0.6, 1.25, -15.0
);
hill.scale.set(10.4, 4.1, 4.2);
hill.rotation.y = 0.15;
const temple = new THREE.Group();
temple.position.set(-0.7, 5.45, -14.9);
scene.add(temple);
const templeStone = standard(0xe4d2ad);
const templeShade = standard(0xcab68e);
addBox(temple, [6.25, 0.24, 2.35], [0, 0.02, 0], templeShade);
addBox(temple, [5.75, 0.18, 2.05], [0, 0.23, 0], templeStone);
for (let row = 0; row < 2; row++) {
const z = row === 0 ? 0.68 : -0.58;
for (let i = 0; i < 8; i++) {
const x = -2.28 + i * 0.65;
addCylinder(temple, 0.14, 0.17, 1.55, 8, [x, 1.08, z], templeStone);
addBox(temple, [0.4, 0.1, 0.4], [x, 0.4, z], templeShade);
}
}
addBox(temple, [5.7, 0.28, 1.85], [0, 1.97, 0], templeStone);
addBox(temple, [5.95, 0.13, 2.02], [0, 2.16, 0], templeShade);
const pedimentShape = new THREE.Shape();
pedimentShape.moveTo(-2.85, 0);
pedimentShape.lineTo(0, 1.28);
pedimentShape.lineTo(2.85, 0);
pedimentShape.closePath();
const pedimentGeometry = new THREE.ExtrudeGeometry(pedimentShape, {
depth: 1.75,
bevelEnabled: false
});
pedimentGeometry.translate(0, 0, -0.875);
addMesh(temple, pedimentGeometry, templeStone, 0, 2.19, 0);
// Sparse cypresses reinforce the Greek skyline without dominating it.
for (const x of [-11.2, -8.6, 7.0, 10.1]) {
const tree = new THREE.Group();
tree.position.set(x, 0, -11.5);
scene.add(tree);
addCylinder(tree, 0.08, 0.12, 1.1, 6, [0, 0.55, 0], M.darkWood);
addMesh(tree, new THREE.ConeGeometry(0.62, 3.5, 7), M.darkLeaf, 0, 2.25, 0);
addMesh(tree, new THREE.ConeGeometry(0.48, 2.4, 7), M.leaf, 0, 3.25, 0);
}
/* ------------------------------------------------------------------
Street furniture, café details and trees
------------------------------------------------------------------ */
function makeLamp(x, z) {
const lamp = new THREE.Group();
lamp.position.set(x, 0, z);
scene.add(lamp);
addCylinder(lamp, 0.07, 0.11, 3.25, 8, [0, 1.63, 0], M.darkWood);
addBox(lamp, [0.48, 0.11, 0.48], [0, 3.26, 0], M.darkWood);
const bulb = addBox(
lamp,
[0.34, 0.4, 0.34],
[0, 3.03, 0],
standard(0xffd98f, { emissive: 0xffb74d, emissiveIntensity: 0.55 })
);
bulb.castShadow = false;
}
makeLamp(-10.3, 3.2);
makeLamp(10.1, 3.0);
makeLamp(9.8, -1.8);
function makeOliveTree(x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0, z);
tree.scale.setScalar(scale);
scene.add(tree);
addCylinder(tree, 0.13, 0.2, 2.0, 7, [0, 1.0, 0], M.wood);
const clusters = [
[-0.55, 2.35, 0, 0.85],
[0.48, 2.55, 0.08, 0.92],
[0, 2.95, -0.1, 1.0],
[-0.1, 2.45, 0.48, 0.73]
];
clusters.forEach(([cx, cy, cz, s], i) => {
const crown = addMesh(
tree,
new THREE.IcosahedronGeometry(0.86, 0),
i % 2 ? M.leaf : M.darkLeaf,
cx, cy, cz
);
crown.scale.set(s, s * 0.78, s);
crown.rotation.set(i * 0.3, i * 0.7, i * 0.2);
});
addBox(tree, [1.3, 0.16, 1.3], [0, 0.08, 0], M.curb);
}
makeOliveTree(-12.0, 1.8, 1.05);
makeOliveTree(11.0, 1.8, 0.9);
// Small café tables.
for (const x of [8.4, 10.0]) {
addCylinder(scene, 0.08, 0.12, 1.2, 8, [x, 0.6, 4.35], M.darkWood);
addCylinder(scene, 0.52, 0.52, 0.08, 16, [x, 1.23, 4.35], M.cream);
addCylinder(scene, 0.36, 0.36, 0.06, 12, [x, 0.08, 4.35], M.darkWood);
}
addBox(scene, [2.1, 0.14, 0.52], [10.2, 0.55, 4.35], M.wood);
for (const x of [9.45, 10.95]) {
addBox(scene, [0.09, 0.52, 0.42], [x, 0.27, 4.35], M.darkWood);
}
/* ------------------------------------------------------------------
Clearly marked pedestrian route
------------------------------------------------------------------ */
const routeGroup = new THREE.Group();
scene.add(routeGroup);
const routePoints = [
new THREE.Vector3(-7.8, 0.18, 6.25),
new THREE.Vector3(-7.2, 0.18, 4.75),
new THREE.Vector3(-5.8, 0.18, 3.65),
new THREE.Vector3(-3.6, 0.18, 2.85),
new THREE.Vector3(-1.8, 0.18, 2.80),
new THREE.Vector3(-0.1, 0.18, 2.40),
new THREE.Vector3(2.0, 0.18, 1.85),
new THREE.Vector3(4.6, 0.18, 1.40),
new THREE.Vector3(6.5, 0.18, 1.15),
new THREE.Vector3(6.5, 0.18, 0.10),
new THREE.Vector3(6.5, 0.18, -1.55)
];
const routeCurve = new THREE.CatmullRomCurve3(routePoints, false, "centripetal", 0.35);
const routeUnderlay = addMesh(
routeGroup,
new THREE.TubeGeometry(routeCurve, 150, 0.11, 8, false),
M.routeDark,
0, -0.015, 0,
false
);
const routeLine = addMesh(
routeGroup,
new THREE.TubeGeometry(routeCurve, 150, 0.052, 8, false),
M.route,
0, 0.015, 0,
false
);
const arrowGeometry = new THREE.ConeGeometry(0.18, 0.46, 3);
const up = new THREE.Vector3(0, 1, 0);
for (let i = 0; i < 13; i++) {
const t = 0.055 + i * 0.068;
const point = routeCurve.getPoint(t);
const tangent = routeCurve.getTangent(t).normalize();
const arrow = addMesh(
routeGroup,
arrowGeometry,
M.route,
point.x, point.y + 0.07, point.z,
false
);
arrow.quaternion.setFromUnitVectors(up, tangent);
}
const markerMeshes = [];
function addRouteMarker(position, step) {
const marker = addMesh(
routeGroup,
new THREE.RingGeometry(0.33, 0.49, 32),
new THREE.MeshBasicMaterial({
color: 0x00c5b3,
side: THREE.DoubleSide,
transparent: true,
opacity: 0.95
}),
position.x, 0.13, position.z,
false
);
marker.rotation.x = -Math.PI / 2;
marker.userData.step = step;
marker.userData.baseScale = 1;
markerMeshes.push(marker);
return marker;
}
addRouteMarker(new THREE.Vector3(-7.8, 0.13, 6.25), 0);
addRouteMarker(new THREE.Vector3(-1.8, 0.13, 2.80), 1);
addRouteMarker(new THREE.Vector3(6.5, 0.13, -1.55), 2);
const movingDots = [];
const dotGeometry = new THREE.SphereGeometry(0.105, 10, 7);
const dotMaterial = new THREE.MeshBasicMaterial({ color: 0xffdd58 });
for (let i = 0; i < 3; i++) {
const dot = addMesh(routeGroup, dotGeometry, dotMaterial, 0, 0, 0, false);
movingDots.push(dot);
}
/* ------------------------------------------------------------------
UI, route steps and projected world labels
------------------------------------------------------------------ */
const stepData = [
{
title: "Begin at the metro landing",
copy: "Start on the upper landing beside the M sign. The turquoise line bends toward the cobbled shopping lane."
},
{
title: "Pause at Zisi’s lemon stand",
copy: "The original vendor cart marks the midpoint. Turn left around the canopy to continue directly toward the lane."
},
{
title: "Arrive in the old-town lane",
copy: "Continue past the café fronts and finish at Atelier 24. The route remains level and visibly separated from building entrances."
}
];
const routeTitle = document.querySelector("#route-title");
const routeCopy = document.querySelector("#route-copy");
const stepButtons = [...document.querySelectorAll("#steps button")];
const pins = [...document.querySelectorAll(".world-pin")];
function setStep(step) {
const data = stepData[step];
routeTitle.textContent = data.title;
routeCopy.textContent = data.copy;
stepButtons.forEach((button, index) => {
button.classList.toggle("active", index === step);
});
pins.forEach((pin, index) => {
pin.classList.toggle("active", index === step);
});
}
stepButtons.forEach(button => {
button.addEventListener("click", () => setStep(Number(button.dataset.step)));
});
pins.forEach(pin => {
pin.addEventListener("click", event => {
event.stopPropagation();
setStep(Number(pin.dataset.step));
});
});
const pinAnchors = [
{ element: document.querySelector("#pin-0"), point: new THREE.Vector3(-7.8, 3.05, 5.95) },
{ element: document.querySelector("#pin-1"), point: new THREE.Vector3(-1.6, 2.75, 2.05) },
{ element: document.querySelector("#pin-2"), point: new THREE.Vector3(6.5, 3.55, -2.45) },
{
element: document.querySelector("#historic-label"),
point: new THREE.Vector3(-0.7, 9.35, -14.9)
}
];
let routeEnabled = true;
const routeToggle = document.querySelector("#route-toggle");
routeToggle.addEventListener("click", () => {
routeEnabled = !routeEnabled;
routeGroup.visible = routeEnabled;
routeToggle.textContent = routeEnabled ? "Hide route" : "Show route";
pins.forEach(pin => {
pin.style.display = routeEnabled ? "flex" : "none";
});
});
/* ------------------------------------------------------------------
Direct camera controls — no imported controls addon
------------------------------------------------------------------ */
const desired = {
theta: 0.66,
phi: 1.02,
radius: 28,
target: new THREE.Vector3(0, 2.0, -1.0)
};
const current = {
theta: desired.theta,
phi: desired.phi,
radius: desired.radius,
target: desired.target.clone()
};
function updateCamera() {
const horizontal = current.radius * Math.sin(current.phi);
camera.position.set(
current.target.x + horizontal * Math.sin(current.theta),
current.target.y + current.radius * Math.cos(current.phi),
current.target.z + horizontal * Math.cos(current.theta)
);
camera.lookAt(current.target);
}
function overview() {
desired.theta = 0.66;
desired.phi = 1.02;
desired.radius = 28;
desired.target.set(0, 2.0, -1.0);
}
function streetView() {
desired.theta = 0.22;
desired.phi = 1.18;
desired.radius = 20.5;
desired.target.set(0.5, 1.45, -0.2);
}
document.querySelector("#overview").addEventListener("click", overview);
document.querySelector("#street").addEventListener("click", streetView);
let dragging = false;
let pointerX = 0;
let pointerY = 0;
let travel = 0;
canvas.addEventListener("pointerdown", event => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
travel = 0;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
travel += Math.abs(dx) + Math.abs(dy);
desired.theta -= dx * 0.0055;
desired.phi = THREE.MathUtils.clamp(desired.phi + dy * 0.0045, 0.52, 1.36);
});
canvas.addEventListener("pointerup", event => {
dragging = false;
if (travel < 6 && routeEnabled) {
const rect = canvas.getBoundingClientRect();
const pointer = new THREE.Vector2(
((event.clientX - rect.left) / rect.width) * 2 - 1,
-((event.clientY - rect.top) / rect.height) * 2 + 1
);
const raycaster = new THREE.Raycaster();
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(markerMeshes, false);
if (hits.length) {
setStep(hits[0].object.userData.step);
}
}
});
canvas.addEventListener("pointercancel", () => {
dragging = false;
});
canvas.addEventListener("wheel", event => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius + event.deltaY * 0.018,
13,
42
);
}, { passive: false });
/* ------------------------------------------------------------------
Animation and label projection
------------------------------------------------------------------ */
const clock = new THREE.Clock();
const projected = new THREE.Vector3();
function positionLabel(element, worldPoint) {
projected.copy(worldPoint).project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.15 &&
Math.abs(projected.y) < 1.15;
element.style.visibility = visible ? "visible" : "hidden";
const x = (projected.x * 0.5 + 0.5) * innerWidth;
const y = (-projected.y * 0.5 + 0.5) * innerHeight;
element.style.transform = `translate3d(${x}px, ${y}px, 0) translate(-50%, -100%)`;
}
function animate() {
const t = clock.getElapsedTime();
// Smooth camera damping.
current.theta += (desired.theta - current.theta) * 0.075;
current.phi += (desired.phi - current.phi) * 0.075;
current.radius += (desired.radius - current.radius) * 0.075;
current.target.lerp(desired.target, 0.075);
updateCamera();
// Pedestrian walk cycles.
people.forEach(person => {
const phase = t * person.speed + person.phase;
if (person.walking) {
person.legL.rotation.x = Math.sin(phase) * 0.52;
person.legR.rotation.x = -Math.sin(phase) * 0.52;
person.armL.rotation.x = -Math.sin(phase) * 0.42;
person.armR.rotation.x = Math.sin(phase) * 0.42;
person.group.position.y = Math.abs(Math.sin(phase)) * 0.025;
person.group.position.x =
person.baseX + Math.sin(t * 0.25 + person.phase) * person.range;
} else {
person.legL.rotation.x = 0;
person.legR.rotation.x = 0;
person.armL.rotation.x = Math.sin(t * 1.1 + person.phase) * 0.035;
person.armR.rotation.x = -Math.sin(t * 1.1 + person.phase) * 0.035;
}
});
// The vendor lifts one arm toward the produce.
people.find(person => person.group === vendor).armR.rotation.z = -0.3 + Math.sin(t * 1.4) * 0.12;
// Moving route indicators.
movingDots.forEach((dot, index) => {
const progress = (t * 0.065 + index / movingDots.length) % 1;
const point = routeCurve.getPoint(progress);
dot.position.set(point.x, point.y + 0.17, point.z);
});
// Gentle marker pulse.
markerMeshes.forEach((marker, index) => {
const pulse = 1 + Math.sin(t * 2.4 + index) * 0.08;
marker.scale.setScalar(pulse);
marker.material.opacity = 0.78 + Math.sin(t * 2.4 + index) * 0.16;
});
camera.updateMatrixWorld();
pinAnchors.forEach(pin => positionLabel(pin.element, pin.point));
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.75));
renderer.setSize(innerWidth, innerHeight);
});
setStep(0);
updateCamera();
</script>
</body>
</html>
```