Prompt specification
Build or customize the Three.js 3D scene "Color Contrast Navigation Challenge" 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: Color Contrast Navigation Challenge
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/color-contrast-navigation-challenge-x3288
Scene Description Prompt:
Navigate a voxel exhibition with selectable sign palettes and shape cues under fixed lighting and camera conditions. One HTML file using Three.js from cdnjs.
Working Three.js Starter (color-contrast-navigation-challenge-x3288):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Voxel Room — Exhibition Sign Systems</title>
<style>
:root {
--paper: #f2efe7;
--ink: #20242a;
--muted: #777970;
--accent: #f1c84b;
--line: rgba(32, 36, 42, 0.14);
--panel: rgba(247, 244, 236, 0.94);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e5e0d6;
color: var(--ink);
font-family: Arial, Helvetica, sans-serif;
}
button {
font: inherit;
}
#stage {
position: fixed;
inset: 0 380px 0 0;
overflow: hidden;
background: #e5e0d6;
}
#stage canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.topbar {
position: absolute;
z-index: 5;
top: 22px;
left: 24px;
right: 24px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
color: var(--ink);
}
.brand-mark {
width: 32px;
height: 32px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 2px;
transform: rotate(-8deg);
}
.brand-mark span {
background: var(--ink);
}
.brand-mark span:nth-child(2),
.brand-mark span:nth-child(4),
.brand-mark span:nth-child(9) {
background: var(--accent);
}
.brand-name {
font-size: 12px;
font-weight: 900;
letter-spacing: 0.18em;
line-height: 1.2;
}
.brand-sub {
display: block;
margin-top: 4px;
color: var(--muted);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.18em;
}
.conditions {
display: flex;
align-items: center;
gap: 9px;
padding: 9px 12px;
border: 1px solid rgba(32, 36, 42, 0.13);
border-radius: 999px;
background: rgba(246, 243, 235, 0.78);
backdrop-filter: blur(10px);
color: #4e514b;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.condition-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.condition-divider {
width: 1px;
height: 11px;
background: var(--line);
}
.room-title {
position: absolute;
z-index: 4;
top: 91px;
left: 25px;
pointer-events: none;
}
.room-kicker {
margin-bottom: 8px;
color: #74766f;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.room-title h1 {
margin: 0;
max-width: 300px;
font-size: clamp(28px, 3vw, 46px);
font-weight: 900;
letter-spacing: -0.055em;
line-height: 0.94;
}
.room-title p {
max-width: 260px;
margin: 13px 0 0;
color: #6e7069;
font-size: 11px;
line-height: 1.55;
}
.camera-tools {
position: absolute;
z-index: 6;
left: 24px;
bottom: 25px;
display: flex;
align-items: center;
gap: 6px;
padding: 7px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(247, 244, 236, 0.9);
backdrop-filter: blur(12px);
box-shadow: 0 10px 30px rgba(35, 33, 28, 0.08);
}
.camera-tools button {
display: grid;
width: 34px;
height: 34px;
place-items: center;
border: 0;
border-radius: 8px;
background: transparent;
color: var(--ink);
cursor: pointer;
font-size: 16px;
font-weight: 800;
transition: background 160ms ease, transform 160ms ease;
}
.camera-tools button:hover {
background: rgba(32, 36, 42, 0.08);
transform: translateY(-1px);
}
.camera-tools button.reset {
width: auto;
padding: 0 13px;
font-size: 9px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.tool-divider {
width: 1px;
height: 20px;
margin: 0 2px;
background: var(--line);
}
.control-hint {
position: absolute;
z-index: 4;
right: 24px;
bottom: 27px;
color: rgba(32, 36, 42, 0.62);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.09em;
text-transform: uppercase;
pointer-events: none;
}
.selected-card {
position: absolute;
z-index: 5;
left: 24px;
bottom: 82px;
width: 310px;
padding: 17px 18px 16px;
border: 1px solid var(--line);
border-top: 3px solid var(--accent);
border-radius: 4px 4px 13px 13px;
background: rgba(247, 244, 236, 0.9);
backdrop-filter: blur(14px);
box-shadow: 0 12px 32px rgba(35, 33, 28, 0.09);
pointer-events: none;
}
.selected-label {
display: flex;
align-items: center;
justify-content: space-between;
color: #797b73;
font-size: 8px;
font-weight: 900;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.selected-number {
color: var(--ink);
}
.selected-card h2 {
margin: 11px 0 5px;
font-size: 21px;
letter-spacing: -0.035em;
}
.selected-card > p {
margin: 0 0 13px;
color: #74766f;
font-size: 10px;
line-height: 1.45;
}
.selected-meta {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
padding-top: 11px;
border-top: 1px solid var(--line);
}
.meta-item span {
display: block;
margin-bottom: 4px;
color: #8a8c84;
font-size: 7px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.meta-item strong {
display: block;
font-size: 9px;
font-weight: 800;
}
.palette-panel {
position: fixed;
z-index: 10;
top: 18px;
right: 18px;
bottom: 18px;
width: 344px;
overflow: auto;
padding: 25px;
border: 1px solid rgba(32, 36, 42, 0.13);
border-radius: 18px;
background: var(--panel);
backdrop-filter: blur(18px);
box-shadow: 0 20px 60px rgba(35, 33, 28, 0.13);
scrollbar-width: thin;
scrollbar-color: #c4c0b6 transparent;
}
.panel-top {
display: flex;
align-items: center;
justify-content: space-between;
color: #777970;
font-size: 8px;
font-weight: 900;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.live-pill {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 8px;
border-radius: 999px;
background: rgba(32, 36, 42, 0.06);
}
.live-pill::before {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
content: "";
}
.palette-panel h2 {
margin: 21px 0 10px;
max-width: 270px;
font-size: 36px;
font-weight: 900;
letter-spacing: -0.06em;
line-height: 0.96;
}
.intro {
margin: 0 0 23px;
color: #6f716a;
font-size: 11px;
line-height: 1.55;
}
.section {
padding-top: 18px;
border-top: 1px solid var(--line);
}
.section + .section {
margin-top: 19px;
}
.section-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.section-heading h3 {
margin: 0;
font-size: 9px;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.section-heading span {
color: #94958f;
font-size: 8px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.palette-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.palette-button {
min-height: 58px;
padding: 10px;
border: 1px solid var(--line);
border-radius: 9px;
background: rgba(255, 255, 255, 0.38);
color: var(--ink);
text-align: left;
cursor: pointer;
transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.palette-button:hover {
transform: translateY(-1px);
background: rgba(255, 255, 255, 0.72);
}
.palette-button.active {
border-color: var(--ink);
background: #fff;
box-shadow: 0 5px 14px rgba(32, 36, 42, 0.07);
}
.palette-swatches {
display: flex;
margin-bottom: 8px;
}
.palette-swatches i {
width: 17px;
height: 17px;
margin-right: -3px;
border: 2px solid var(--panel);
border-radius: 50%;
}
.palette-button strong {
display: block;
font-size: 9px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.cue-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 7px;
}
.cue-button {
min-height: 37px;
padding: 8px 4px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.36);
color: #5e615b;
cursor: pointer;
font-size: 8px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.cue-button:hover {
background: rgba(255, 255, 255, 0.8);
}
.cue-button.active {
border-color: var(--ink);
background: var(--ink);
color: #fff;
}
.work-list {
display: grid;
gap: 5px;
}
.work-button {
display: grid;
grid-template-columns: 34px 1fr auto;
align-items: center;
gap: 10px;
width: 100%;
padding: 9px 10px;
border: 1px solid transparent;
border-radius: 8px;
background: transparent;
color: var(--ink);
text-align: left;
cursor: pointer;
transition: border-color 150ms ease, background 150ms ease;
}
.work-button:hover {
background: rgba(255, 255, 255, 0.6);
}
.work-button.active {
border-color: var(--line);
background: rgba(255, 255, 255, 0.8);
}
.work-glyph {
position: relative;
width: 29px;
height: 29px;
border-radius: 6px;
background: var(--glyph);
}
.work-glyph::after {
position: absolute;
top: 7px;
left: 7px;
width: 15px;
height: 15px;
border: 3px solid rgba(255, 255, 255, 0.85);
border-radius: 3px;
content: "";
transform: rotate(45deg);
}
.work-button:nth-child(2) .work-glyph::after {
border-radius: 50% 50% 3px 3px;
transform: none;
}
.work-button:nth-child(3) .work-glyph::after {
border: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.85);
box-shadow: inset -4px -4px 0 rgba(32, 36, 42, 0.16);
transform: none;
}
.work-button:nth-child(4) .work-glyph::after {
width: 19px;
height: 7px;
top: 12px;
left: 5px;
border: 0;
border-radius: 0;
background: rgba(255, 255, 255, 0.86);
box-shadow: 5px -5px 0 rgba(255, 255, 255, 0.86), 10px -10px 0 rgba(255, 255, 255, 0.86);
transform: none;
}
.work-copy strong {
display: block;
margin-bottom: 3px;
font-size: 10px;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.work-copy small {
display: block;
color: #85877f;
font-size: 8px;
}
.work-arrow {
color: #8d8f87;
font-size: 13px;
}
.panel-note {
display: flex;
gap: 9px;
margin-top: 18px;
padding: 12px;
border-radius: 9px;
background: rgba(32, 36, 42, 0.055);
color: #71736c;
font-size: 9px;
line-height: 1.5;
}
.panel-note strong {
color: var(--ink);
}
@media (max-width: 1100px) {
#stage {
right: 340px;
}
.palette-panel {
width: 304px;
right: 12px;
}
.palette-panel h2 {
font-size: 31px;
}
.room-title p,
.control-hint {
display: none;
}
}
@media (max-width: 760px) {
#stage {
inset: 0 0 43vh 0;
}
.topbar {
top: 14px;
left: 15px;
right: 15px;
}
.conditions {
padding: 8px;
}
.conditions .camera-label,
.condition-divider {
display: none;
}
.room-title {
top: 65px;
left: 16px;
}
.room-title h1 {
max-width: 190px;
font-size: 30px;
}
.room-title p {
display: none;
}
.palette-panel {
top: auto;
right: 10px;
bottom: 10px;
left: 10px;
width: auto;
height: 41vh;
padding: 18px;
border-radius: 14px;
}
.palette-panel h2,
.intro,
.panel-note {
display: none;
}
.panel-top {
margin-bottom: 12px;
}
.section {
padding-top: 12px;
}
.section + .section {
margin-top: 13px;
}
.selected-card {
top: 129px;
bottom: auto;
left: 15px;
width: 235px;
padding: 12px 14px;
}
.selected-card h2 {
margin-top: 7px;
font-size: 17px;
}
.selected-card > p,
.selected-meta {
display: none;
}
.camera-tools {
right: 14px;
bottom: 14px;
left: auto;
}
.palette-button {
min-height: 50px;
}
}
</style>
</head>
<body>
<main id="stage" aria-label="Interactive voxel exhibition">
<header class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<span></span><span></span><span></span>
<span></span><span></span><span></span>
<span></span><span></span><span></span>
</div>
<div class="brand-name">
VOXEL / ROOM
<span class="brand-sub">PERMANENT COLLECTION</span>
</div>
</div>
<div class="conditions">
<span class="condition-dot"></span>
<span>Fixed illumination</span>
<span class="condition-divider"></span>
<span class="camera-label">Ortho / Elev 34°</span>
</div>
</header>
<section class="room-title">
<div class="room-kicker">Exhibition 04 · Axis Studies</div>
<h1>Voxel<br>Assembly</h1>
<p>Four studies in mass, void and rhythm. Compare wayfinding systems without changing the room.</p>
</section>
<section class="selected-card" id="selected-card" aria-live="polite">
<div class="selected-label">
<span>Selected work</span>
<span class="selected-number" id="selected-number">01 / 04</span>
</div>
<h2 id="selected-title">Assembly / Cube</h2>
<p id="selected-description">A modular solid held just outside its expected balance.</p>
<div class="selected-meta">
<div class="meta-item">
<span>Material</span>
<strong id="selected-material">Painted resin</strong>
</div>
<div class="meta-item">
<span>Dimensions</span>
<strong id="selected-dimensions">112 × 112 × 112 cm</strong>
</div>
</div>
</section>
<nav class="camera-tools" aria-label="Camera controls">
<button id="orbit-left" type="button" aria-label="Rotate camera left">←</button>
<button id="zoom-out" type="button" aria-label="Zoom out">−</button>
<button id="reset-view" class="reset" type="button">Reset</button>
<button id="zoom-in" type="button" aria-label="Zoom in">+</button>
<button id="orbit-right" type="button" aria-label="Rotate camera right">→</button>
</nav>
<div class="control-hint">Drag to orbit · Scroll to zoom · WASD to pan</div>
</main>
<aside class="palette-panel" aria-label="Exhibition display controls">
<div class="panel-top">
<span>Exhibition control</span>
<span class="live-pill">Live system</span>
</div>
<h2>Signs, shapes<br>& systems.</h2>
<p class="intro">
Switch the room’s sign language while the illumination and camera rig remain constant.
</p>
<section class="section">
<div class="section-heading">
<h3>01 · Sign palette</h3>
<span>4 systems</span>
</div>
<div class="palette-grid" role="group" aria-label="Sign palette">
<button class="palette-button active" data-palette="studio" type="button" aria-pressed="true">
<span class="palette-swatches">
<i style="background:#20252b"></i><i style="background:#f1c84b"></i>
</span>
<strong>Studio</strong>
</button>
<button class="palette-button" data-palette="signal" type="button" aria-pressed="false">
<span class="palette-swatches">
<i style="background:#294bd4"></i><i style="background:#ffd84a"></i>
</span>
<strong>Signal</strong>
</button>
<button class="palette-button" data-palette="clay" type="button" aria-pressed="false">
<span class="palette-swatches">
<i style="background:#c85c43"></i><i style="background:#273139"></i>
</span>
<strong>Clay</strong>
</button>
<button class="palette-button" data-palette="meadow" type="button" aria-pressed="false">
<span class="palette-swatches">
<i style="background:#2f6557"></i><i style="background:#b9d66c"></i>
</span>
<strong>Meadow</strong>
</button>
</div>
</section>
<section class="section">
<div class="section-heading">
<h3>02 · Shape cue</h3>
<span>Global sign system</span>
</div>
<div class="cue-grid" role="group" aria-label="Shape cue">
<button class="cue-button active" data-cue="auto" type="button">Auto</button>
<button class="cue-button" data-cue="cube" type="button">Cube</button>
<button class="cue-button" data-cue="orbit" type="button">Orbit</button>
<button class="cue-button" data-cue="arch" type="button">Arch</button>
<button class="cue-button" data-cue="stairs" type="button">Stair</button>
<button class="cue-button" data-cue="arrow" type="button">Arrow</button>
<button class="cue-button" data-cue="none" type="button">None</button>
</div>
</section>
<section class="section">
<div class="section-heading">
<h3>03 · Works</h3>
<span>Select to inspect</span>
</div>
<div class="work-list">
<button class="work-button active" data-work="cube" type="button">
<span class="work-glyph" style="--glyph:#dfbd31"></span>
<span class="work-copy"><strong>Cube</strong><small>Assembly 01 · 2025</small></span>
<span class="work-arrow">↗</span>
</button>
<button class="work-button" data-work="arch" type="button">
<span class="work-glyph" style="--glyph:#3153b8"></span>
<span class="work-copy"><strong>Arch</strong><small>Assembly 02 · 2025</small></span>
<span class="work-arrow">↗</span>
</button>
<button class="work-button" data-work="orbit" type="button">
<span class="work-glyph" style="--glyph:#d65f51"></span>
<span class="work-copy"><strong>Orbit</strong><small>Assembly 03 · 2025</small></span>
<span class="work-arrow">↗</span>
</button>
<button class="work-button" data-work="stairs" type="button">
<span class="work-glyph" style="--glyph:#71984c"></span>
<span class="work-copy"><strong>Stair</strong><small>Assembly 04 · 2025</small></span>
<span class="work-arrow">↗</span>
</button>
</div>
</section>
<div class="panel-note">
<span>↗</span>
<span><strong>Stable comparison.</strong> Selecting a palette or cue changes only the signage. The light rig, artwork and initial camera remain fixed.</span>
</div>
</aside>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.domElement.setAttribute("aria-label", "Three-dimensional voxel exhibition");
renderer.domElement.tabIndex = 0;
stage.prepend(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe5e0d6);
scene.fog = new THREE.Fog(0xe5e0d6, 34, 62);
const camera = new THREE.OrthographicCamera(-15, 15, 10, -10, 0.1, 100);
const target = new THREE.Vector3(0, 1.25, -0.7);
const desiredTarget = target.clone();
let theta = 0.28;
let phi = 1.03;
let desiredTheta = theta;
let desiredPhi = phi;
let zoom = 1;
let desiredZoom = zoom;
const cameraOffset = new THREE.Vector3();
const forward = new THREE.Vector3();
const right = new THREE.Vector3();
// Fixed illumination rig.
const hemisphere = new THREE.HemisphereLight(0xfffbf0, 0x8f918c, 2.15);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff4dc, 3.25);
keyLight.position.set(-9, 15, 10);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -18;
keyLight.shadow.camera.right = 18;
keyLight.shadow.camera.top = 18;
keyLight.shadow.camera.bottom = -18;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 45;
keyLight.shadow.bias = -0.00035;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xcbd7ff, 1.05);
fillLight.position.set(11, 8, -7);
scene.add(fillLight);
const rearLight = new THREE.DirectionalLight(0xffead2, 0.7);
rearLight.position.set(0, 5, -12);
scene.add(rearLight);
const boxGeometry = new THREE.BoxGeometry(1, 1, 1);
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.76,
metalness: 0,
...options
});
const materials = {
floor: material(0xded9cf),
wall: material(0xe7e2d8),
wallEdge: material(0xd3cec3),
plinth: material(0xf2eee5),
plinthSide: material(0xdad5ca),
dark: material(0x252a2f),
charcoal: material(0x30363a),
yellow: material(0xe5bd32, { roughness: 0.68 }),
gold: material(0xf0cf48, { roughness: 0.55 }),
coral: material(0xd65e50, { roughness: 0.72 }),
red: material(0xb9473d),
blue: material(0x3455ba),
cyan: material(0x2f9ca5),
green: material(0x6f994b),
lime: material(0xa9c84f),
pink: material(0xe88991),
cream: material(0xf0dfb5),
black: material(0x22272a),
luminous: material(0xfff2c2, {
emissive: 0xffd978,
emissiveIntensity: 0.55,
roughness: 0.4
})
};
function addBox(parent, x, y, z, sx, sy, sz, mat, castShadow = true) {
const mesh = new THREE.Mesh(boxGeometry, mat);
mesh.position.set(x, y, z);
mesh.scale.set(sx, sy, sz);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Exhibition architecture.
addBox(scene, 0, -0.22, -1.1, 26.5, 0.44, 21.5, materials.floor);
addBox(scene, 0, 3.7, -9.45, 26.5, 7.4, 0.38, materials.wall);
addBox(scene, 0, 0.14, -9.18, 26.5, 0.28, 0.18, materials.wallEdge);
addBox(scene, 0, 7.42, -9.45, 26.5, 0.16, 0.55, materials.wallEdge);
[-10.8, -5.4, 0, 5.4, 10.8].forEach((x) => {
addBox(scene, x, 3.7, -9.235, 0.035, 7.1, 0.025, materials.wallEdge, false);
});
const grid = new THREE.GridHelper(26, 26, 0xa9a59b, 0xb9b4aa);
grid.position.set(0, 0.012, -1.1);
grid.scale.z = 0.8;
grid.material.transparent = true;
grid.material.opacity = 0.17;
grid.material.depthWrite = false;
scene.add(grid);
// A quiet threshold line across the room.
addBox(scene, 0, 0.026, 5.7, 22, 0.025, 0.055, materials.yellow, false);
addBox(scene, 0, 0.03, -6.45, 22, 0.025, 0.045, materials.wallEdge, false);
// Pixel typography.
const pixelFont = {
"0": ["01110", "10001", "10011", "10101", "11001", "10001", "01110"],
"1": ["00100", "01100", "00100", "00100", "00100", "00100", "01110"],
"2": ["01110", "10001", "00001", "00010", "00100", "01000", "11111"],
"3": ["11110", "00001", "00001", "01110", "00001", "00001", "11110"],
"4": ["00010", "00110", "01010", "10010", "11111", "00010", "00010"],
"A": ["01110", "10001", "10001", "11111", "10001", "10001", "10001"],
"B": ["11110", "10001", "10001", "11110", "10001", "10001", "11110"],
"C": ["01111", "10000", "10000", "10000", "10000", "10000", "01111"],
"D": ["11110", "10001", "10001", "10001", "10001", "10001", "11110"],
"E": ["11111", "10000", "10000", "11110", "10000", "10000", "11111"],
"F": ["11111", "10000", "10000", "11110", "10000", "10000", "10000"],
"I": ["11111", "00100", "00100", "00100", "00100", "00100", "11111"],
"L": ["10000", "10000", "10000", "10000", "10000", "10000", "11111"],
"M": ["10001", "11011", "10101", "10101", "10001", "10001", "10001"],
"O": ["01110", "10001", "10001", "10001", "10001", "10001", "01110"],
"R": ["11110", "10001", "10001", "11110", "10100", "10010", "10001"],
"S": ["01111", "10000", "10000", "01110", "00001", "00001", "11110"],
"T": ["11111", "00100", "00100", "00100", "00100", "00100", "00100"],
"U": ["10001", "10001", "10001", "10001", "10001", "10001", "01110"],
"V": ["10001", "10001", "10001", "10001", "10001", "01010", "00100"],
"X": ["10001", "10001", "01010", "00100", "01010", "10001", "10001"],
"/": ["00001", "00001", "00010", "00100", "01000", "10000", "10000"],
" ": ["00000", "00000", "00000", "00000", "00000", "00000", "00000"]
};
function makePixelText(text, scale, depth, mat) {
const instances = [];
const width = (text.length * 6 - 1) * scale;
[...text].forEach((character, characterIndex) => {
const glyph = pixelFont[character] || pixelFont[" "];
glyph.forEach((row, rowIndex) => {
[...row].forEach((cell, columnIndex) => {
if (cell !== "1") return;
instances.push({
x: -width / 2 + characterIndex * 6 * scale + columnIndex * scale + scale * 0.45,
y: (6 - rowIndex) * scale + scale * 0.45,
z: 0
});
});
});
});
const mesh = new THREE.InstancedMesh(boxGeometry, mat, instances.length);
const matrix = new THREE.Matrix4();
const quaternion = new THREE.Quaternion();
const position = new THREE.Vector3();
const instanceScale = new THREE.Vector3();
instances.forEach((instance, index) => {
position.set(instance.x, instance.y, instance.z);
instanceScale.set(scale * 0.88, scale * 0.88, depth);
matrix.compose(position, quaternion, instanceScale);
mesh.setMatrixAt(index, matrix);
});
mesh.instanceMatrix.needsUpdate = true;
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.frustumCulled = false;
return mesh;
}
const wallTitle = makePixelText("VOXEL", 0.28, 0.15, materials.dark);
wallTitle.position.set(0, 5.15, -9.16);
scene.add(wallTitle);
const wallSubtitle = makePixelText("FORM / 04", 0.105, 0.12, materials.charcoal);
wallSubtitle.position.set(0, 4.03, -9.14);
scene.add(wallSubtitle);
addBox(scene, -4.02, 5.78, -9.1, 0.24, 0.24, 0.16, materials.yellow);
addBox(scene, 4.02, 5.78, -9.1, 0.24, 0.24, 0.16, materials.coral);
const exhibits = [
{
id: "cube",
number: "01",
title: "CUBE",
fullTitle: "Assembly / Cube",
description: "A modular solid held just outside its expected balance.",
material: "Painted resin",
dimensions: "112 × 112 × 112 cm",
x: -7.15,
z: 0.05,
shape: "cube",
accent: materials.yellow
},
{
id: "arch",
number: "02",
title: "ARCH",
fullTitle: "Assembly / Arch",
description: "A stepped opening frames the empty space as a material.",
material: "Anodized aluminium",
dimensions: "146 × 84 × 72 cm",
x: -2.5,
z: 0.05,
shape: "arch",
accent: materials.blue
},
{
id: "orbit",
number: "03",
title: "ORBIT",
fullTitle: "Assembly / Orbit",
description: "A hollow shell suggests a body moving through its own center.",
material: "Glazed ceramic",
dimensions: "128 × 128 × 128 cm",
x: 2.55,
z: 0.05,
shape: "orbit",
accent: materials.coral
},
{
id: "stairs",
number: "04",
title: "STAIR",
fullTitle: "Assembly / Stair",
description: "A repeated rise becomes a landscape of accumulation.",
material: "Cast polymer",
dimensions: "168 × 86 × 62 cm",
x: 7.25,
z: 0.05,
shape: "stairs",
accent: materials.green
}
];
const signTextures = [];
const signPanels = [];
const signBorders = [];
const palettes = {
studio: { panel: "#20252b", ink: "#f7f3e8", accent: "#f1c84b" },
signal: { panel: "#294bd4", ink: "#ffffff", accent: "#ffd84a" },
clay: { panel: "#c85c43", ink: "#fff7ed", accent: "#273139" },
meadow: { panel: "#2f6557", ink: "#f6f3df", accent: "#b9d66c" }
};
const shapePatterns = {
cube: [
"000011000",
"000111100",
"001111110",
"011111111",
"001111110",
"000111100",
"000011000"
],
orbit: [
"000111000",
"001111100",
"011111110",
"111111111",
"011111110",
"001111100",
"000111000"
],
arch: [
"110000011",
"111000111",
"111100111",
"111110111",
"111111111",
"111111111",
"111111111"
],
stairs: [
"000011111",
"000111111",
"001111111",
"011111111",
"111111111",
"111111111",
"111111111"
],
arrow: [
"000001000",
"000011000",
"000111000",
"111111111",
"000111000",
"000111000",
"000111000"
]
};
let activePalette = "studio";
let activeCue = "auto";
function drawPixelText(ctx, text, x, y, scale, color) {
ctx.fillStyle = color;
[...text].forEach((character, characterIndex) => {
const glyph = pixelFont[character] || pixelFont[" "];
glyph.forEach((row, rowIndex) => {
[...row].forEach((cell, columnIndex) => {
if (cell === "1") {
ctx.fillRect(
x + characterIndex * 6 * scale + columnIndex * scale,
y + rowIndex * scale,
scale,
scale
);
}
});
});
});
}
function drawShape(ctx, shape, x, y, scale, color) {
if (shape === "none") return;
const pattern = shapePatterns[shape] || shapePatterns.cube;
ctx.fillStyle = color;
pattern.forEach((row, rowIndex) => {
[...row].forEach((cell, columnIndex) => {
if (cell === "1") {
ctx.fillRect(x + columnIndex * scale, y + rowIndex * scale, scale, scale);
}
});
});
}
function createSignTexture(exhibit, palette) {
const canvas = document.createElement("canvas");
canvas.width = 640;
canvas.height = 320;
const ctx = canvas.getContext("2d");
ctx.fillStyle = palette.panel;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = palette.accent;
ctx.fillRect(31, 31, 25, 25);
drawPixelText(ctx, exhibit.number, 78, 33, 8, palette.ink);
drawPixelText(ctx, exhibit.title, 32, 112, 11, palette.ink);
ctx.fillStyle = "rgba(255,255,255,0.25)";
ctx.fillRect(32, 224, 576, 2);
drawPixelText(ctx, "FORM / 04", 32, 252, 4, palette.ink);
const shape = activeCue === "auto" ? exhibit.shape : activeCue;
drawShape(ctx, shape, 438, 83, 14, palette.accent);
ctx.fillStyle = palette.accent;
ctx.fillRect(554, 36, 52, 8);
ctx.fillRect(554, 53, 31, 8);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
function buildCubeArt(root) {
const palette = [materials.yellow, materials.gold, materials.coral, materials.cream];
for (let x = -1; x <= 1; x++) {
for (let z = -1; z <= 1; z++) {
const index = (x + 1) * 3 + z + 1;
addBox(
root,
x * 0.5,
0.25,
z * 0.5,
0.47,
0.47,
0.47,
palette[index % palette.length]
);
}
}
for (let x = -1; x <= 1; x++) {
for (let z = -1; z <= 1; z++) {
if (x === 0 && z === 0) continue;
addBox(
root,
x * 0.5,
0.74,
z * 0.5,
0.47,
0.47,
0.47,
palette[(x * 2 + z + 5) % palette.length]
);
}
}
addBox(root, 0, 1.23, 0, 0.47, 0.47, 0.47, materials.coral);
addBox(root, 0.72, 1.24, 0.46, 0.34, 0.34, 0.34, materials.cream);
}
function buildArchArt(root) {
for (let level = 0; level < 3; level++) {
addBox(root, -0.82, level * 0.39 + 0.2, 0, 0.37, 0.37, 0.55, materials.blue);
addBox(root, 0.82, level * 0.39 + 0.2, 0, 0.37, 0.37, 0.55, materials.blue);
}
[-0.41, 0, 0.41].forEach((x, index) => {
addBox(root, x, 1.37, 0, 0.37, 0.37, 0.55, index === 1 ? materials.cyan : materials.blue);
});
addBox(root, 0, 1.76, 0, 0.37, 0.37, 0.55, materials.cyan);
addBox(root, -1.23, 0.58, -0.2, 0.28, 0.28, 0.28, materials.yellow);
addBox(root, 1.23, 0.58, -0.2, 0.28, 0.28, 0.28, materials.yellow);
}
function buildOrbitArt(root) {
const orbitColors = [materials.coral, materials.pink, materials.red, materials.cream];
for (let x = -2; x <= 2; x++) {
for (let y = -2; y <= 2; y++) {
for (let z = -2; z <= 2; z++) {
const distance = Math.sqrt(x * x + y * y + z * z);
if (distance > 2.35 || distance < 1.35) continue;
const index = Math.abs(x * 3 + y * 5 + z * 7);
addBox(
root,
x * 0.3,
y * 0.3 + 1.45,
z * 0.3,
0.27,
0.27,
0.27,
orbitColors[index % orbitColors.length]
);
}
}
}
}
function buildStairArt(root) {
for (let i = 0; i < 7; i++) {
const height = i + 1;
const x = (i - 3) * 0.31;
for (let level = 0; level < height; level++) {
addBox(
root,
x,
level * 0.29 + 0.15,
0,
0.27,
0.27,
0.59,
i % 2 === 0 ? materials.green : materials.lime
);
}
}
addBox(root, 0.95, 2.25, -0.05, 0.27, 0.27, 0.38, materials.black);
addBox(root, 1.26, 2.54, -0.05, 0.27, 0.27, 0.38, materials.black);
}
function markExhibit(object, id) {
object.traverse((child) => {
if (child.isMesh) child.userData.exhibitId = id;
});
}
exhibits.forEach((exhibit) => {
addBox(scene, exhibit.x, 0.16, exhibit.z, 3.55, 0.32, 3.75, materials.plinth);
addBox(scene, exhibit.x, 0.16, exhibit.z + 1.87, 3.55, 0.28, 0.09, exhibit.accent);
addBox(scene, exhibit.x, 0.33, exhibit.z - 1.84, 3.4, 0.025, 0.055, materials.plinthSide, false);
const art = new THREE.Group();
art.position.set(exhibit.x, 0.33, exhibit.z + 0.28);
scene.add(art);
if (exhibit.id === "cube") buildCubeArt(art);
if (exhibit.id === "arch") buildArchArt(art);
if (exhibit.id === "orbit") buildOrbitArt(art);
if (exhibit.id === "stairs") buildStairArt(art);
markExhibit(art, exhibit.id);
const sign = new THREE.Group();
sign.position.set(exhibit.x, 0, exhibit.z - 1.72);
scene.add(sign);
addBox(sign, 0, 1.12, 0, 0.12, 2.24, 0.12, materials.charcoal);
addBox(sign, 0, 0.12, 0, 0.52, 0.24, 0.42, materials.plinthSide);
const borderMaterial = material(palettes.studio.accent);
const border = addBox(sign, 0, 2.38, 0, 2.88, 1.48, 0.14, borderMaterial);
const panelMaterial = material(palettes.studio.panel, {
roughness: 0.82,
map: createSignTexture(exhibit, palettes.studio)
});
const panel = addBox(sign, 0, 2.38, 0.065, 2.72, 1.32, 0.16, panelMaterial);
const texture = new THREE.CanvasTexture(document.createElement("canvas"));
texture.dispose();
panelMaterial.map = createSignTexture(exhibit, palettes.studio);
signBorders.push(border);
signPanels.push(panel);
signTextures.push(panelMaterial.map);
});
// Selection frame around the current work.
const selectionMaterial = new THREE.MeshBasicMaterial({
color: palettes.studio.accent,
transparent: true,
opacity: 0.88
});
const selectionFrame = new THREE.Group();
addBox(selectionFrame, -1.92, 0, 0, 0.035, 0.035, 4.05, selectionMaterial, false);
addBox(selectionFrame, 1.92, 0, 0, 0.035, 0.035, 4.05, selectionMaterial, false);
addBox(selectionFrame, 0, 0, -2.02, 3.87, 0.035, 0.035, selectionMaterial, false);
addBox(selectionFrame, 0, 0, 2.02, 3.87, 0.035, 0.035, selectionMaterial, false);
scene.add(selectionFrame);
let selectedId = "cube";
function selectExhibit(id) {
const exhibit = exhibits.find((item) => item.id === id);
if (!exhibit) return;
selectedId = id;
selectionFrame.position.set(exhibit.x, 0.355, exhibit.z);
document.querySelectorAll(".work-button").forEach((button) => {
const active = button.dataset.work === id;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
document.getElementById("selected-number").textContent =
`${exhibit.number} / ${String(exhibits.length).padStart(2, "0")}`;
document.getElementById("selected-title").textContent = exhibit.fullTitle;
document.getElementById("selected-description").textContent = exhibit.description;
document.getElementById("selected-material").textContent = exhibit.material;
document.getElementById("selected-dimensions").textContent = exhibit.dimensions;
}
function updateSignSystem() {
const palette = palettes[activePalette];
document.documentElement.style.setProperty("--accent", palette.accent);
selectionMaterial.color.set(palette.accent);
signPanels.forEach((panel, index) => {
const oldTexture = panel.material.map;
const newTexture = createSignTexture(exhibits[index], palette);
panel.material.map = newTexture;
panel.material.color.set(0xffffff);
panel.material.needsUpdate = true;
if (oldTexture) oldTexture.dispose();
});
signBorders.forEach((border) => border.material.color.set(palette.accent));
}
document.querySelectorAll(".palette-button").forEach((button) => {
button.addEventListener("click", () => {
activePalette = button.dataset.palette;
document.querySelectorAll(".palette-button").forEach((item) => {
const active = item === button;
item.classList.toggle("active", active);
item.setAttribute("aria-pressed", String(active));
});
updateSignSystem();
});
});
document.querySelectorAll(".cue-button").forEach((button) => {
button.addEventListener("click", () => {
activeCue = button.dataset.cue;
document.querySelectorAll(".cue-button").forEach((item) => {
const active = item === button;
item.classList.toggle("active", active);
item.setAttribute("aria-pressed", String(active));
});
updateSignSystem();
});
});
document.querySelectorAll(".work-button").forEach((button) => {
button.addEventListener("click", () => selectExhibit(button.dataset.work));
});
// Custom camera controls, implemented without Three.js addons.
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const pressedKeys = new Set();
let dragging = false;
let pointerMoved = false;
let pointerStartX = 0;
let pointerStartY = 0;
let lastPointerX = 0;
let lastPointerY = 0;
function updatePointer(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function exhibitFromIntersection(intersection) {
let object = intersection.object;
while (object) {
if (object.userData.exhibitId) return object.userData.exhibitId;
object = object.parent;
}
return null;
}
function pickExhibit(event) {
updatePointer(event);
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(scene.children, true);
for (const intersection of intersections) {
const id = exhibitFromIntersection(intersection);
if (id) {
selectExhibit(id);
break;
}
}
}
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
pointerMoved = false;
pointerStartX = event.clientX;
pointerStartY = event.clientY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (dragging) {
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
if (
Math.abs(event.clientX - pointerStartX) +
Math.abs(event.clientY - pointerStartY) >
5
) {
pointerMoved = true;
}
desiredTheta -= dx * 0.0055;
desiredPhi = THREE.MathUtils.clamp(desiredPhi - dy * 0.0045, 0.62, 1.35);
lastPointerX = event.clientX;
lastPointerY = event.clientY;
} else {
updatePointer(event);
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(scene.children, true);
const overExhibit = intersections.some((hit) => exhibitFromIntersection(hit));
renderer.domElement.style.cursor = overExhibit ? "pointer" : "grab";
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!dragging) return;
dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
renderer.domElement.style.cursor = "grab";
if (!pointerMoved) pickExhibit(event);
});
renderer.domElement.addEventListener("pointercancel", () => {
dragging = false;
renderer.domElement.style.cursor = "grab";
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desiredZoom = THREE.MathUtils.clamp(
desiredZoom + event.deltaY * 0.00065,
0.67,
1.32
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
function resetCamera() {
desiredTarget.set(0, 1.25, -0.7);
desiredTheta = 0.28;
desiredPhi = 1.03;
desiredZoom = 1;
}
document.getElementById("orbit-left").addEventListener("click", () => {
desiredTheta -= 0.28;
});
document.getElementById("orbit-right").addEventListener("click", () => {
desiredTheta += 0.28;
});
document.getElementById("zoom-in").addEventListener("click", () => {
desiredZoom = THREE.MathUtils.clamp(desiredZoom - 0.1, 0.67, 1.32);
});
document.getElementById("zoom-out").addEventListener("click", () => {
desiredZoom = THREE.MathUtils.clamp(desiredZoom + 0.1, 0.67, 1.32);
});
document.getElementById("reset-view").addEventListener("click", resetCamera);
window.addEventListener("keydown", (event) => {
if (["INPUT", "TEXTAREA", "SELECT"].includes(document.activeElement?.tagName)) return;
pressedKeys.add(event.code);
if (event.code === "KeyR") resetCamera();
if (event.code === "ArrowLeft") desiredTheta -= 0.12;
if (event.code === "ArrowRight") desiredTheta += 0.12;
if (event.code === "ArrowUp") desiredZoom = Math.max(0.67, desiredZoom - 0.06);
if (event.code === "ArrowDown") desiredZoom = Math.min(1.32, desiredZoom + 0.06);
if (["KeyW", "KeyA", "KeyS", "KeyD", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(event.code)) {
event.preventDefault();
}
});
window.addEventListener("keyup", (event) => {
pressedKeys.delete(event.code);
});
window.addEventListener("blur", () => pressedKeys.clear());
function resize() {
const width = stage.clientWidth;
const height = stage.clientHeight;
if (!width || !height) return;
renderer.setSize(width, height, false);
const aspect = width / height;
const fitHeight = Math.max(14.5, 29.5 / aspect);
const viewHeight = fitHeight * zoom;
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(stage);
resize();
function updateCamera() {
const sinPhi = Math.sin(phi);
cameraOffset.set(
30 * sinPhi * Math.sin(theta),
30 * Math.cos(phi),
30 * sinPhi * Math.cos(theta)
);
camera.position.copy(target).add(cameraOffset);
camera.lookAt(target);
}
let previousTime = performance.now();
function animate(time) {
const dt = Math.min((time - previousTime) / 1000, 0.05);
previousTime = time;
const speed = dt * 5.5;
forward.set(-Math.sin(theta), 0, -Math.cos(theta)).normalize();
right.set(Math.cos(theta), 0, -Math.sin(theta)).normalize();
if (pressedKeys.has("KeyW")) desiredTarget.addScaledVector(forward, speed);
if (pressedKeys.has("KeyS")) desiredTarget.addScaledVector(forward, -speed);
if (pressedKeys.has("KeyD")) desiredTarget.addScaledVector(right, speed);
if (pressedKeys.has("KeyA")) desiredTarget.addScaledVector(right, -speed);
desiredTarget.x = THREE.MathUtils.clamp(desiredTarget.x, -7.5, 7.5);
desiredTarget.z = THREE.MathUtils.clamp(desiredTarget.z, -5.5, 5.5);
desiredTarget.y = 1.25;
const damping = 1 - Math.exp(-dt * 10);
theta += (desiredTheta - theta) * damping;
phi += (desiredPhi - phi) * damping;
zoom += (desiredZoom - zoom) * damping;
target.lerp(desiredTarget, damping);
const previousLeft = camera.left;
const previousRight = camera.right;
const previousTop = camera.top;
const previousBottom = camera.bottom;
const width = stage.clientWidth;
const height = stage.clientHeight;
const aspect = width / height;
const fitHeight = Math.max(14.5, 29.5 / aspect);
const viewHeight = fitHeight * zoom;
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
if (
Math.abs(camera.left - previousLeft) > 0.0001 ||
Math.abs(camera.right - previousRight) > 0.0001 ||
Math.abs(camera.top - previousTop) > 0.0001 ||
Math.abs(camera.bottom - previousBottom) > 0.0001
) {
camera.updateProjectionMatrix();
}
updateCamera();
selectionMaterial.opacity = 0.76 + Math.sin(time * 0.0024) * 0.12;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
selectExhibit("cube");
updateSignSystem();
requestAnimationFrame(animate);
</script>
</body>
</html>
```