Prompt specification
Build or customize the Three.js 3D scene "Market stall beside a Sydney stone passage" 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 stall beside a Sydney stone passage
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/market-stall-beside-a-sydney-stone-passage-x3030
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing The Rocks and Sydney's harbor edge. Create a compact referenced Rocks vignette with an original stall, stone passage, and visitors. Keep delivery and pedestrian access visible within the constrained street space. Voxel style.
Working Three.js Starter (market-stall-beside-a-sydney-stone-passage-x3030):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#17343c">
<title>The Rocks — Harbour Edge Voxel Vignette</title>
<style>
:root {
--ink: #17343c;
--paper: #fff8e9;
--sand: #cfae7e;
--teal: #237f82;
--amber: #f0ad42;
--glass: rgba(255, 248, 233, 0.92);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #b9dde5;
color: var(--ink);
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;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 10;
background: var(--glass);
border: 1px solid rgba(23, 52, 60, 0.15);
box-shadow: 0 12px 36px rgba(23, 52, 60, 0.16);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
#title-card {
top: 20px;
left: 20px;
width: min(360px, calc(100vw - 40px));
padding: 18px 20px 17px;
border-radius: 5px 18px 5px 5px;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 7px;
color: var(--teal);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 24px;
height: 3px;
background: var(--amber);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(31px, 4vw, 48px);
font-weight: 500;
line-height: 0.95;
letter-spacing: -0.035em;
}
.subtitle {
margin: 10px 0 0;
max-width: 300px;
color: rgba(23, 52, 60, 0.75);
font-size: 12px;
line-height: 1.5;
}
#legend {
left: 20px;
bottom: 20px;
width: 250px;
padding: 13px 15px;
border-radius: 14px 5px 5px 5px;
}
.legend-title {
margin-bottom: 9px;
font-size: 10px;
font-weight: 850;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
gap: 10px;
margin: 7px 0;
font-size: 11px;
font-weight: 650;
}
.swatch {
width: 19px;
height: 7px;
flex: 0 0 auto;
border-radius: 1px;
box-shadow: inset 0 0 0 1px rgba(23, 52, 60, 0.12);
}
.swatch.delivery {
background: var(--amber);
}
.swatch.clearway {
background: #f7f0dc;
}
.swatch.heritage {
background: var(--sand);
}
#controls {
top: 20px;
right: 20px;
padding: 8px;
border-radius: 14px 5px 5px 5px;
}
.view-buttons {
display: flex;
gap: 5px;
}
button {
appearance: none;
border: 0;
border-radius: 8px;
padding: 9px 11px;
background: transparent;
color: var(--ink);
font: inherit;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.06em;
text-transform: uppercase;
cursor: pointer;
transition: background 150ms ease, transform 150ms ease;
}
button:hover {
background: rgba(35, 127, 130, 0.1);
transform: translateY(-1px);
}
button.active {
background: var(--ink);
color: var(--paper);
}
#pause-button {
width: 100%;
margin-top: 5px;
border-top: 1px solid rgba(23, 52, 60, 0.12);
border-radius: 0 0 8px 8px;
color: rgba(23, 52, 60, 0.7);
}
#hint {
position: fixed;
right: 20px;
bottom: 20px;
z-index: 8;
padding: 9px 12px;
border-radius: 5px 5px 12px 5px;
background: rgba(23, 52, 60, 0.78);
color: #fff8e9;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
pointer-events: none;
}
.hotspot {
position: fixed;
z-index: 6;
padding: 6px 9px;
border: 1px solid rgba(23, 52, 60, 0.16);
border-radius: 4px 9px 4px 4px;
background: rgba(255, 248, 233, 0.92);
box-shadow: 0 5px 16px rgba(23, 52, 60, 0.14);
color: var(--ink);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.1em;
text-transform: uppercase;
white-space: nowrap;
pointer-events: none;
transform: translate(-50%, -100%);
transition: opacity 120ms ease;
}
.hotspot::after {
content: "";
position: absolute;
left: 50%;
bottom: -7px;
width: 1px;
height: 7px;
background: rgba(23, 52, 60, 0.45);
}
@media (max-width: 700px) {
#title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 14px 16px;
}
.subtitle {
max-width: none;
font-size: 11px;
}
#legend {
left: 12px;
bottom: 12px;
width: 210px;
}
#controls {
top: auto;
right: 12px;
bottom: 12px;
}
#hint,
.hotspot {
display: none;
}
button {
padding: 9px;
font-size: 9px;
}
}
</style>
</head>
<body>
<div id="title-card" class="panel">
<div class="eyebrow">Sydney · Harbour edge</div>
<h1>The Rocks</h1>
<p class="subtitle">
A compact voxel study of sandstone passages, an original food stall,
and the shared choreography of deliveries and pedestrians.
</p>
</div>
<div id="controls" class="panel">
<div class="view-buttons" aria-label="Camera views">
<button data-view="overview" class="active">Overview</button>
<button data-view="street">Street</button>
<button data-view="quay">Quay</button>
</div>
<button id="pause-button">Pause motion</button>
</div>
<div id="legend" class="panel">
<div class="legend-title">Reading the street</div>
<div class="legend-row">
<span class="swatch delivery"></span>
10-minute delivery apron
</div>
<div class="legend-row">
<span class="swatch clearway"></span>
Continuous pedestrian clearway
</div>
<div class="legend-row">
<span class="swatch heritage"></span>
Heritage sandstone edge
</div>
</div>
<div id="hint">Drag to orbit · Scroll to zoom · 1 / 2 / 3 for views</div>
<div id="stall-tag" class="hotspot">Original stall · Gullwing Bites</div>
<div id="passage-tag" class="hotspot">Stone passage</div>
<div id="delivery-tag" class="hotspot">Shared access / delivery handover</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 scene
// ------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xb9dde5);
scene.fog = new THREE.Fog(0xb9dde5, 34, 82);
const camera = new THREE.PerspectiveCamera(
43,
innerWidth / innerHeight,
0.1,
180
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
document.body.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xe5f6ff, 0x8a7254, 2.0);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff0cf, 3.2);
sun.position.set(-12, 24, 15);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -30;
sun.shadow.camera.right = 30;
sun.shadow.camera.top = 26;
sun.shadow.camera.bottom = -26;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 65;
sun.shadow.bias = -0.0004;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x7ec8d7, 0.65);
fill.position.set(15, 9, -14);
scene.add(fill);
// ------------------------------------------------------------
// Shared helpers and materials
// ------------------------------------------------------------
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.82,
metalness: 0,
flatShading: true,
...options
});
const M = {
sandstone: material(0xc9a777),
sandstoneLight: material(0xdfc496),
sandstoneDark: material(0xa98158),
sandstonePink: material(0xb88d68),
mortar: material(0x92775d),
roof: material(0x394a4b),
roofRed: material(0x874f43),
glass: material(0x294b57, { roughness: 0.28, metalness: 0.18 }),
glassLight: material(0x6fa3aa, { roughness: 0.35 }),
timber: material(0x79513a),
timberLight: material(0xa9784e),
timberDark: material(0x4d3931),
teal: material(0x237f82),
tealDark: material(0x155a61),
cream: material(0xfff1cf),
amber: material(0xf0ad42),
red: material(0xc85d4a),
blue: material(0x3d7fa3),
black: material(0x1d292c),
pavement: material(0xa8a094),
pavementDark: material(0x6f706b),
pavementLight: material(0xc4bbaa),
asphalt: material(0x676b68),
white: material(0xf4f1df),
skin1: material(0xd89a70),
skin2: material(0x9d6044),
skin3: material(0xefbd91),
hair: material(0x332e2b),
leaf: material(0x547e5b),
leafLight: material(0x78966a),
soil: material(0x5c4837),
rubber: material(0x263033),
gold: material(0xd5a53e),
water: material(0x2d9db2, {
roughness: 0.34,
metalness: 0.08
})
};
function box(w, h, d, mat, x, y, z, parent = scene, cast = true) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(w, h, d), mat);
mesh.position.set(x, y, z);
mesh.castShadow = cast;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(radiusTop, radiusBottom, height, mat, x, y, z, parent = scene, sides = 8) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radiusTop, radiusBottom, height, sides),
mat
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function lineBetween(points, color, parent = scene) {
const geometry = new THREE.BufferGeometry().setFromPoints(
points.map((point) => new THREE.Vector3(...point))
);
const line = new THREE.Line(
geometry,
new THREE.LineBasicMaterial({ color })
);
parent.add(line);
return line;
}
function textTexture(text, background = "#17343c", foreground = "#fff8e9") {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 256;
const ctx = canvas.getContext("2d");
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = foreground;
ctx.globalAlpha = 0.18;
ctx.lineWidth = 5;
ctx.strokeRect(13, 13, canvas.width - 26, canvas.height - 26);
ctx.globalAlpha = 1;
ctx.fillStyle = foreground;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = `900 ${text.length > 20 ? 56 : 78}px Arial, sans-serif`;
ctx.fillText(text, canvas.width / 2, canvas.height / 2 + 3, 940);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
function textPlane(
text,
width,
height,
x,
y,
z,
background = "#17343c",
foreground = "#fff8e9",
parent = scene
) {
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({
map: textTexture(text, background, foreground),
transparent: true,
depthWrite: false,
side: THREE.DoubleSide
})
);
mesh.position.set(x, y, z);
parent.add(mesh);
return mesh;
}
function groundText(text, width, depth, x, z, bg = "#17343c", fg = "#fff8e9") {
const mesh = textPlane(text, width, depth, x, 0.155, z, bg, fg);
mesh.rotation.x = -Math.PI / 2;
return mesh;
}
let seed = 431;
function random() {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
}
// ------------------------------------------------------------
// Water and land plinth
// ------------------------------------------------------------
const waterGeometry = new THREE.PlaneGeometry(140, 140, 45, 45);
waterGeometry.rotateX(-Math.PI / 2);
const water = new THREE.Mesh(waterGeometry, M.water);
water.position.y = -0.31;
water.receiveShadow = true;
scene.add(water);
// Dark submerged edge, sandstone paving and street surfaces.
box(20.8, 1.2, 11.2, M.sandstoneDark, 0, -0.58, -1.5, scene, false);
box(20.65, 0.16, 10.95, M.pavement, 0, 0.04, -1.5, scene, false);
// Service apron and pedestrian clearway.
box(20.2, 0.08, 1.75, M.asphalt, 0, 0.125, -0.83, scene, false);
box(20.2, 0.07, 3.02, M.pavementLight, 0, 0.125, 1.68, scene, false);
// Clear lane separator.
for (let x = -9.6; x < 9.8; x += 0.72) {
box(0.43, 0.025, 0.09, M.white, x, 0.177, 0.19, scene, false);
}
// Amber delivery edge.
for (let x = -9.7; x < 9.7; x += 0.82) {
box(0.48, 0.026, 0.08, M.amber, x, 0.181, -1.48, scene, false);
}
// Quay wall and individual stone blocks.
box(20.5, 0.45, 0.56, M.sandstoneDark, 0, -0.13, 3.77, scene, false);
for (let x = -9.8; x < 10; x += 0.98) {
box(0.92, 0.42, 0.38, M.sandstone, x, -0.15, 3.98, scene, false);
box(0.92, 0.32, 0.38, M.sandstoneDark, x + 0.49, -0.57, 3.98, scene, false);
}
// Tactile edge markers.
for (let x = -9.3; x < 9.6; x += 0.38) {
box(0.16, 0.025, 0.13, M.amber, x, 0.178, 3.32, scene, false);
}
groundText("10 MIN DELIVERY", 2.8, 0.48, -7.15, -0.82, "#d28d2e", "#17343c");
groundText("WALK • KEEP CLEAR", 3.25, 0.53, 1.2, 1.66, "#17343c", "#fff8e9");
// Simple pavement block variation.
for (let i = 0; i < 45; i++) {
const x = -9.5 + random() * 19;
const z = 0.5 + random() * 2.8;
box(
0.34 + random() * 0.26,
0.012,
0.22 + random() * 0.18,
random() > 0.5 ? M.pavement : M.pavementLight,
x,
0.171,
z,
scene,
false
);
}
// ------------------------------------------------------------
// Heritage buildings
// ------------------------------------------------------------
function addWindow(parent, x, y, z, width = 0.82, height = 1.15, shutters = false) {
box(width + 0.18, height + 0.18, 0.13, M.sandstoneLight, x, y, z + 0.025, parent);
box(width, height, 0.08, M.glass, x, y, z + 0.11, parent, false);
box(0.055, height, 0.09, M.sandstoneLight, x, y, z + 0.16, parent, false);
box(width, 0.055, 0.09, M.sandstoneLight, x, y, z + 0.16, parent, false);
if (shutters) {
box(0.22, height + 0.1, 0.10, M.tealDark, x - width / 2 - 0.18, y, z + 0.12, parent);
box(0.22, height + 0.1, 0.10, M.tealDark, x + width / 2 + 0.18, y, z + 0.12, parent);
}
}
function masonryCourse(xStart, xEnd, y, z, parent) {
let x = xStart;
while (x < xEnd) {
const width = Math.min(0.72 + random() * 0.48, xEnd - x);
const mat = random() > 0.5 ? M.sandstoneLight : M.sandstonePink;
box(width - 0.025, 0.055, 0.055, mat, x + width / 2, y, z, parent, false);
x += width;
}
}
// Left sandstone terrace.
box(6.7, 6.0, 4.55, M.sandstone, -6.15, 3.12, -4.075, scene);
box(6.92, 0.22, 4.78, M.sandstoneLight, -6.15, 6.18, -4.075, scene);
box(7.02, 0.16, 4.88, M.roof, -6.15, 6.38, -4.075, scene);
box(0.58, 1.15, 0.62, M.sandstoneDark, -8.65, 6.97, -4.85, scene);
for (const y of [0.55, 1.68, 2.81, 3.94, 5.07]) {
masonryCourse(-9.48, -2.82, y, -1.785, scene);
}
for (const x of [-8.45, -6.25, -4.05]) {
addWindow(scene, x, 2.05, -1.78, 0.86, 1.32, x === -6.25);
addWindow(scene, x, 4.38, -1.78, 0.78, 1.18, false);
}
box(1.03, 2.05, 0.16, M.timberDark, -8.35, 1.13, -1.72, scene);
box(0.07, 0.07, 0.08, M.gold, -8.05, 1.1, -1.59, scene);
textPlane("ROCKHOUSE", 1.0, 0.22, -8.35, 2.36, -1.62, "#31585a", "#fff1cf");
// Building behind the terrace for a compact layered skyline.
box(3.2, 7.25, 3.6, M.sandstonePink, -8.35, 3.73, -6.7, scene);
box(3.42, 0.18, 3.85, M.roofRed, -8.35, 7.42, -6.7, scene);
for (const x of [-9.25, -7.55]) {
addWindow(scene, x, 4.9, -4.87, 0.72, 1.1, false);
}
// Right heritage block, split around a true walk-through passage.
box(1.8, 6.7, 4.65, M.sandstone, -0.1, 3.47, -4.125, scene);
box(3.5, 6.7, 4.65, M.sandstone, 4.55, 3.47, -4.125, scene);
box(2.05, 3.15, 4.65, M.sandstoneLight, 1.85, 5.35, -4.125, scene);
box(5.42, 0.22, 4.88, M.sandstoneLight, 3.75, 6.88, -4.125, scene);
box(5.58, 0.15, 5.02, M.roof, 3.75, 7.08, -4.125, scene);
for (const y of [0.55, 1.68, 2.81, 3.94, 5.07, 6.2]) {
masonryCourse(-0.98, 6.28, y, -1.785, scene);
}
// Passage interior: side walls, ceiling and a dark far end.
box(0.16, 3.1, 4.45, M.sandstoneDark, 0.83, 1.65, -4.0, scene);
box(0.16, 3.1, 4.45, M.sandstoneDark, 2.88, 1.65, -4.0, scene);
box(2.1, 0.18, 4.45, M.timberDark, 1.85, 3.25, -4.0, scene);
box(1.86, 0.10, 4.45, M.pavementDark, 1.85, 0.18, -4.0, scene, false);
box(1.83, 2.8, 0.12, M.black, 1.85, 1.55, -6.18, scene, false);
// Stepped voussoir arch at the street opening.
box(0.30, 2.35, 0.55, M.sandstoneLight, 0.78, 1.28, -1.76, scene);
box(0.30, 2.35, 0.55, M.sandstoneLight, 2.92, 1.28, -1.76, scene);
const archMaterials = [M.sandstoneLight, M.sandstonePink, M.sandstone];
for (let i = 0; i <= 12; i++) {
const angle = (i / 12) * Math.PI;
const radius = 1.08;
const stone = box(
0.42,
0.42,
0.58,
archMaterials[i % archMaterials.length],
1.85 + Math.cos(angle) * radius,
2.38 + Math.sin(angle) * radius,
-1.73,
scene
);
stone.rotation.z = angle + Math.PI / 2;
}
// Warm passage lamps.
box(0.18, 0.24, 0.15, M.gold, 0.95, 2.25, -1.61, scene, false);
box(0.18, 0.24, 0.15, M.gold, 2.75, 2.25, -1.61, scene, false);
for (const x of [3.7, 5.45]) {
addWindow(scene, x, 2.1, -1.78, 0.82, 1.24, x === 3.7);
addWindow(scene, x, 4.4, -1.78, 0.78, 1.16, false);
}
addWindow(scene, 1.8, 4.62, -1.78, 0.68, 1.12, false);
// Narrow far-right building.
box(3.15, 5.65, 4.5, M.sandstonePink, 7.98, 2.94, -4.05, scene);
box(3.36, 0.2, 4.7, M.sandstoneLight, 7.98, 5.8, -4.05, scene);
box(3.48, 0.15, 4.84, M.roofRed, 7.98, 5.98, -4.05, scene);
addWindow(scene, 7.2, 2.25, -1.77, 0.78, 1.18, false);
addWindow(scene, 8.85, 2.25, -1.77, 0.78, 1.18, true);
addWindow(scene, 8.02, 4.25, -1.77, 0.8, 1.12, false);
// ------------------------------------------------------------
// Original stall: Gullwing Bites
// ------------------------------------------------------------
const stall = new THREE.Group();
stall.position.set(-3.75, 0.13, -0.55);
scene.add(stall);
// Counter and rear service shelf.
box(2.65, 0.72, 1.35, M.timber, 0, 0.45, 0, stall);
box(2.9, 0.13, 1.55, M.timberLight, 0, 0.88, 0, stall);
box(2.5, 0.42, 0.18, M.timberDark, 0, 1.15, -0.61, stall);
// Four uprights.
for (const x of [-1.3, 1.3]) {
for (const z of [-0.63, 0.67]) {
box(0.12, 2.25, 0.12, M.timberDark, x, 1.18, z, stall);
}
}
// Striped awning.
for (let i = 0; i < 6; i++) {
const awningMat = i % 2 === 0 ? M.teal : M.cream;
box(0.49, 0.13, 2.0, awningMat, -1.225 + i * 0.49, 2.39, 0.05, stall);
}
box(2.98, 0.17, 0.16, M.tealDark, 0, 2.28, 1.0, stall);
// Sign.
textPlane(
"GULLWING BITES",
2.58,
0.46,
0,
2.02,
0.78,
"#185e63",
"#fff1cf",
stall
);
textPlane(
"SALTED SNACKS • HARBOUR COFFEE",
2.34,
0.20,
0,
1.70,
0.79,
"#fff1cf",
"#185e63",
stall
);
// Small menu board.
box(0.72, 1.05, 0.09, M.tealDark, -1.12, 1.46, 0.82, stall);
textPlane(
"TODAY\nSEA SALT • CITRUS",
0.62,
0.78,
-1.12,
1.49,
0.875,
"#f2e4c5",
"#17343c",
stall
);
// Produce and takeaway goods.
const goods = [M.red, M.gold, M.leafLight, M.red, M.cream];
for (let i = 0; i < 5; i++) {
box(0.22, 0.16, 0.20, goods[i], -0.78 + i * 0.38, 1.04, 0.14, stall);
}
cylinder(0.13, 0.15, 0.24, M.cream, 0.85, 1.06, -0.12, stall);
// Delivery crates beside the stall, keeping the clearway open.
for (let i = 0; i < 2; i++) {
const crate = new THREE.Group();
crate.position.set(-2.35, 0.15 + i * 0.43, -0.30);
stall.add(crate);
box(0.72, 0.40, 0.62, M.timberLight, 0, 0, 0, crate);
for (const z of [-0.28, 0.28]) {
box(0.76, 0.055, 0.04, M.timberDark, 0, 0.11, z, crate);
box(0.76, 0.055, 0.04, M.timberDark, 0, -0.11, z, crate);
}
box(0.30, 0.18, 0.30, M.leaf, 0, 0.28, 0, crate);
}
// ------------------------------------------------------------
// Delivery cargo bike and handover
// ------------------------------------------------------------
const cargoBike = new THREE.Group();
cargoBike.position.set(-7.0, 0.14, -0.72);
cargoBike.rotation.y = Math.PI / 2;
scene.add(cargoBike);
box(1.62, 0.11, 0.16, M.teal, 0, 0.55, 0, cargoBike);
box(0.12, 0.48, 0.12, M.tealDark, -0.36, 0.33, 0, cargoBike);
box(0.10, 0.65, 0.10, M.tealDark, 0.46, 0.65, 0, cargoBike);
box(0.08, 0.08, 0.72, M.black, 0.50, 1.0, 0, cargoBike);
box(0.76, 0.70, 0.72, M.teal, -0.55, 1.02, 0, cargoBike);
box(0.80, 0.10, 0.76, M.cream, -0.55, 1.40, 0, cargoBike);
textPlane(
"LOCAL / 10",
0.58,
0.22,
-0.55,
1.08,
0.38,
"#f0ad42",
"#17343c",
cargoBike
);
box(0.22, 0.22, 0.12, M.rubber, 0.48, 0.34, 0, cargoBike);
box(0.22, 0.22, 0.12, M.rubber, -0.50, 0.34, 0, cargoBike);
box(0.22, 0.22, 0.12, M.rubber, -0.50, 0.34, 0, cargoBike);
// A compact hand trolley at the handover point.
const trolley = new THREE.Group();
trolley.position.set(-5.6, 0.14, -0.65);
trolley.rotation.y = -0.35;
scene.add(trolley);
box(0.55, 0.60, 0.48, M.timberLight, 0, 0.48, 0, trolley);
box(0.07, 1.2, 0.07, M.black, -0.25, 0.72, 0, trolley);
box(0.07, 1.2, 0.07, M.black, 0.25, 0.72, 0, trolley);
box(0.07, 0.07, 0.07, M.black, 0, 1.30, 0, trolley);
// ------------------------------------------------------------
// Voxel visitors
// ------------------------------------------------------------
function createPerson({
x = 0,
z = 0,
rotation = 0,
shirt = M.teal,
trousers = M.blue,
skin = M.skin1,
hat = false,
bag = false,
scale = 1
} = {}) {
const group = new THREE.Group();
group.position.set(x, 0.14, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
// Shoes and articulated legs.
const legs = [];
for (const side of [-1, 1]) {
const legPivot = new THREE.Group();
legPivot.position.set(side * 0.13, 0.65, 0);
group.add(legPivot);
box(0.17, 0.54, 0.19, trousers, 0, -0.25, 0, legPivot);
box(0.20, 0.13, 0.31, M.black, 0, -0.56, 0.07, legPivot);
legs.push(legPivot);
}
box(0.53, 0.66, 0.31, shirt, 0, 1.0, 0, group);
box(0.57, 0.08, 0.34, M.cream, 0, 0.78, 0, group);
// Neck, head, hair and simple face.
box(0.14, 0.12, 0.14, skin, 0, 1.39, 0, group);
box(0.38, 0.40, 0.36, skin, 0, 1.63, 0, group);
box(0.40, 0.10, 0.38, M.hair, 0, 1.83, -0.015, group);
box(0.31, 0.09, 0.06, M.hair, 0, 1.66, 0.205, group);
box(0.07, 0.07, 0.05, M.black, -0.10, 1.67, 0.215, group);
box(0.07, 0.07, 0.05, M.black, 0.10, 1.67, 0.215, group);
if (hat) {
box(0.42, 0.13, 0.40, M.cream, 0, 1.91, 0, group);
box(0.48, 0.05, 0.48, M.cream, 0, 1.86, 0.04, group);
}
// Arms.
box(0.15, 0.53, 0.17, shirt, -0.35, 1.02, 0, group);
box(0.15, 0.53, 0.17, shirt, 0.35, 1.02, 0, group);
box(0.14, 0.14, 0.15, skin, -0.35, 0.69, 0, group);
box(0.14, 0.14, 0.15, skin, 0.35, 0.69, 0, group);
if (bag) {
box(0.28, 0.38, 0.16, M.amber, 0.43, 0.72, 0.02, group);
box(0.035, 0.60, 0.035, M.timberDark, 0.37, 1.05, 0.02, group);
}
group.userData.legs = legs;
return group;
}
const walkers = [];
const walkerA = createPerson({
x: -5.7,
z: 1.45,
rotation: Math.PI / 2,
shirt: M.red,
trousers: M.blue,
skin: M.skin2,
bag: true
});
walkers.push({ group: walkerA, speed: 0.46, min: -8.7, max: 8.6 });
const walkerB = createPerson({
x: 3.6,
z: 2.3,
rotation: -Math.PI / 2,
shirt: M.teal,
trousers: M.timberDark,
skin: M.skin3,
scale: 0.94
});
walkers.push({ group: walkerB, speed: -0.38, min: -8.6, max: 8.7 });
// Browsing customer, kept at the edge of the clearway.
createPerson({
x: -2.25,
z: 0.58,
rotation: Math.PI,
shirt: M.cream,
trousers: M.tealDark,
skin: M.skin3,
hat: true
});
// Delivery worker at the trolley.
createPerson({
x: -5.2,
z: -0.2,
rotation: Math.PI / 2,
shirt: M.amber,
trousers: M.timberDark,
skin: M.skin2,
hat: true
});
// Visitor inside the stone passage.
createPerson({
x: 1.82,
z: -4.15,
rotation: 0,
shirt: M.blue,
trousers: M.sandstoneDark,
skin: M.skin1,
scale: 0.94
});
// A seated quay visitor.
const seated = createPerson({
x: -0.8,
z: 2.78,
rotation: Math.PI,
shirt: M.gold,
trousers: M.blue,
skin: M.skin3,
hat: true
});
seated.position.y = 0.48;
seated.rotation.x = 0.08;
box(1.25, 0.12, 0.45, M.timberLight, -0.8, 0.61, 2.55, scene);
// ------------------------------------------------------------
// Quay furniture, planters, jetty and mooring
// ------------------------------------------------------------
function bollard(x) {
box(0.34, 0.25, 0.34, M.black, x, 0.27, 3.57, scene);
box(0.47, 0.13, 0.47, M.black, x, 0.43, 3.57, scene);
}
for (const x of [-8.7, -4.9, -1.0, 2.9, 6.7]) {
bollard(x);
}
// Planter and blocky coastal planting.
function planter(x, z) {
box(0.84, 0.55, 0.84, M.timberDark, x, 0.39, z, scene);
box(0.70, 0.08, 0.70, M.soil, x, 0.70, z, scene, false);
box(0.16, 1.4, 0.16, M.timber, x, 1.27, z, scene);
box(0.78, 0.62, 0.68, M.leaf, x, 2.0, z, scene);
box(0.55, 0.52, 0.52, M.leafLight, x + 0.27, 2.39, z + 0.02, scene);
}
planter(-9.15, 2.73);
planter(5.75, 3.05);
// Timber jetty.
for (let z = 3.25; z < 8.25; z += 0.46) {
box(2.55, 0.16, 0.40, z % 0.92 < 0.46 ? M.timberLight : M.timber, 7.35, 0.16, z, scene);
}
for (const x of [6.25, 8.45]) {
for (const z of [3.7, 5.5, 7.5]) {
box(0.20, 1.55, 0.20, M.timberDark, x, -0.25, z, scene);
box(0.26, 0.14, 0.26, M.timberDark, x, 0.58, z, scene);
}
}
// Rocky edge to the west of the quay.
for (let i = 0; i < 12; i++) {
const rock = box(
0.55 + random() * 0.70,
0.40 + random() * 0.60,
0.55 + random() * 0.65,
i % 3 === 0 ? M.sandstoneDark : M.sandstonePink,
-9.5 + random() * 2.0,
-0.25 + random() * 0.28,
4.0 + random() * 0.65,
scene
);
rock.rotation.y = random() * Math.PI;
}
// ------------------------------------------------------------
// Small harbour ferry
// ------------------------------------------------------------
const ferry = new THREE.Group();
ferry.position.set(8.85, -0.27, 8.5);
ferry.rotation.y = -0.14;
scene.add(ferry);
box(3.5, 0.65, 1.55, M.tealDark, 0, 0.08, 0, ferry);
box(3.20, 0.18, 1.62, M.gold, 0, 0.34, 0, ferry);
box(2.65, 0.90, 1.20, M.white, -0.15, 0.84, 0, ferry);
box(0.75, 0.65, 0.92, M.white, 0.72, 1.05, 0, ferry);
for (const x of [-1.05, -0.45, 0.15]) {
box(0.43, 0.32, 0.04, M.glass, x, 1.02, 0.62, ferry);
}
box(0.49, 0.31, 0.04, M.glass, 0.72, 1.15, 0.48, ferry);
box(0.18, 0.38, 0.18, M.teal, -0.15, 1.46, 0, ferry);
box(0.10, 0.55, 0.10, M.black, 0.15, 1.66, 0, ferry);
box(1.85, 0.07, 0.07, M.black, 0.15, 1.92, 0, ferry);
// Block-built life rings.
box(0.32, 0.10, 0.09, M.red, -1.42, 0.72, 0.02, ferry);
box(0.32, 0.10, 0.09, M.red, -1.42, 0.72, 0.02, ferry);
textPlane("HARBOUR", 1.30, 0.23, -0.22, 0.55, 0.80, "#f0ad42", "#17343c", ferry);
// Wake blocks.
for (let i = 0; i < 8; i++) {
const foam = box(
0.40 + random() * 0.70,
0.025,
0.10,
M.white,
8.1 + random() * 1.3,
-0.255,
6.65 - i * 0.36,
scene,
false
);
foam.rotation.y = random() * 0.5;
}
// Mooring lines.
lineBetween([
[8.45, 0.58, 7.50],
[8.60, 0.13, 8.03],
[8.73, -0.02, 7.88]
], 0x6f604d);
lineBetween([
[6.25, 0.58, 7.50],
[7.55, -0.10, 8.20],
[7.87, -0.05, 8.05]
], 0x6f604d);
// ------------------------------------------------------------
// Distant Sydney context: skyline, bridge and Opera House hint
// ------------------------------------------------------------
const skyline = new THREE.Group();
skyline.position.z = -27;
scene.add(skyline);
const cityMaterials = [
material(0x78949a),
material(0x8ba2a3),
material(0x65858d),
material(0x9ba9a3)
];
for (let i = 0; i < 19; i++) {
const width = 1.4 + random() * 2.0;
const height = 3.0 + random() * 9.0;
const x = -29 + i * 3.2;
const mat = cityMaterials[i % cityMaterials.length];
box(width, height, 2.4 + random() * 1.5, mat, x, height / 2, 0, skyline, false);
if (i % 3 === 0) {
box(width * 0.58, 1.2, 1.4, mat, x, height + 0.6, 0, skyline, false);
}
}
// Stylised Harbour Bridge silhouette.
const bridge = new THREE.Group();
bridge.position.set(-24, 0, -20);
scene.add(bridge);
const bridgeMat = material(0xa35e3d);
const bridgeDark = material(0x874a35);
box(19.0, 0.48, 1.45, bridgeMat, 0, 4.25, 0, bridge, false);
for (const x of [-5.5, 5.5]) {
box(1.2, 8.4, 1.8, bridgeDark, x, 4.35, 0, bridge, false);
box(1.55, 0.65, 2.1, bridgeMat, x, 7.8, 0, bridge, false);
box(1.55, 0.65, 2.1, bridgeMat, x, 4.8, 0, bridge, false);
}
for (let i = 0; i <= 18; i++) {
const angle = (i / 18) * Math.PI;
const x = -8.1 * Math.cos(angle);
const y = 4.1 + 4.0 * Math.sin(angle);
const stone = box(
0.78,
0.46,
1.25,
i % 2 === 0 ? bridgeMat : bridgeDark,
x,
y,
0,
bridge,
false
);
stone.rotation.z = angle;
}
// A distant, abstract stepped Opera House silhouette.
const opera = new THREE.Group();
opera.position.set(13, 0, -21);
scene.add(opera);
box(8.5, 0.35, 3.0, material(0xaab9b6), 0, 0.08, 0, opera, false);
for (let i = 0; i < 4; i++) {
const shell = box(
2.0,
1.2 + i * 0.75,
2.1,
material(0xf0eee2),
-2.5 + i * 1.55,
0.7 + (1.2 + i * 0.75) / 2,
i * 0.35,
opera,
false
);
shell.rotation.z = -0.12 + i * 0.07;
}
// ------------------------------------------------------------
// Camera controls, implemented without Three.js addons
// ------------------------------------------------------------
const target = new THREE.Vector3(0, 1.25, -0.35);
const spherical = {
radius: 22.5,
theta: 0.62,
phi: 0.91
};
const cameraState = {
target: target.clone(),
spherical: { ...spherical }
};
let pointerDown = false;
let previousX = 0;
let previousY = 0;
let cameraTween = null;
function updateCamera() {
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerDown = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
cameraTween = null;
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointerDown) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
spherical.theta = THREE.MathUtils.clamp(
spherical.theta - dx * 0.006,
-0.92,
1.28
);
spherical.phi = THREE.MathUtils.clamp(
spherical.phi - dy * 0.005,
0.48,
1.42
);
});
function stopDragging() {
pointerDown = false;
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraTween = null;
spherical.radius = THREE.MathUtils.clamp(
spherical.radius * Math.exp(event.deltaY * 0.001),
10,
34
);
},
{ passive: false }
);
const views = {
overview: {
target: [0, 1.25, -0.35],
radius: 22.5,
theta: 0.62,
phi: 0.91
},
street: {
target: [-1.1, 1.65, -0.55],
radius: 16.0,
theta: 0.08,
phi: 1.29
},
quay: {
target: [1.1, 0.95, 2.0],
radius: 18.3,
theta: 0.94,
phi: 1.12
}
};
function setView(name) {
const view = views[name];
if (!view) return;
cameraTween = {
elapsed: 0,
duration: 1.0,
fromTarget: target.clone(),
toTarget: new THREE.Vector3(...view.target),
from: { ...spherical },
to: {
radius: view.radius,
theta: view.theta,
phi: view.phi
}
};
document.querySelectorAll("[data-view]").forEach((button) => {
button.classList.toggle("active", button.dataset.view === name);
});
}
document.querySelectorAll("[data-view]").forEach((button) => {
button.addEventListener("click", () => setView(button.dataset.view));
});
window.addEventListener("keydown", (event) => {
if (event.key === "1") setView("overview");
if (event.key === "2") setView("street");
if (event.key === "3") setView("quay");
if (event.key.toLowerCase() === "r") setView("overview");
});
let motionPaused = false;
const pauseButton = document.getElementById("pause-button");
pauseButton.addEventListener("click", () => {
motionPaused = !motionPaused;
pauseButton.textContent = motionPaused ? "Resume motion" : "Pause motion";
});
// ------------------------------------------------------------
// Projected HTML labels
// ------------------------------------------------------------
const hotspotDefinitions = [
{
element: document.getElementById("stall-tag"),
position: new THREE.Vector3(-3.75, 3.0, 0.0)
},
{
element: document.getElementById("passage-tag"),
position: new THREE.Vector3(1.85, 3.85, -1.7)
},
{
element: document.getElementById("delivery-tag"),
position: new THREE.Vector3(-6.45, 1.95, -0.6)
}
];
const projected = new THREE.Vector3();
function updateHotspots() {
for (const hotspot of hotspotDefinitions) {
projected.copy(hotspot.position).project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.1 &&
Math.abs(projected.y) < 1.1;
hotspot.element.style.opacity = visible ? "1" : "0";
hotspot.element.style.left = `${(projected.x * 0.5 + 0.5) * innerWidth}px`;
hotspot.element.style.top = `${(-projected.y * 0.5 + 0.5) * innerHeight}px`;
}
}
// ------------------------------------------------------------
// Animation
// ------------------------------------------------------------
const clock = new THREE.Clock();
const waterPositions = waterGeometry.attributes.position;
let frame = 0;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
// Smooth camera preset transitions.
if (cameraTween) {
cameraTween.elapsed += delta;
const t = Math.min(cameraTween.elapsed / cameraTween.duration, 1);
const eased = 1 - Math.pow(1 - t, 3);
target.lerpVectors(cameraTween.fromTarget, cameraTween.toTarget, eased);
spherical.radius = THREE.MathUtils.lerp(
cameraTween.from.radius,
cameraTween.to.radius,
eased
);
spherical.theta = THREE.MathUtils.lerp(
cameraTween.from.theta,
cameraTween.to.theta,
eased
);
spherical.phi = THREE.MathUtils.lerp(
cameraTween.from.phi,
cameraTween.to.phi,
eased
);
if (t === 1) cameraTween = null;
}
updateCamera();
if (!motionPaused) {
// Gentle harbour swell.
for (let i = 0; i < waterPositions.count; i++) {
const x = waterPositions.getX(i);
const z = waterPositions.getZ(i);
const wave =
Math.sin(x * 0.17 + elapsed * 0.75) * 0.065 +
Math.cos(z * 0.13 - elapsed * 0.55) * 0.045 +
Math.sin((x + z) * 0.08 + elapsed * 0.35) * 0.025;
waterPositions.setY(i, wave);
}
waterPositions.needsUpdate = true;
if (frame % 15 === 0) {
waterGeometry.computeVertexNormals();
}
// Pedestrians move only within the pale pedestrian clearway.
for (const walker of walkers) {
walker.group.position.x += walker.speed * delta;
if (walker.group.position.x > walker.max) {
walker.group.position.x = walker.min;
}
if (walker.group.position.x < walker.min) {
walker.group.position.x = walker.max;
}
const gait = elapsed * 7 + walker.group.position.x;
walker.group.userData.legs[0].rotation.x = Math.sin(gait) * 0.42;
walker.group.userData.legs[1].rotation.x = -Math.sin(gait) * 0.42;
walker.group.position.y = 0.14 + Math.abs(Math.sin(gait)) * 0.025;
}
ferry.position.y = -0.27 + Math.sin(elapsed * 1.1) * 0.045;
ferry.rotation.z = Math.sin(elapsed * 0.8) * 0.012;
}
updateHotspots();
renderer.render(scene, camera);
frame++;
}
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
updateCamera();
animate();
</script>
</body>
</html>
```