Prompt specification
Build or customize the Three.js 3D scene "Ceremony seating and aisle model" 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: Ceremony seating and aisle model
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/ceremony-seating-and-aisle-model-x3917
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring a small seating arrangement around a central aisle with place markers and floral stands; make the route from entrance to ceremony position continuous and visible. Voxel style.
Working Three.js Starter (ceremony-seating-and-aisle-model-x3917):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Voxel Vow — Ceremony Route</title>
<style>
:root {
color-scheme: light;
--ink: #44353e;
--muted: #786b72;
--paper: rgba(255, 251, 245, 0.88);
--paper-strong: #fffaf2;
--rose: #b85d68;
--rose-dark: #8f414e;
--gold: #d7ad62;
--line: rgba(91, 65, 76, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eee6dc;
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--ink);
}
button {
font: inherit;
}
#app {
position: fixed;
inset: 0;
}
#app canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#app canvas:active {
cursor: grabbing;
}
.ui {
position: fixed;
inset: 0;
z-index: 10;
pointer-events: none;
}
.topbar {
position: absolute;
top: 22px;
left: 24px;
right: 24px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
padding: 12px 15px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--paper);
box-shadow: 0 10px 35px rgba(67, 47, 57, 0.09);
backdrop-filter: blur(12px);
}
.brand-mark {
width: 35px;
height: 35px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 2px;
transform: rotate(-4deg);
}
.brand-mark i {
display: block;
background: var(--rose);
border-radius: 2px;
}
.brand-mark i:nth-child(2),
.brand-mark i:nth-child(4),
.brand-mark i:nth-child(8) {
background: var(--gold);
}
.brand-mark i:nth-child(3),
.brand-mark i:nth-child(6),
.brand-mark i:nth-child(9) {
opacity: 0.28;
}
.brand h1 {
margin: 0;
font-size: 14px;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.brand p {
margin: 3px 0 0;
color: var(--muted);
font-size: 11px;
letter-spacing: 0.05em;
}
.controls {
pointer-events: auto;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
max-width: 540px;
padding: 7px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--paper);
box-shadow: 0 10px 35px rgba(67, 47, 57, 0.09);
backdrop-filter: blur(12px);
}
.controls button {
appearance: none;
border: 1px solid transparent;
border-radius: 9px;
padding: 9px 11px;
color: var(--muted);
background: transparent;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
cursor: pointer;
transition:
color 160ms ease,
background 160ms ease,
transform 160ms ease;
}
.controls button:hover {
color: var(--ink);
background: rgba(184, 93, 104, 0.09);
}
.controls button:active {
transform: translateY(1px);
}
.controls button.active {
color: var(--paper-strong);
background: var(--rose);
}
.controls button.follow {
color: var(--rose-dark);
border-color: rgba(184, 93, 104, 0.22);
}
.controls button.follow.active {
color: white;
background: var(--rose-dark);
}
.legend {
position: absolute;
left: 24px;
bottom: 24px;
width: min(290px, calc(100vw - 48px));
padding: 15px 16px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--paper);
box-shadow: 0 10px 35px rgba(67, 47, 57, 0.09);
backdrop-filter: blur(12px);
}
.legend-title {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.legend-title strong {
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
#view-label {
color: var(--rose-dark);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.route-line {
position: relative;
height: 8px;
overflow: hidden;
border-radius: 2px;
background: var(--rose);
box-shadow: inset 0 0 0 1px rgba(91, 65, 76, 0.08);
}
.route-line::after {
content: "";
position: absolute;
inset: 0;
background:
linear-gradient(
90deg,
transparent 0 15%,
rgba(255, 255, 255, 0.3) 15% 17%,
transparent 17% 48%,
rgba(255, 255, 255, 0.3) 48% 50%,
transparent 50% 82%,
rgba(255, 255, 255, 0.3) 82% 84%,
transparent 84%
);
}
.legend-labels {
display: flex;
justify-content: space-between;
margin-top: 7px;
color: var(--muted);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.hint {
position: absolute;
right: 24px;
bottom: 25px;
padding: 9px 12px;
border-radius: 10px;
color: var(--muted);
background: rgba(255, 251, 245, 0.72);
font-size: 10px;
letter-spacing: 0.04em;
backdrop-filter: blur(8px);
}
@media (max-width: 820px) {
.topbar {
top: 12px;
left: 12px;
right: 12px;
flex-direction: column;
gap: 8px;
}
.brand {
padding: 9px 11px;
}
.brand-mark {
width: 29px;
height: 29px;
}
.controls {
justify-content: flex-start;
max-width: 100%;
overflow-x: auto;
flex-wrap: nowrap;
}
.controls button {
white-space: nowrap;
padding: 8px 10px;
}
.legend {
left: 12px;
bottom: 12px;
width: 245px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<div id="app" aria-label="Interactive voxel wedding ceremony scene"></div>
<div class="ui">
<div class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<i></i><i></i><i></i>
<i></i><i></i><i></i>
<i></i><i></i><i></i>
</div>
<div>
<h1>Voxel Vow</h1>
<p>Ceremony route / 18 reserved places</p>
</div>
</div>
<nav class="controls" aria-label="Camera controls">
<button type="button" data-view="overview" class="active">Overview</button>
<button type="button" data-view="entrance">Entrance</button>
<button type="button" data-view="aisle">Aisle</button>
<button type="button" data-view="ceremony">Ceremony</button>
<button type="button" id="follow-route" class="follow">Follow route</button>
</nav>
</div>
<div class="legend">
<div class="legend-title">
<strong>Continuous aisle</strong>
<span id="view-label">Overview</span>
</div>
<div class="route-line" aria-hidden="true"></div>
<div class="legend-labels">
<span>Entrance</span>
<span>Ceremony position</span>
</div>
</div>
<div class="hint">Drag to orbit · Shift-drag to pan · Wheel to zoom</div>
</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 app = document.getElementById("app");
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.12;
app.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee6dc);
const camera = new THREE.OrthographicCamera(
-1, 1, 1, -1, 0.1, 150
);
const hemisphere = new THREE.HemisphereLight(0xfff8ec, 0x776d7b, 2.0);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff0dd, 3.2);
keyLight.position.set(-11, 21, 14);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -25;
keyLight.shadow.camera.right = 25;
keyLight.shadow.camera.top = 25;
keyLight.shadow.camera.bottom = -25;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 65;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xd8e5ff, 1.15);
fillLight.position.set(14, 10, -12);
scene.add(fillLight);
// -------------------------------------------------------------------------
// Materials and voxel construction helpers
// -------------------------------------------------------------------------
function standard(color, roughness = 0.82) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness: 0
});
}
const materials = {
base: standard(0x8d625d),
floor: standard(0xf1e8da),
floorEdge: standard(0xdac9b8),
runner: standard(0xa94f5d),
runnerAlt: standard(0xba616c),
runnerBorder: standard(0xe2bd73),
navy: standard(0x465767),
navyLight: standard(0x5b6c79),
blush: standard(0xdca4a2),
cream: standard(0xfff4df),
gold: standard(0xd4aa61, 0.65),
wood: standard(0x795247),
pot: standard(0x9a7770),
leaf: standard(0x5e8065),
leafLight: standard(0x88a77d),
flowerRose: standard(0xd97582),
flowerLight: standard(0xf2b5b5),
flowerCream: standard(0xffe7c7),
flowerPurple: standard(0xa982a6),
darkFlower: standard(0x914b61),
stone: standard(0xc9bbb0),
shadow: new THREE.ShadowMaterial({ opacity: 0.18 })
};
function box(parent, size, position, material, castShadow = true) {
const geometry = new THREE.BoxGeometry(size[0], size[1], size[2]);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function textTexture(text, background = "#fff4df", foreground = "#493840") {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 144;
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = background;
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = "rgba(73,56,64,0.20)";
context.lineWidth = 8;
context.strokeRect(4, 4, canvas.width - 8, canvas.height - 8);
let fontSize = 50;
context.font = `700 ${fontSize}px system-ui, sans-serif`;
const measured = context.measureText(text).width;
if (measured > canvas.width - 44) {
fontSize = Math.max(25, fontSize * (canvas.width - 44) / measured);
context.font = `700 ${fontSize}px system-ui, sans-serif`;
}
context.fillStyle = foreground;
context.textAlign = "center";
context.textBaseline = "middle";
context.fillText(text, canvas.width / 2, canvas.height / 2 + 2);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function labelPlane(parent, text, size, position, options = {}) {
const texture = textTexture(
text,
options.background ?? "#fff4df",
options.foreground ?? "#493840"
);
const material = new THREE.MeshBasicMaterial({
map: texture,
side: THREE.DoubleSide,
transparent: true
});
const plane = new THREE.Mesh(
new THREE.PlaneGeometry(size[0], size[1]),
material
);
plane.position.set(position[0], position[1], position[2]);
parent.add(plane);
return plane;
}
// -------------------------------------------------------------------------
// Diorama base and shadow catcher
// -------------------------------------------------------------------------
const shadowCatcher = new THREE.Mesh(
new THREE.PlaneGeometry(160, 160),
materials.shadow
);
shadowCatcher.rotation.x = -Math.PI / 2;
shadowCatcher.position.y = -0.77;
shadowCatcher.receiveShadow = true;
scene.add(shadowCatcher);
box(
scene,
[18.1, 0.66, 27.1],
[0, -0.43, 0],
materials.base
);
box(
scene,
[17.7, 0.2, 26.7],
[0, -0.01, 0],
materials.floor
);
// A subtle voxel perimeter.
box(scene, [17.75, 0.08, 0.16], [0, 0.11, -13.18], materials.floorEdge);
box(scene, [17.75, 0.08, 0.16], [0, 0.11, 13.18], materials.floorEdge);
box(scene, [0.16, 0.08, 26.5], [-8.79, 0.11, 0], materials.floorEdge);
box(scene, [0.16, 0.08, 26.5], [8.79, 0.11, 0], materials.floorEdge);
// -------------------------------------------------------------------------
// Continuous central route
// -------------------------------------------------------------------------
const route = new THREE.Group();
scene.add(route);
// The solid base makes the route physically continuous.
box(route, [3.2, 0.13, 20.7], [0, 0.17, 0], materials.runner);
box(route, [0.14, 0.16, 20.7], [-1.67, 0.18, 0], materials.runnerBorder);
box(route, [0.14, 0.16, 20.7], [1.67, 0.18, 0], materials.runnerBorder);
// Inset alternating voxel panels sit on the continuous runner.
const tileCount = 16;
const tileLength = 1.24;
const tileStart = 9.35;
for (let i = 0; i < tileCount; i++) {
const z = tileStart - i * tileLength;
box(
route,
[2.95, 0.055, 1.18],
[0, 0.267, z],
i % 2 === 0 ? materials.runnerAlt : materials.runner
);
}
// Small square stepping markers point toward the ceremony.
function routeArrow(z) {
const arrow = new THREE.Group();
arrow.position.set(0, 0.33, z);
scene.add(arrow);
box(arrow, [0.16, 0.055, 0.60], [0, 0, 0.13], materials.gold);
box(arrow, [0.18, 0.055, 0.18], [-0.14, 0, -0.22], materials.gold);
box(arrow, [0.18, 0.055, 0.18], [0, 0, -0.34], materials.gold);
box(arrow, [0.18, 0.055, 0.18], [0.14, 0, -0.22], materials.gold);
}
[8.0, 4.3, 0.6, -3.1, -6.8].forEach(routeArrow);
// -------------------------------------------------------------------------
// Guest chairs with place markers
// -------------------------------------------------------------------------
function makeChair(x, z, marker = "", ceremonial = false) {
const chair = new THREE.Group();
chair.position.set(x, 0, z);
chair.rotation.y = ceremonial ? Math.PI : 0;
scene.add(chair);
const frame = ceremonial ? materials.gold : materials.wood;
const upholstery = ceremonial ? materials.cream : materials.navy;
// Four block legs.
for (const legX of [-0.45, 0.45]) {
for (const legZ of [-0.38, 0.38]) {
box(
chair,
[0.14, 0.88, 0.14],
[legX, 0.53, legZ],
frame
);
}
}
// Seat and cushion.
box(chair, [1.17, 0.18, 1.08], [0, 1.05, 0], upholstery);
box(
chair,
[1.00, 0.11, 0.88],
[0, 1.18, -0.02],
ceremonial ? materials.gold : materials.blush
);
// Back and rear posts.
box(chair, [1.17, 1.06, 0.17], [0, 1.67, 0.49], upholstery);
box(
chair,
[0.96, 0.73, 0.07],
[0, 1.69, 0.385],
ceremonial ? materials.cream : materials.blush
);
// Simple square armrests.
for (const armX of [-0.64, 0.64]) {
box(chair, [0.12, 0.12, 1.02], [armX, 1.61, 0.03], frame);
box(chair, [0.12, 0.57, 0.12], [armX, 1.32, 0.43], frame);
}
// A readable place-marker card on the rear of each chair.
if (marker) {
box(chair, [1.03, 0.40, 0.045], [0, 1.69, 0.598], materials.cream);
labelPlane(
chair,
marker,
[0.96, 0.33],
[0, 1.69, 0.624],
{
background: "#fff4df",
foreground: "#59404b"
}
);
}
return chair;
}
const leftNames = [
"MAYA", "ELIAS", "NORA",
"JAMES", "ZOE", "LEO",
"AMARA", "FINN", "CLARA"
];
const rightNames = [
"BEN", "LUCY", "OWEN",
"IVY", "MILO", "ROSE",
"THEO", "ALMA", "HUGO"
];
const chairRows = [5.7, 2.4, -0.9];
const chairColumns = [2.65, 4.25, 5.85];
for (let row = 0; row < chairRows.length; row++) {
for (let column = 0; column < chairColumns.length; column++) {
const number = row * 3 + column + 1;
makeChair(
-chairColumns[column],
chairRows[row],
`A${number} ${leftNames[number - 1]}`
);
makeChair(
chairColumns[column],
chairRows[row],
`B${number} ${rightNames[number - 1]}`
);
}
}
// -------------------------------------------------------------------------
// Floral stands and flower clusters
// -------------------------------------------------------------------------
const flowerMaterials = [
materials.flowerRose,
materials.flowerLight,
materials.flowerCream,
materials.flowerPurple,
materials.darkFlower
];
function flowerCluster(parent, x, y, z, scale = 1) {
const cluster = new THREE.Group();
cluster.position.set(x, y, z);
cluster.scale.setScalar(scale);
parent.add(cluster);
const blooms = [
[-0.34, 0.02, 0.02, 0.30, materials.leaf],
[0.31, 0.08, 0.04, 0.31, materials.leafLight],
[-0.08, 0.22, -0.12, 0.34, materials.flowerRose],
[0.20, 0.23, -0.05, 0.30, materials.flowerCream],
[-0.25, 0.22, 0.18, 0.28, materials.flowerLight],
[0.06, 0.04, 0.26, 0.31, materials.flowerPurple],
[0.34, -0.03, 0.18, 0.27, materials.flowerRose],
[-0.06, -0.05, 0.05, 0.28, materials.darkFlower],
[0.08, 0.40, 0.02, 0.28, materials.flowerCream],
[-0.29, 0.42, -0.05, 0.25, materials.flowerPurple]
];
blooms.forEach((bloom, index) => {
box(
cluster,
[bloom[3], bloom[3], bloom[3]],
[bloom[0], bloom[1], bloom[2]],
bloom[4]
);
if (index % 3 === 0) {
box(
cluster,
[0.08, 0.33, 0.08],
[bloom[0], bloom[1] - 0.22, bloom[2]],
materials.leaf
);
}
});
}
function floralStand(x, z, variant = 0) {
const stand = new THREE.Group();
stand.position.set(x, 0, z);
scene.add(stand);
box(stand, [0.76, 0.18, 0.76], [0, 0.18, 0], materials.pot);
box(stand, [0.42, 1.22, 0.42], [0, 0.86, 0], materials.stone);
box(stand, [0.76, 0.16, 0.76], [0, 1.50, 0], materials.gold);
const cluster = new THREE.Group();
cluster.position.set(0, 1.82, 0);
stand.add(cluster);
const bloomOffsets = [
[-0.24, 0.00, 0.03],
[0.23, 0.07, -0.04],
[0.00, 0.24, 0.02],
[-0.08, -0.08, -0.12]
];
bloomOffsets.forEach((offset, index) => {
const material = flowerMaterials[(index + variant) % flowerMaterials.length];
box(cluster, [0.38, 0.38, 0.38], offset, material);
});
box(cluster, [0.14, 0.47, 0.14], [-0.24, 0.20, 0.03], materials.leaf);
box(cluster, [0.14, 0.47, 0.14], [0.23, 0.28, -0.04], materials.leafLight);
box(cluster, [0.12, 0.57, 0.12], [0.00, 0.42, 0.02], materials.leaf);
}
const standPositions = [7.65, 4.05, 0.75, -3.55, -6.85];
standPositions.forEach((z, index) => {
floralStand(-2.05, z, index);
floralStand(2.05, z, index + 2);
});
// -------------------------------------------------------------------------
// Entrance arch
// -------------------------------------------------------------------------
const entrance = new THREE.Group();
entrance.position.z = 10.82;
scene.add(entrance);
box(entrance, [0.42, 3.55, 0.42], [-2.04, 1.87, 0], materials.gold);
box(entrance, [0.42, 3.55, 0.42], [2.04, 1.87, 0], materials.gold);
box(entrance, [4.55, 0.38, 0.42], [0, 3.49, 0], materials.gold);
box(entrance, [3.60, 0.20, 0.42], [0, 3.82, 0], materials.cream);
box(entrance, [0.42, 0.55, 0.42], [-2.04, 3.77, 0], materials.gold);
box(entrance, [0.42, 0.55, 0.42], [2.04, 3.77, 0], materials.gold);
box(entrance, [2.85, 0.69, 0.12], [0, 3.46, 0.27], materials.cream);
labelPlane(
entrance,
"ENTRANCE",
[2.72, 0.59],
[0, 3.46, 0.336],
{ background: "#fff4df", foreground: "#8f414e" }
);
box(entrance, [4.20, 0.12, 1.15], [0, 0.15, -0.47], materials.runner);
flowerCluster(entrance, -1.78, 3.73, 0.28, 0.55);
flowerCluster(entrance, 1.78, 3.73, 0.28, 0.55);
// -------------------------------------------------------------------------
// Ceremony platform, position, chairs, and arch
// -------------------------------------------------------------------------
const ceremony = new THREE.Group();
scene.add(ceremony);
box(ceremony, [7.50, 0.36, 2.75], [0, 0.27, -10.00], materials.cream);
box(ceremony, [7.70, 0.12, 2.92], [0, 0.08, -10.00], materials.gold);
box(ceremony, [4.20, 0.16, 0.58], [0, 0.20, -8.42], materials.cream);
// The gold square is the final ceremony position at the end of the aisle.
box(ceremony, [1.28, 0.075, 1.28], [0, 0.49, -9.18], materials.gold);
box(ceremony, [1.02, 0.035, 1.02], [0, 0.55, -9.18], materials.runnerAlt);
const ceremonialLeft = makeChair(-1.18, -10.30, "", true);
const ceremonialRight = makeChair(1.18, -10.30, "", true);
flowerCluster(ceremonialLeft, 0, 2.22, -0.48, 0.45);
flowerCluster(ceremonialRight, 0, 2.22, -0.48, 0.45);
const ceremonyArch = new THREE.Group();
ceremonyArch.position.z = -11.14;
ceremony.add(ceremonyArch);
box(ceremonyArch, [0.42, 3.90, 0.42], [-2.48, 2.03, 0], materials.gold);
box(ceremonyArch, [0.42, 3.90, 0.42], [2.48, 2.03, 0], materials.gold);
box(ceremonyArch, [5.42, 0.38, 0.42], [0, 3.84, 0], materials.gold);
box(ceremonyArch, [4.28, 0.20, 0.42], [0, 4.17, 0], materials.cream);
box(ceremonyArch, [0.42, 0.55, 0.42], [-2.48, 4.12, 0], materials.gold);
box(ceremonyArch, [0.42, 0.55, 0.42], [2.48, 4.12, 0], materials.gold);
box(ceremonyArch, [2.90, 0.69, 0.12], [0, 3.83, 0.27], materials.cream);
labelPlane(
ceremonyArch,
"CEREMONY",
[2.77, 0.59],
[0, 3.83, 0.336],
{ background: "#fff4df", foreground: "#8f414e" }
);
flowerCluster(ceremonyArch, -2.22, 4.12, 0.28, 0.58);
flowerCluster(ceremonyArch, 2.22, 4.12, 0.28, 0.58);
// -------------------------------------------------------------------------
// Voxel topiary and scattered petals
// -------------------------------------------------------------------------
function topiary(x, z, index) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
box(group, [1.16, 0.52, 1.16], [0, 0.34, 0], materials.pot);
box(group, [0.31, 1.25, 0.31], [0, 1.18, 0], materials.wood);
box(group, [1.62, 0.76, 1.62], [0, 2.00, 0], materials.leaf);
box(group, [1.30, 0.68, 1.30], [0, 2.65, 0], materials.leafLight);
box(group, [0.88, 0.58, 0.88], [0, 3.22, 0], materials.leaf);
if (index % 2 === 0) {
box(group, [0.22, 0.22, 0.22], [0.44, 2.72, 0.50], materials.flowerLight);
box(group, [0.20, 0.20, 0.20], [-0.47, 2.15, 0.49], materials.flowerRose);
}
}
topiary(-7.65, -11.80, 0);
topiary(7.65, -11.80, 1);
topiary(-7.65, 11.80, 2);
topiary(7.65, 11.80, 3);
const petalMaterials = [
materials.flowerRose,
materials.flowerLight,
materials.flowerCream,
materials.gold
];
for (let i = 0; i < 44; i++) {
const angle = i * 2.39996;
const radius = 5.7 + (i % 7) * 0.48;
const x = Math.cos(angle) * radius;
const z = Math.sin(angle) * radius * 1.08;
if (Math.abs(x) < 2.0) continue;
const size = 0.10 + (i % 3) * 0.025;
const petal = box(
scene,
[size, 0.035, size],
[x, 0.13, z],
petalMaterials[i % petalMaterials.length],
false
);
petal.rotation.y = angle;
}
// -------------------------------------------------------------------------
// Custom orthographic camera controls
// -------------------------------------------------------------------------
const cameraState = {
target: new THREE.Vector3(0, 0.4, -0.4),
goalTarget: new THREE.Vector3(0, 0.4, -0.4),
theta: 0.48,
goalTheta: 0.48,
polar: 0.93,
goalPolar: 0.93,
zoom: 1,
goalZoom: 1
};
const cameraRadius = 38;
const cameraOffset = new THREE.Vector3();
const cameraTarget = new THREE.Vector3();
function updateCameraProjection() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
// The vertical size expands on narrow screens so the diorama remains visible.
const orthoHeight = Math.max(26, 21.5 / aspect);
camera.left = -orthoHeight * aspect / 2;
camera.right = orthoHeight * aspect / 2;
camera.top = orthoHeight / 2;
camera.bottom = -orthoHeight / 2;
camera.updateProjectionMatrix();
}
function updateCamera() {
const sinPolar = Math.sin(cameraState.polar);
cameraOffset.set(
sinPolar * Math.sin(cameraState.theta) * cameraRadius,
Math.cos(cameraState.polar) * cameraRadius,
sinPolar * Math.cos(cameraState.theta) * cameraRadius
);
cameraTarget.copy(cameraState.target);
camera.position.copy(cameraTarget).add(cameraOffset);
camera.lookAt(cameraTarget);
camera.zoom = cameraState.zoom;
camera.updateProjectionMatrix();
}
function setCameraGoal({
target,
theta,
polar,
zoom
}) {
if (target) {
cameraState.goalTarget.copy(target);
}
if (theta !== undefined) cameraState.goalTheta = theta;
if (polar !== undefined) cameraState.goalPolar = polar;
if (zoom !== undefined) cameraState.goalZoom = zoom;
}
const presets = {
overview: {
target: new THREE.Vector3(0, 0.4, -0.4),
theta: 0.48,
polar: 0.93,
zoom: 1
},
entrance: {
target: new THREE.Vector3(0, 0.75, 8.35),
theta: 0.36,
polar: 0.98,
zoom: 1.40
},
aisle: {
target: new THREE.Vector3(0, 0.35, 0),
theta: 0.32,
polar: 0.91,
zoom: 1.48
},
ceremony: {
target: new THREE.Vector3(0, 0.65, -8.35),
theta: 0.38,
polar: 0.98,
zoom: 1.48
}
};
const viewLabel = document.getElementById("view-label");
const followButton = document.getElementById("follow-route");
const viewButtons = [...document.querySelectorAll("[data-view]")];
function markActiveView(name) {
viewButtons.forEach((button) => {
button.classList.toggle("active", button.dataset.view === name);
});
followButton.classList.remove("active");
}
let routeAnimation = null;
function stopRouteAnimation() {
routeAnimation = null;
followButton.classList.remove("active");
}
viewButtons.forEach((button) => {
button.addEventListener("click", () => {
stopRouteAnimation();
const name = button.dataset.view;
setCameraGoal(presets[name]);
markActiveView(name);
viewLabel.textContent = name;
});
});
followButton.addEventListener("click", () => {
if (routeAnimation) {
stopRouteAnimation();
viewLabel.textContent = "Overview";
return;
}
markActiveView("");
followButton.classList.add("active");
viewLabel.textContent = "Following route";
routeAnimation = {
start: performance.now(),
duration: 9000
};
setCameraGoal({
target: new THREE.Vector3(0, 0.38, 8.55),
theta: 0.31,
polar: 0.98,
zoom: 1.42
});
});
// Pointer orbit and shift-drag panning.
let dragging = false;
let panning = false;
let lastPointerX = 0;
let lastPointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
stopRouteAnimation();
dragging = true;
panning = event.shiftKey || event.button === 2;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
if (panning) {
const scale = 0.025 / cameraState.goalZoom;
const horizontal =
Math.cos(cameraState.goalTheta) * dx -
Math.sin(cameraState.goalTheta) * dy;
const depth =
Math.sin(cameraState.goalTheta) * dx +
Math.cos(cameraState.goalTheta) * dy;
cameraState.goalTarget.x -= horizontal * scale;
cameraState.goalTarget.z -= depth * scale;
} else {
cameraState.goalTheta -= dx * 0.006;
cameraState.goalPolar = THREE.MathUtils.clamp(
cameraState.goalPolar - dy * 0.005,
0.38,
1.28
);
}
});
function endPointerDrag(event) {
dragging = false;
panning = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endPointerDrag);
renderer.domElement.addEventListener("pointercancel", endPointerDrag);
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
stopRouteAnimation();
cameraState.goalZoom = THREE.MathUtils.clamp(
cameraState.goalZoom * Math.exp(-event.deltaY * 0.001),
0.68,
2.5
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => {
stopRouteAnimation();
setCameraGoal(presets.overview);
markActiveView("overview");
viewLabel.textContent = "Overview";
});
window.addEventListener("resize", () => {
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
updateCameraProjection();
});
// -------------------------------------------------------------------------
// Animation
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate(now) {
const delta = Math.min(clock.getDelta(), 0.05);
if (routeAnimation) {
const elapsed = now - routeAnimation.start;
const raw = THREE.MathUtils.clamp(
elapsed / routeAnimation.duration,
0,
1
);
const eased = raw * raw * (3 - 2 * raw);
const z = THREE.MathUtils.lerp(8.55, -8.55, eased);
cameraState.goalTarget.set(0, 0.38, z);
cameraState.goalTheta = 0.31;
cameraState.goalPolar = 0.98;
cameraState.goalZoom = 1.42;
if (raw >= 1) {
stopRouteAnimation();
viewLabel.textContent = "Ceremony reached";
}
}
const smoothing = 1 - Math.exp(-delta * 8);
cameraState.target.lerp(
cameraState.goalTarget,
smoothing
);
cameraState.theta = THREE.MathUtils.lerp(
cameraState.theta,
cameraState.goalTheta,
smoothing
);
cameraState.polar = THREE.MathUtils.lerp(
cameraState.polar,
cameraState.goalPolar,
smoothing
);
cameraState.zoom = THREE.MathUtils.lerp(
cameraState.zoom,
cameraState.goalZoom,
smoothing
);
updateCamera();
renderer.render(scene, camera);
}
updateCameraProjection();
updateCamera();
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```