Prompt specification
Build or customize the Three.js 3D scene "Museum orientation foyer" 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: Museum orientation foyer
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/museum-orientation-foyer-x0475
Scene Description Prompt:
Make a stylized Three.js scene in a self-contained HTML file using cdnjs: museum orientation foyer. Compose a foyer with tactile map, information desk, exhibits, and clear pathways; animate a visitor consulting the map before following its highlighted route.
Working Three.js Starter (museum-orientation-foyer-x0475):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#183b3b">
<title>Atlas Museum — Orientation Foyer</title>
<style>
:root {
color-scheme: light;
--ink: #173a3a;
--muted: #617473;
--paper: rgba(251, 248, 239, 0.94);
--accent: #21b7a4;
--coral: #ef725f;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce6e2;
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas.dragging {
cursor: grabbing;
}
.ui {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 2;
}
.brand {
position: absolute;
top: 24px;
left: 25px;
max-width: min(420px, calc(100vw - 50px));
padding: 17px 20px 16px;
border: 1px solid rgba(23, 58, 58, 0.1);
border-radius: 18px;
background: var(--paper);
box-shadow: 0 16px 40px rgba(40, 65, 61, 0.12);
backdrop-filter: blur(12px);
}
.eyebrow {
margin-bottom: 6px;
color: var(--accent);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
color: var(--ink);
font-size: clamp(21px, 2.5vw, 31px);
line-height: 1.05;
letter-spacing: -0.04em;
}
.subtitle {
margin: 7px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.controls {
position: absolute;
top: 24px;
right: 25px;
display: flex;
gap: 8px;
pointer-events: auto;
}
button {
appearance: none;
border: 1px solid rgba(23, 58, 58, 0.12);
border-radius: 12px;
padding: 11px 14px;
color: var(--ink);
background: var(--paper);
box-shadow: 0 8px 22px rgba(40, 65, 61, 0.1);
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition: transform 160ms ease, background 160ms ease;
}
button:hover {
transform: translateY(-2px);
background: #fffdf8;
}
button:active {
transform: translateY(0);
}
.status {
position: absolute;
bottom: 25px;
left: 25px;
display: flex;
align-items: center;
gap: 11px;
max-width: min(430px, calc(100vw - 50px));
padding: 12px 15px;
border: 1px solid rgba(23, 58, 58, 0.1);
border-radius: 14px;
background: var(--paper);
box-shadow: 0 12px 30px rgba(40, 65, 61, 0.1);
color: var(--ink);
font-size: 12px;
font-weight: 700;
backdrop-filter: blur(10px);
}
.status-dot {
width: 9px;
height: 9px;
flex: 0 0 auto;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 5px rgba(33, 183, 164, 0.14);
animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
50% {
box-shadow: 0 0 0 8px rgba(33, 183, 164, 0.03);
}
}
.legend {
position: absolute;
right: 25px;
bottom: 25px;
display: flex;
align-items: center;
gap: 9px;
padding: 11px 14px;
border: 1px solid rgba(23, 58, 58, 0.1);
border-radius: 12px;
background: var(--paper);
color: var(--muted);
font-size: 11px;
font-weight: 700;
box-shadow: 0 10px 28px rgba(40, 65, 61, 0.08);
}
.legend-line {
width: 31px;
height: 5px;
border-radius: 8px;
background: var(--accent);
box-shadow: 0 0 0 2px rgba(33, 183, 164, 0.15);
}
.hint {
position: absolute;
left: 50%;
bottom: 27px;
transform: translateX(-50%);
padding: 9px 13px;
border-radius: 999px;
color: rgba(23, 58, 58, 0.7);
background: rgba(251, 248, 239, 0.72);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.04em;
white-space: nowrap;
backdrop-filter: blur(8px);
}
#loading {
position: fixed;
inset: 0;
z-index: 10;
display: grid;
place-items: center;
color: var(--ink);
background: #dce6e2;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
transition: opacity 300ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.brand {
top: 13px;
left: 13px;
padding: 13px 15px;
}
.subtitle {
display: none;
}
.controls {
top: 13px;
right: 13px;
}
button {
padding: 10px 11px;
}
#reset-view {
display: none;
}
.status {
bottom: 13px;
left: 13px;
max-width: calc(100vw - 26px);
}
.legend {
display: none;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div class="ui">
<section class="brand" aria-label="Scene title">
<div class="eyebrow">Atlas Museum</div>
<h1>Orientation Foyer</h1>
<p class="subtitle">
Explore the tactile map, find the information desk, and follow the
highlighted path to the first gallery.
</p>
</section>
<nav class="controls" aria-label="Scene controls">
<button id="reset-view" type="button">Reset view</button>
<button id="pause" type="button">Pause</button>
<button id="replay" type="button">Replay</button>
</nav>
<div class="status" role="status" aria-live="polite">
<span class="status-dot"></span>
<span id="status-text">Visitor is approaching the tactile map</span>
</div>
<div class="legend">
<span class="legend-line"></span>
<span>Suggested museum route</span>
</div>
<div class="hint">Drag to orbit · Scroll to zoom · Double-click to reset</div>
</div>
<div id="loading">Building the foyer…</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 container = document.querySelector("#scene");
const statusText = document.querySelector("#status-text");
const pauseButton = document.querySelector("#pause");
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
container.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdce6e2);
scene.fog = new THREE.Fog(0xdce6e2, 34, 70);
const camera = new THREE.PerspectiveCamera(
40,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraState = {
target: new THREE.Vector3(0, 0.7, -1.4),
radius: 30,
theta: 0.67,
phi: 1.02
};
function updateCamera() {
const { target, radius, theta, phi } = cameraState;
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(target);
}
updateCamera();
// ------------------------------------------------------------
// Lighting
// ------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(0xf9fff5, 0x60706c, 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff2d8, 3.1);
sun.position.set(9, 17, 11);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -19;
sun.shadow.camera.right = 19;
sun.shadow.camera.top = 17;
sun.shadow.camera.bottom = -17;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 48;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xbad9ff, 0.8);
fill.position.set(-12, 8, -7);
scene.add(fill);
// ------------------------------------------------------------
// Materials and geometry helpers
// ------------------------------------------------------------
function standard(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.72,
metalness: 0,
...options
});
}
function addMesh(geometry, material, x = 0, y = 0, z = 0, parent = scene) {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBox(w, h, d, material, x = 0, y = 0, z = 0, parent = scene) {
return addMesh(
new THREE.BoxGeometry(w, h, d),
material,
x,
y,
z,
parent
);
}
function addCylinder(
radiusTop,
radiusBottom,
height,
material,
x = 0,
y = 0,
z = 0,
parent = scene,
segments = 24
) {
return addMesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
material,
x,
y,
z,
parent
);
}
function setShadow(root, cast = true, receive = true) {
root.traverse((object) => {
if (object.isMesh) {
object.castShadow = cast;
object.receiveShadow = receive;
}
});
}
const materials = {
wall: standard(0xe9e3d7),
wallTrim: standard(0xcfd9d1),
dark: standard(0x203f40),
teal: standard(0x21b7a4),
coral: standard(0xef725f),
mustard: standard(0xe6b84c),
wood: standard(0xa46f4f),
paleWood: standard(0xd2aa7c),
white: standard(0xf8f3e8),
path: standard(0xf4eee2),
metal: standard(0x6b7774, { metalness: 0.58, roughness: 0.3 }),
black: standard(0x263335),
leaf: standard(0x4f8c69),
leafLight: standard(0x76aa7e)
};
// ------------------------------------------------------------
// Procedural canvas textures
// ------------------------------------------------------------
let seed = 9127;
function random() {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
}
function makeFloorTexture() {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 512;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#ddd6c8";
ctx.fillRect(0, 0, 512, 512);
for (let i = 0; i < 700; i++) {
const value = 185 + Math.floor(random() * 42);
ctx.fillStyle = `rgba(${value},${value - 4},${value - 10},0.16)`;
const size = 1 + random() * 3;
ctx.fillRect(random() * 512, random() * 512, size, size);
}
ctx.strokeStyle = "rgba(77,89,84,0.13)";
ctx.lineWidth = 2;
for (let x = 0; x <= 512; x += 128) {
ctx.beginPath();
ctx.moveTo(x, 0);
ctx.lineTo(x, 512);
ctx.stroke();
}
for (let y = 0; y <= 512; y += 128) {
ctx.beginPath();
ctx.moveTo(0, y);
ctx.lineTo(512, y);
ctx.stroke();
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(7, 5);
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function makeArtTexture(palette, variant = 0) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 640;
const ctx = canvas.getContext("2d");
ctx.fillStyle = palette[0];
ctx.fillRect(0, 0, 512, 640);
if (variant % 2 === 0) {
ctx.fillStyle = palette[1];
ctx.beginPath();
ctx.arc(260, 250, 170, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = palette[2];
ctx.beginPath();
ctx.moveTo(40, 540);
ctx.lineTo(230, 230);
ctx.lineTo(470, 540);
ctx.closePath();
ctx.fill();
ctx.strokeStyle = palette[3];
ctx.lineWidth = 20;
ctx.beginPath();
ctx.moveTo(80, 100);
ctx.lineTo(430, 520);
ctx.stroke();
} else {
ctx.fillStyle = palette[1];
ctx.fillRect(70, 95, 210, 440);
ctx.fillStyle = palette[2];
ctx.beginPath();
ctx.arc(310, 245, 140, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = palette[3];
ctx.fillRect(160, 390, 290, 120);
ctx.strokeStyle = palette[0];
ctx.lineWidth = 12;
for (let y = 115; y < 520; y += 46) {
ctx.beginPath();
ctx.moveTo(85, y);
ctx.lineTo(265, y);
ctx.stroke();
}
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = 8;
return texture;
}
function makeSignTexture(
title,
subtitle = "",
background = "#173a3a",
foreground = "#f8f3e8"
) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 256;
const ctx = canvas.getContext("2d");
ctx.fillStyle = background;
ctx.fillRect(0, 0, 1024, 256);
ctx.fillStyle = foreground;
ctx.textAlign = "left";
ctx.textBaseline = "middle";
ctx.font = "700 78px Arial, sans-serif";
ctx.fillText(title, 58, subtitle ? 98 : 130, 900);
if (subtitle) {
ctx.globalAlpha = 0.72;
ctx.font = "500 28px Arial, sans-serif";
ctx.fillText(subtitle, 60, 176, 900);
ctx.globalAlpha = 1;
}
ctx.fillStyle = "#21b7a4";
ctx.fillRect(0, 0, 18, 256);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = 8;
return texture;
}
function makeLabel(
text,
worldWidth = 2.5,
foreground = "#173a3a",
background = "rgba(248,243,232,0.94)"
) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 192;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = background;
ctx.beginPath();
ctx.roundRect(8, 8, 752, 176, 38);
ctx.fill();
ctx.strokeStyle = "rgba(23,58,58,0.13)";
ctx.lineWidth = 4;
ctx.stroke();
ctx.fillStyle = foreground;
ctx.font = "700 50px Arial, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 384, 98, 700);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthWrite: false
})
);
sprite.scale.set(worldWidth, worldWidth * 0.25, 1);
return sprite;
}
function makeMapTexture() {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 600;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#f5eddd";
ctx.fillRect(0, 0, 1024, 600);
ctx.fillStyle = "#d8e3dc";
ctx.fillRect(42, 48, 940, 486);
const rooms = [
{ x: 75, y: 80, w: 245, h: 145, label: "GALLERY 01" },
{ x: 345, y: 80, w: 190, h: 145, label: "STUDIO" },
{ x: 560, y: 80, w: 180, h: 145, label: "DESIGN" },
{ x: 765, y: 80, w: 180, h: 145, label: "ARCHIVE" },
{ x: 75, y: 250, w: 205, h: 245, label: "CAFÉ" },
{ x: 305, y: 250, w: 240, h: 245, label: "FOYER" },
{ x: 570, y: 250, w: 375, h: 245, label: "GALLERY 02" }
];
for (const room of rooms) {
ctx.fillStyle = "#f8f2e6";
ctx.fillRect(room.x, room.y, room.w, room.h);
ctx.strokeStyle = "#657d78";
ctx.lineWidth = 7;
ctx.strokeRect(room.x, room.y, room.w, room.h);
ctx.fillStyle = "#526864";
ctx.font = "700 18px Arial, sans-serif";
ctx.textAlign = "center";
ctx.fillText(room.label, room.x + room.w / 2, room.y + 28);
}
ctx.strokeStyle = "#a5b4ad";
ctx.lineWidth = 26;
ctx.lineCap = "round";
ctx.lineJoin = "round";
ctx.beginPath();
ctx.moveTo(180, 210);
ctx.lineTo(180, 370);
ctx.lineTo(730, 370);
ctx.lineTo(730, 235);
ctx.stroke();
ctx.strokeStyle = "#21a996";
ctx.lineWidth = 13;
ctx.beginPath();
ctx.moveTo(705, 465);
ctx.lineTo(610, 465);
ctx.lineTo(520, 370);
ctx.lineTo(320, 370);
ctx.lineTo(215, 300);
ctx.lineTo(215, 115);
ctx.stroke();
ctx.fillStyle = "#ef725f";
ctx.beginPath();
ctx.arc(705, 465, 17, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "#173a3a";
ctx.font = "700 32px Arial, sans-serif";
ctx.textAlign = "left";
ctx.fillText("TOUCH + DISCOVER", 55, 575);
ctx.fillStyle = "#21a996";
ctx.fillRect(355, 555, 38, 8);
ctx.fillStyle = "#173a3a";
ctx.font = "600 20px Arial, sans-serif";
ctx.fillText("SUGGESTED ROUTE", 410, 566);
for (let i = 0; i < 13; i++) {
ctx.fillStyle = "#526864";
ctx.beginPath();
ctx.arc(790 + (i % 4) * 12, 552 + Math.floor(i / 4) * 12, 3, 0, Math.PI * 2);
ctx.fill();
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = 8;
return texture;
}
// ------------------------------------------------------------
// Floor, walls, and architecture
// ------------------------------------------------------------
const outside = addMesh(
new THREE.PlaneGeometry(100, 100),
standard(0xb8cbc4),
0,
-0.34,
0
);
outside.rotation.x = -Math.PI / 2;
outside.castShadow = false;
addBox(
28,
0.3,
20,
standard(0xd7d0c2),
0,
-0.16,
0
);
const floor = addMesh(
new THREE.PlaneGeometry(28, 20),
standard(0xffffff, { map: makeFloorTexture() }),
0,
0.002,
0
);
floor.rotation.x = -Math.PI / 2;
floor.castShadow = false;
// Clear circulation bands beneath the highlighted route.
addBox(2.2, 0.012, 7.6, materials.path, -5.2, 0.012, 3.25);
addBox(17.2, 0.012, 2.25, materials.path, 3.25, 0.014, -3.25);
addBox(27.2, 5.2, 0.36, materials.wall, 0, 2.6, -9.55);
addBox(0.36, 5.2, 19.6, materials.wall, -13.65, 2.6, -0.1);
addBox(27.2, 0.18, 0.46, materials.wallTrim, 0, 0.1, -9.32);
addBox(0.46, 0.18, 19.5, materials.wallTrim, -13.42, 0.1, -0.1);
// Entry columns.
for (const x of [-11.5, 11.5]) {
addBox(1.05, 4.4, 1.05, materials.wallTrim, x, 2.2, 7.4);
addBox(1.28, 0.16, 1.28, materials.white, x, 4.43, 7.4);
}
// Wall identity.
const museumSign = addMesh(
new THREE.PlaneGeometry(7.8, 1.95),
new THREE.MeshBasicMaterial({
map: makeSignTexture("ATLAS MUSEUM", "ORIENTATION FOYER")
}),
-5.7,
3.85,
-9.34
);
museumSign.castShadow = false;
const wayfindingSign = addMesh(
new THREE.PlaneGeometry(4.2, 1.05),
new THREE.MeshBasicMaterial({
map: makeSignTexture("DISCOVER MORE", "GALLERIES 01 — 04", "#f8f3e8", "#173a3a")
}),
7.7,
3.85,
-9.34
);
wayfindingSign.castShadow = false;
// Framed abstract works.
function addArtwork(x, y, z, palette, variant, width = 1.8, height = 2.5) {
addBox(
width + 0.16,
height + 0.16,
0.13,
materials.wood,
x,
y,
z
);
const art = addMesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: makeArtTexture(palette, variant) }),
x,
y,
z + 0.073
);
art.castShadow = false;
}
addArtwork(
-11.05,
2.45,
-9.31,
["#ef725f", "#f1ca61", "#173a3a", "#f6ebda"],
0,
1.65,
2.35
);
addArtwork(
-1.7,
2.55,
-9.31,
["#173a3a", "#21b7a4", "#e6b84c", "#f8f3e8"],
1,
1.8,
2.55
);
// ------------------------------------------------------------
// Tactile orientation map
// ------------------------------------------------------------
const mapGroup = new THREE.Group();
mapGroup.position.set(-8, 0, -2.7);
scene.add(mapGroup);
addBox(7, 0.22, 4.2, materials.paleWood, 0, 1.25, 0, mapGroup);
const mapSurface = addMesh(
new THREE.PlaneGeometry(6.8, 4),
standard(0xffffff, { map: makeMapTexture() }),
0,
1.366,
0,
mapGroup
);
mapSurface.rotation.x = -Math.PI / 2;
mapSurface.castShadow = false;
for (const x of [-2.85, 2.85]) {
for (const z of [-1.4, 1.4]) {
addBox(0.18, 1.15, 0.18, materials.metal, x, 0.57, z, mapGroup);
}
}
// Raised tactile room outlines.
const tactileMaterial = standard(0xf5e6c9, { roughness: 0.92 });
const tactileRouteMaterial = standard(0x21b7a4, {
roughness: 0.55,
emissive: 0x0b4f48,
emissiveIntensity: 0.18
});
const tactileBars = [
[-1.6, 0.15, 0.15, 0.75],
[-1.0, 0.75, 1.1, 0.12],
[-0.25, 0.15, 0.15, 0.55],
[0.75, 0.75, 0.12, 0.95],
[1.45, 0.2, 0.12, 0.65],
[2.05, -0.05, 1.15, 0.12]
];
for (const [x, z, w, d] of tactileBars) {
addBox(w, 0.075, d, tactileMaterial, x, 1.41, z, mapGroup);
}
const tactilePath = new THREE.CatmullRomCurve3([
new THREE.Vector3(1.4, 1.45, -0.85),
new THREE.Vector3(0.65, 1.45, -0.85),
new THREE.Vector3(-0.05, 1.45, -0.55),
new THREE.Vector3(-0.65, 1.45, 0.2),
new THREE.Vector3(-1.6, 1.45, 0.55)
]);
const tactilePathMesh = addMesh(
new THREE.TubeGeometry(tactilePath, 50, 0.035, 7, false),
tactileRouteMaterial,
0,
0,
0,
mapGroup
);
tactilePathMesh.castShadow = false;
const mapLabel = makeLabel("TACTILE MAP", 2.4);
mapLabel.position.set(-8, 2.35, -0.7);
scene.add(mapLabel);
const accessibilityLabel = makeLabel(
"RAISED PLAN + BRAILLE LEGEND",
2.9,
"#526864",
"rgba(248,243,232,0.88)"
);
accessibilityLabel.position.set(-8, 0.75, -0.58);
accessibilityLabel.scale.y *= 0.72;
scene.add(accessibilityLabel);
// ------------------------------------------------------------
// Information desk
// ------------------------------------------------------------
const desk = new THREE.Group();
desk.position.set(3.8, 0, -7);
scene.add(desk);
addBox(5, 1.05, 1.5, materials.dark, 0, 0.55, 0, desk);
addBox(5.4, 0.18, 1.82, materials.paleWood, 0, 1.16, 0, desk);
addBox(4.65, 0.07, 0.03, materials.teal, 0, 0.72, 0.766, desk);
for (let i = 0; i < 11; i++) {
addBox(
0.08,
0.76,
0.04,
materials.paleWood,
-2.05 + i * 0.41,
0.54,
0.78,
desk
);
}
// Counter monitor and information symbol.
addBox(0.72, 0.48, 0.08, materials.black, -0.55, 1.67, -0.15, desk);
addBox(0.1, 0.32, 0.12, materials.metal, -0.55, 1.37, -0.13, desk);
addBox(0.45, 0.04, 0.28, materials.metal, -0.55, 1.24, -0.12, desk);
const infoDisc = addCylinder(
0.33,
0.33,
0.06,
materials.coral,
1.55,
1.62,
0.12,
desk,
32
);
infoDisc.rotation.x = Math.PI / 2;
const infoGlyph = makeLabel("i", 0.35, "#ffffff", "#ef725f");
infoGlyph.position.set(1.55, 1.63, 0.17);
desk.add(infoGlyph);
const deskLabel = makeLabel("INFORMATION", 2.65);
deskLabel.position.set(3.7, 2.6, -6.85);
scene.add(deskLabel);
// Brochure trays.
addBox(0.72, 0.08, 0.48, materials.teal, 2.25, 1.31, 0.18, desk);
for (let i = 0; i < 3; i++) {
const brochure = addBox(
0.55,
0.035,
0.34,
i % 2 === 0 ? materials.coral : materials.mustard,
2.25,
1.37 + i * 0.018,
0.18,
desk
);
brochure.rotation.y = (i - 1) * 0.08;
}
// ------------------------------------------------------------
// Highlighted visitor route
// ------------------------------------------------------------
const routePoints = [
new THREE.Vector3(-5.15, 0.08, -0.45),
new THREE.Vector3(-3.4, 0.08, -0.45),
new THREE.Vector3(-0.9, 0.08, -0.7),
new THREE.Vector3(1.5, 0.08, -2.6),
new THREE.Vector3(4.4, 0.08, -3.25),
new THREE.Vector3(7.5, 0.08, -3.25),
new THREE.Vector3(9.1, 0.08, -4.6),
new THREE.Vector3(10.75, 0.08, -5.85)
];
const routeCurve = new THREE.CatmullRomCurve3(
routePoints,
false,
"centripetal"
);
const routeBase = addMesh(
new THREE.TubeGeometry(routeCurve, 180, 0.09, 8, false),
new THREE.MeshStandardMaterial({
color: 0x52716c,
transparent: true,
opacity: 0.28,
roughness: 0.8
}),
0,
0,
0
);
routeBase.castShadow = false;
const activeRouteGeometry = new THREE.TubeGeometry(
routeCurve,
180,
0.075,
8,
false
);
const activeRoute = addMesh(
activeRouteGeometry,
new THREE.MeshStandardMaterial({
color: 0x18c7ae,
emissive: 0x08796b,
emissiveIntensity: 0.45,
roughness: 0.45
}),
0,
0,
0
);
activeRoute.castShadow = false;
activeRoute.geometry.setDrawRange(0, 0);
const routeArrows = [];
const arrowGeometry = new THREE.ConeGeometry(0.17, 0.46, 3);
arrowGeometry.rotateX(Math.PI / 2);
for (const fraction of [0.09, 0.22, 0.36, 0.5, 0.64, 0.78, 0.92]) {
const point = routeCurve.getPointAt(fraction);
const tangent = routeCurve.getTangentAt(fraction);
const arrow = addMesh(
arrowGeometry,
materials.teal,
point.x,
0.12,
point.z
);
arrow.rotation.y = Math.atan2(tangent.x, tangent.z);
arrow.visible = false;
arrow.castShadow = false;
routeArrows.push({ mesh: arrow, fraction });
}
const endpointRing = addMesh(
new THREE.RingGeometry(0.42, 0.56, 40),
new THREE.MeshBasicMaterial({
color: 0x21b7a4,
side: THREE.DoubleSide,
transparent: true,
opacity: 0.8
}),
routePoints.at(-1).x,
0.065,
routePoints.at(-1).z
);
endpointRing.rotation.x = -Math.PI / 2;
endpointRing.castShadow = false;
// ------------------------------------------------------------
// Central exhibit and display cases
// ------------------------------------------------------------
addCylinder(
1.25,
1.4,
0.42,
materials.white,
9.4,
0.21,
-6.85,
scene,
48
);
const sculpture = new THREE.Group();
sculpture.position.set(9.4, 0, -6.85);
scene.add(sculpture);
addCylinder(
0.42,
0.52,
0.38,
materials.metal,
0,
0.57,
0,
sculpture,
32
);
const sculptureMesh = addMesh(
new THREE.TorusKnotGeometry(0.86, 0.25, 128, 16, 2, 3),
standard(0xef725f, {
roughness: 0.42,
metalness: 0.12,
emissive: 0x3b0b04,
emissiveIntensity: 0.08
}),
0,
1.55,
0,
sculpture
);
const sculptureAccent = addMesh(
new THREE.TorusGeometry(1.08, 0.035, 8, 80),
materials.mustard,
0,
1.55,
0,
sculpture
);
sculptureAccent.rotation.x = 1.1;
const exhibitLabel = makeLabel("EXHIBITION 01", 2.65);
exhibitLabel.position.set(9.35, 3.45, -6.8);
scene.add(exhibitLabel);
const exhibitGlow = new THREE.PointLight(0xffb36f, 18, 7, 2);
exhibitGlow.position.set(9.4, 3.2, -5.9);
scene.add(exhibitGlow);
function makeVase(color) {
const points = [
new THREE.Vector2(0.18, 0),
new THREE.Vector2(0.38, 0.14),
new THREE.Vector2(0.44, 0.42),
new THREE.Vector2(0.32, 0.65),
new THREE.Vector2(0.17, 0.82),
new THREE.Vector2(0.18, 1.02)
];
return new THREE.LatheGeometry(points, 28);
}
function addDisplayCase(x, z, vaseColor, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
addBox(1.8, 0.36, 1.8, materials.dark, 0, 0.18, 0, group);
addBox(1.68, 0.05, 1.68, materials.paleWood, 0, 0.39, 0, group);
const glassMaterial = new THREE.MeshPhysicalMaterial({
color: 0xd9fff5,
transparent: true,
opacity: 0.23,
roughness: 0.08,
metalness: 0,
transmission: 0.2,
depthWrite: false
});
const glass = addBox(
1.55,
1.85,
1.55,
glassMaterial,
0,
1.34,
0,
group
);
glass.castShadow = false;
const vase = addMesh(
makeVase(vaseColor),
standard(vaseColor, { roughness: 0.35 }),
0,
0.46,
0,
group
);
vase.rotation.y = rotation;
vase.scale.setScalar(0.9);
const label = makeLabel("DESIGN COLLECTION", 1.9);
label.position.set(0, 2.58, 0);
group.add(label);
}
addDisplayCase(7.25, 0.15, 0x21a996, 0.4);
addDisplayCase(10.9, 1.4, 0xe6b84c, -0.6);
// ------------------------------------------------------------
// Benches and plants
// ------------------------------------------------------------
function addBench(x, z, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
scene.add(group);
addBox(3, 0.22, 0.85, materials.wood, 0, 0.62, 0, group);
addBox(0.18, 0.58, 0.65, materials.metal, -1.1, 0.3, 0, group);
addBox(0.18, 0.58, 0.65, materials.metal, 1.1, 0.3, 0, group);
}
addBench(4.3, 4.5, -0.12);
addBench(-9.8, 5.2, 0.08);
function addPlant(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
scene.add(group);
addCylinder(
0.43,
0.32,
0.65,
materials.coral,
0,
0.33,
0,
group,
24
);
addCylinder(
0.055,
0.08,
1.45,
materials.wood,
0,
1.25,
0,
group,
10
);
const leafMaterial = materials.leaf;
const leafMaterialLight = materials.leafLight;
for (let i = 0; i < 9; i++) {
const angle = i * 2.4;
const radius = 0.34 + (i % 3) * 0.08;
const leaf = addMesh(
new THREE.SphereGeometry(0.43, 12, 8),
i % 2 ? leafMaterial : leafMaterialLight,
Math.cos(angle) * radius,
1.65 + (i % 4) * 0.16,
Math.sin(angle) * radius,
group
);
leaf.scale.set(0.55, 1.25, 0.28);
leaf.rotation.set(
Math.sin(angle) * 0.5,
-angle,
Math.cos(angle) * 0.45
);
}
}
addPlant(12.25, 5.55, 1.05);
addPlant(-12.25, 6.45, 0.9);
// ------------------------------------------------------------
// Stylized animated visitor
// ------------------------------------------------------------
const visitor = new THREE.Group();
scene.add(visitor);
const visitorBody = new THREE.Group();
visitor.add(visitorBody);
const skin = standard(0xc98762);
const shirt = standard(0xef725f);
const trousers = standard(0x25484a);
const hair = standard(0x283133);
const shoe = standard(0x20292b);
addMesh(
new THREE.CapsuleGeometry(0.31, 0.48, 5, 10),
shirt,
0,
1.06,
0,
visitorBody
);
addMesh(
new THREE.SphereGeometry(0.25, 18, 14),
skin,
0,
1.72,
0,
visitorBody
);
const hairCap = addMesh(
new THREE.SphereGeometry(
0.255,
18,
12,
0,
Math.PI * 2,
0,
Math.PI * 0.56
),
hair,
0,
1.75,
-0.015,
visitorBody
);
hairCap.rotation.x = -0.12;
// Small nose and eyes make the facing direction readable.
addMesh(
new THREE.SphereGeometry(0.045, 10, 8),
skin,
0,
1.7,
0.245,
visitorBody
);
for (const x of [-0.085, 0.085]) {
addMesh(
new THREE.SphereGeometry(0.024, 8, 6),
materials.black,
x,
1.78,
0.226,
visitorBody
);
}
// Backpack.
addBox(
0.43,
0.52,
0.2,
materials.teal,
0,
1.08,
-0.3,
visitorBody
);
function makeLimb(material, length, radius) {
const pivot = new THREE.Group();
const limb = addMesh(
new THREE.CylinderGeometry(radius, radius * 0.9, length, 10),
material,
0,
-length / 2,
0,
pivot
);
return { pivot, limb };
}
const leftLeg = makeLimb(trousers, 0.63, 0.115);
const rightLeg = makeLimb(trousers, 0.63, 0.115);
leftLeg.pivot.position.set(-0.16, 0.79, 0);
rightLeg.pivot.position.set(0.16, 0.79, 0);
visitorBody.add(leftLeg.pivot, rightLeg.pivot);
addBox(
0.2,
0.14,
0.34,
shoe,
0,
-0.65,
0.08,
leftLeg.pivot
);
addBox(
0.2,
0.14,
0.34,
shoe,
0,
-0.65,
0.08,
rightLeg.pivot
);
const leftArm = makeLimb(shirt, 0.52, 0.09);
const rightArm = makeLimb(shirt, 0.52, 0.09);
leftArm.pivot.position.set(-0.39, 1.34, 0);
rightArm.pivot.position.set(0.39, 1.34, 0);
visitorBody.add(leftArm.pivot, rightArm.pivot);
addMesh(
new THREE.SphereGeometry(0.095, 10, 8),
skin,
0,
-0.54,
0,
leftArm.pivot
);
addMesh(
new THREE.SphereGeometry(0.095, 10, 8),
skin,
0,
-0.54,
0,
rightArm.pivot
);
setShadow(visitor);
const visitorStart = new THREE.Vector3(-5.2, 0, 6.8);
const consultPosition = new THREE.Vector3(-5.15, 0, -0.45);
const mapTarget = new THREE.Vector3(-8, 1.35, -2.7);
const sculptureTarget = new THREE.Vector3(9.4, 1.5, -6.85);
visitor.position.copy(visitorStart);
// ------------------------------------------------------------
// Animation state
// ------------------------------------------------------------
const APPROACH_TIME = 2.35;
const CONSULT_TIME = 4.2;
const ROUTE_TIME = 17.5;
const END_HOLD_TIME = 3.8;
const demo = {
time: 0,
paused: false,
status: ""
};
function smoothstep(value) {
const t = THREE.MathUtils.clamp(value, 0, 1);
return t * t * (3 - 2 * t);
}
function lerpAngle(current, target, amount) {
const difference = Math.atan2(
Math.sin(target - current),
Math.cos(target - current)
);
return current + difference * amount;
}
function setStatus(text) {
if (demo.status === text) return;
demo.status = text;
statusText.textContent = text;
}
function resetDemo() {
demo.time = 0;
visitor.position.copy(visitorStart);
visitor.rotation.y = 0;
activeRoute.geometry.setDrawRange(0, 0);
for (const { mesh } of routeArrows) {
mesh.visible = false;
}
setStatus("Visitor is approaching the tactile map");
}
function updateVisitor(delta) {
const t = demo.time;
let walking = false;
let walkingPhase = 0;
if (t < APPROACH_TIME) {
const progress = smoothstep(t / APPROACH_TIME);
visitor.position.lerpVectors(
visitorStart,
consultPosition,
progress
);
const direction = consultPosition.clone().sub(visitorStart);
const targetYaw = Math.atan2(direction.x, direction.z);
visitor.rotation.y = lerpAngle(
visitor.rotation.y,
targetYaw,
1 - Math.exp(-delta * 7)
);
walking = true;
walkingPhase = t * 8.5;
setStatus("Visitor is approaching the tactile map");
} else if (t < APPROACH_TIME + CONSULT_TIME) {
visitor.position.copy(consultPosition);
const direction = mapTarget.clone().sub(visitor.position);
const targetYaw = Math.atan2(direction.x, direction.z);
visitor.rotation.y = lerpAngle(
visitor.rotation.y,
targetYaw,
1 - Math.exp(-delta * 5)
);
setStatus("Visitor is consulting the tactile map");
} else {
const routeTime = t - APPROACH_TIME - CONSULT_TIME;
if (routeTime <= ROUTE_TIME) {
const progress = smoothstep(routeTime / ROUTE_TIME);
const point = routeCurve.getPointAt(progress);
const tangent = routeCurve.getTangentAt(progress);
visitor.position.set(point.x, 0, point.z);
let targetYaw = Math.atan2(tangent.x, tangent.z);
if (progress > 0.9) {
const endDirection = sculptureTarget
.clone()
.sub(visitor.position);
const endYaw = Math.atan2(endDirection.x, endDirection.z);
targetYaw = lerpAngle(
targetYaw,
endYaw,
smoothstep((progress - 0.9) / 0.1)
);
}
visitor.rotation.y = lerpAngle(
visitor.rotation.y,
targetYaw,
1 - Math.exp(-delta * 8)
);
const visibleSegments = Math.floor(progress * 180);
activeRoute.geometry.setDrawRange(
0,
visibleSegments * 8 * 6
);
for (const { mesh, fraction } of routeArrows) {
const shouldShow = progress >= fraction;
mesh.visible = shouldShow;
const targetScale = shouldShow ? 1 : 0;
mesh.scale.lerp(
new THREE.Vector3(targetScale, targetScale, targetScale),
0.18
);
}
walking = true;
walkingPhase = routeTime * 9.2;
setStatus("Visitor is following the highlighted route");
} else {
const endDirection = sculptureTarget
.clone()
.sub(visitor.position);
const endYaw = Math.atan2(endDirection.x, endDirection.z);
visitor.rotation.y = lerpAngle(
visitor.rotation.y,
endYaw,
1 - Math.exp(-delta * 5)
);
setStatus("Route complete — welcome to Exhibition 01");
}
}
// Walk cycle, consultation gesture, and subtle breathing.
if (walking) {
const stride = Math.sin(walkingPhase);
const stride2 = Math.sin(walkingPhase + Math.PI);
leftLeg.pivot.rotation.x = stride * 0.48;
rightLeg.pivot.rotation.x = stride2 * 0.48;
leftArm.pivot.rotation.x = stride2 * 0.4;
rightArm.pivot.rotation.x = stride * 0.4;
visitorBody.position.y = Math.abs(Math.sin(walkingPhase)) * 0.045;
} else {
const consulting =
t >= APPROACH_TIME &&
t < APPROACH_TIME + CONSULT_TIME;
leftLeg.pivot.rotation.x = THREE.MathUtils.lerp(
leftLeg.pivot.rotation.x,
0.03,
0.16
);
rightLeg.pivot.rotation.x = THREE.MathUtils.lerp(
rightLeg.pivot.rotation.x,
-0.03,
0.16
);
if (consulting) {
const gesture = Math.sin(t * 3.2) * 0.11;
rightArm.pivot.rotation.x = -1.08 + gesture;
leftArm.pivot.rotation.x = -0.3 - gesture * 0.4;
visitorBody.rotation.z = Math.sin(t * 1.6) * 0.012;
} else {
leftArm.pivot.rotation.x = THREE.MathUtils.lerp(
leftArm.pivot.rotation.x,
-0.05,
0.1
);
rightArm.pivot.rotation.x = THREE.MathUtils.lerp(
rightArm.pivot.rotation.x,
-0.05,
0.1
);
visitorBody.rotation.z = THREE.MathUtils.lerp(
visitorBody.rotation.z,
0,
0.1
);
}
visitorBody.position.y = Math.sin(t * 2.2) * 0.012;
}
}
// ------------------------------------------------------------
// Custom camera controls — no addons
// ------------------------------------------------------------
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add("dragging");
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - pointerX;
const deltaY = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraState.theta -= deltaX * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi + deltaY * 0.005,
0.52,
1.38
);
updateCamera();
});
function stopDragging(event) {
dragging = false;
renderer.domElement.classList.remove("dragging");
if (
event &&
renderer.domElement.hasPointerCapture(event.pointerId)
) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
15,
43
);
updateCamera();
},
{ passive: false }
);
function resetView() {
cameraState.target.set(0, 0.7, -1.4);
cameraState.radius = 30;
cameraState.theta = 0.67;
cameraState.phi = 1.02;
updateCamera();
}
renderer.domElement.addEventListener("dblclick", resetView);
document.querySelector("#reset-view").addEventListener("click", resetView);
document.querySelector("#replay").addEventListener("click", resetDemo);
pauseButton.addEventListener("click", () => {
demo.paused = !demo.paused;
pauseButton.textContent = demo.paused ? "Resume" : "Pause";
});
document.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
pauseButton.click();
}
if (event.key.toLowerCase() === "r") {
resetDemo();
}
if (event.key.toLowerCase() === "v") {
resetView();
}
});
// ------------------------------------------------------------
// Resize and render loop
// ------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
if (!demo.paused) {
demo.time += delta;
const totalCycle =
APPROACH_TIME + CONSULT_TIME + ROUTE_TIME + END_HOLD_TIME;
if (demo.time > totalCycle) {
resetDemo();
} else {
updateVisitor(delta);
}
}
sculpture.rotation.y += delta * 0.28;
sculptureAccent.rotation.z += delta * 0.17;
const pulse = 1 + Math.sin(clock.elapsedTime * 2.8) * 0.1;
endpointRing.scale.setScalar(pulse);
endpointRing.material.opacity = 0.62 + Math.sin(
clock.elapsedTime * 2.8
) * 0.16;
renderer.render(scene, camera);
}
animate();
requestAnimationFrame(() => {
document.querySelector("#loading").classList.add("hidden");
setTimeout(() => {
document.querySelector("#loading").remove();
}, 350);
});
</script>
</body>
</html>
```