Prompt specification
Build or customize the Three.js 3D scene "Outdoor sketching group scene" 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: Outdoor sketching group scene
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/outdoor-sketching-group-scene-x0591
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows hat-brim shade. Compose a park sketching session with hats, easels, stools, and trees; visitors choose shaded positions while their drawing surfaces remain visible and uncluttered. Stylized solid forms.
Working Three.js Starter (outdoor-sketching-group-scene-x0591):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hat-Brim Shade — Park Sketching Study</title>
<style>
:root {
--ink: #173f35;
--muted: #66766c;
--paper: #f5f0e5;
--sun: #e9ad55;
--accent: #d96b4e;
--line: rgba(23, 63, 53, 0.16);
--shadow: 0 16px 50px rgba(35, 60, 48, 0.15);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dbe7dc;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#app {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.panel {
position: absolute;
z-index: 5;
border: 1px solid rgba(255, 255, 255, 0.64);
background: rgba(245, 240, 229, 0.86);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.intro {
top: 24px;
left: 24px;
width: min(360px, calc(100vw - 48px));
padding: 22px 24px 20px;
border-radius: 22px;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 14px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
content: "";
box-shadow: 0 0 0 5px rgba(217, 107, 78, 0.13);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(38px, 5vw, 58px);
font-weight: 500;
line-height: 0.92;
letter-spacing: -0.045em;
}
.intro p {
max-width: 290px;
margin: 14px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.light-note {
top: 24px;
right: 24px;
display: flex;
align-items: center;
gap: 12px;
padding: 11px 15px;
border-radius: 999px;
pointer-events: none;
}
.sun-icon {
position: relative;
width: 23px;
height: 23px;
border: 2px solid var(--sun);
border-radius: 50%;
}
.sun-icon::after {
position: absolute;
inset: 5px;
border-radius: 50%;
background: var(--sun);
content: "";
}
.light-note strong,
.light-note small {
display: block;
}
.light-note strong {
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.light-note small {
margin-top: 2px;
color: var(--muted);
font-size: 10px;
}
.controls {
right: 24px;
bottom: 24px;
left: 24px;
display: grid;
grid-template-columns: minmax(260px, 0.9fr) minmax(410px, 1.6fr) auto;
align-items: center;
gap: 20px;
min-height: 92px;
padding: 14px 16px 14px 20px;
border-radius: 22px;
}
.controls-copy small {
display: block;
margin-bottom: 5px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.controls-copy strong {
display: block;
max-width: 300px;
font-family: Georgia, "Times New Roman", serif;
font-size: 18px;
font-weight: 500;
line-height: 1.2;
}
.spots {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
}
.spot-button {
position: relative;
min-height: 55px;
padding: 10px 10px 9px 38px;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(255, 255, 255, 0.38);
color: var(--ink);
cursor: pointer;
text-align: left;
transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.spot-button:hover {
transform: translateY(-2px);
border-color: rgba(23, 63, 53, 0.32);
background: rgba(255, 255, 255, 0.7);
}
.spot-button.active {
border-color: var(--ink);
background: var(--ink);
color: var(--paper);
}
.spot-number {
position: absolute;
top: 50%;
left: 10px;
display: grid;
width: 20px;
height: 20px;
place-items: center;
transform: translateY(-50%);
border-radius: 50%;
background: var(--sun);
color: var(--ink);
font-size: 10px;
font-weight: 900;
}
.spot-button strong,
.spot-button small {
display: block;
}
.spot-button strong {
font-size: 11px;
line-height: 1.15;
}
.spot-button small {
margin-top: 4px;
opacity: 0.65;
font-size: 9px;
white-space: nowrap;
}
.view-buttons {
display: flex;
gap: 8px;
}
.view-button {
height: 42px;
padding: 0 14px;
border: 1px solid var(--line);
border-radius: 12px;
background: transparent;
color: var(--ink);
cursor: pointer;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: background 160ms ease, color 160ms ease;
}
.view-button:hover,
.view-button.active {
background: var(--ink);
color: var(--paper);
}
.hint {
position: absolute;
bottom: 132px;
left: 28px;
z-index: 4;
color: rgba(23, 63, 53, 0.72);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
pointer-events: none;
text-transform: uppercase;
}
.spot-marker {
position: absolute;
z-index: 4;
display: grid;
width: 30px;
height: 30px;
padding: 0;
place-items: center;
transform: translate(-50%, -50%);
border: 1px solid rgba(255, 255, 255, 0.85);
border-radius: 50%;
background: rgba(23, 63, 53, 0.86);
box-shadow: 0 5px 15px rgba(23, 63, 53, 0.22);
color: #fff;
cursor: pointer;
font-size: 10px;
font-weight: 900;
transition: opacity 200ms ease, background 200ms ease, transform 200ms ease;
}
.spot-marker:hover,
.spot-marker.active {
background: var(--accent);
transform: translate(-50%, -50%) scale(1.12);
}
body.focused .spot-marker:not(.active) {
opacity: 0;
pointer-events: none;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #dbe7dc;
color: var(--ink);
transition: opacity 500ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.loader {
text-align: center;
}
.loader-mark {
width: 36px;
height: 36px;
margin: 0 auto 12px;
border: 2px solid rgba(23, 63, 53, 0.18);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 900ms linear infinite;
}
.loader span {
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (max-width: 900px) {
.intro {
width: 280px;
padding: 17px 18px;
}
.intro p {
display: none;
}
.controls {
grid-template-columns: 1fr auto;
}
.controls-copy {
display: none;
}
}
@media (max-width: 650px) {
.intro {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 15px 17px;
border-radius: 18px;
}
h1 {
font-size: 38px;
}
.eyebrow {
margin-bottom: 9px;
}
.light-note {
display: none;
}
.controls {
right: 12px;
bottom: 12px;
left: 12px;
display: block;
min-height: 0;
padding: 12px;
border-radius: 18px;
}
.spots {
grid-template-columns: repeat(2, 1fr);
}
.view-buttons {
margin-top: 9px;
}
.view-button {
flex: 1;
}
.hint {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<main id="app" aria-label="Interactive three-dimensional park sketching scene">
<section class="panel intro">
<div class="eyebrow">Field study · No. 04</div>
<h1>Hat-brim<br />shade.</h1>
<p>
A quiet sketching session shaped by the sun. Choose a visitor’s shaded
position, then study how the broad brim keeps their face cool while the
drawing surface stays open and legible.
</p>
</section>
<aside class="panel light-note" aria-label="Lighting information">
<div class="sun-icon" aria-hidden="true"></div>
<div>
<strong>Late morning</strong>
<small>Sun elevation 48° · warm side light</small>
</div>
</aside>
<div class="hint">Drag to orbit · Scroll to zoom · Select a numbered shade</div>
<nav class="panel controls" aria-label="Sketching position controls">
<div class="controls-copy">
<small>Selected position</small>
<strong id="selected-copy">Oak edge — face in shade, canvas in light</strong>
</div>
<div class="spots">
<button class="spot-button active" data-station="0">
<span class="spot-number">01</span>
<strong>Oak edge</strong>
<small>Soft western shade</small>
</button>
<button class="spot-button" data-station="1">
<span class="spot-number">02</span>
<strong>Lime court</strong>
<small>Cool afternoon patch</small>
</button>
<button class="spot-button" data-station="2">
<span class="spot-number">03</span>
<strong>Maple nook</strong>
<small>Filtered canopy light</small>
</button>
<button class="spot-button" data-station="3">
<span class="spot-number">04</span>
<strong>Pine alcove</strong>
<small>Bright drawing plane</small>
</button>
</div>
<div class="view-buttons">
<button id="focus-button" class="view-button active">Focus</button>
<button id="overview-button" class="view-button">Overview</button>
</div>
</nav>
<button class="spot-marker active" data-marker="0" aria-label="Focus Oak edge">01</button>
<button class="spot-marker" data-marker="1" aria-label="Focus Lime court">02</button>
<button class="spot-marker" data-marker="2" aria-label="Focus Maple nook">03</button>
<button class="spot-marker" data-marker="3" aria-label="Focus Pine alcove">04</button>
</main>
<div id="loading">
<div class="loader">
<div class="loader-mark"></div>
<span>Preparing the park</span>
</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const app = document.querySelector("#app");
const loading = document.querySelector("#loading");
const spotButtons = [...document.querySelectorAll(".spot-button")];
const markers = [...document.querySelectorAll(".spot-marker")];
const selectedCopy = document.querySelector("#selected-copy");
const focusButton = document.querySelector("#focus-button");
const overviewButton = document.querySelector("#overview-button");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdbe7dc);
scene.fog = new THREE.Fog(0xdbe7dc, 19, 36);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
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.08;
renderer.domElement.setAttribute(
"aria-label",
"A stylized park where visitors sketch beneath broad-brimmed hats."
);
app.prepend(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
80
);
const cameraState = {
target: new THREE.Vector3(0, 0.85, 0),
radius: 17,
theta: 0.62,
phi: 1.14
};
const cameraGoal = {
target: cameraState.target.clone(),
radius: cameraState.radius,
theta: cameraState.theta,
phi: cameraState.phi
};
let cameraTween = null;
let selectedStation = 0;
const hemi = new THREE.HemisphereLight(0xeaf4ed, 0x657458, 2.0);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe2ad, 3.2);
sun.position.set(-8, 12, 7);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -13;
sun.shadow.camera.right = 13;
sun.shadow.camera.top = 13;
sun.shadow.camera.bottom = -13;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 35;
sun.shadow.bias = -0.00035;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xbcd4d0, 0.55);
fill.position.set(8, 5, -8);
scene.add(fill);
const standard = (color, roughness = 0.82, metalness = 0) =>
new THREE.MeshStandardMaterial({ color, roughness, metalness });
const materials = {
ground: standard(0x9eb982),
lawn: standard(0x789c68),
path: standard(0xd5c49a),
bark: standard(0x76543b),
barkLight: standard(0x8b684a),
wood: standard(0xa97845),
woodDark: standard(0x765039),
paper: standard(0xf8f1df),
ink: standard(0x455b50),
skin: standard(0xc88962),
skinLight: standard(0xe0aa7c),
skinDark: standard(0x9d684d),
stool: standard(0xb87a4b),
leafA: standard(0x527858),
leafB: standard(0x688d5c),
leafC: standard(0x789957),
leafD: standard(0x426c53)
};
function mesh(geometry, material, position, parent = scene) {
const object = new THREE.Mesh(geometry, material);
if (position) object.position.set(...position);
object.castShadow = true;
object.receiveShadow = true;
parent.add(object);
return object;
}
function beam(a, b, radius, material, parent = scene, segments = 8) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const length = direction.length();
const object = mesh(
new THREE.CylinderGeometry(radius, radius, length, segments),
material,
null,
parent
);
object.position.copy(start).add(end).multiplyScalar(0.5);
object.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return object;
}
function horizontalCircle(radius, material, y = 0) {
const object = mesh(
new THREE.CircleGeometry(radius, 64),
material,
[0, y, 0],
scene
);
object.rotation.x = -Math.PI / 2;
object.castShadow = false;
return object;
}
// A compact, circular park diorama.
const base = mesh(
new THREE.CylinderGeometry(11.5, 11.8, 0.45, 72),
materials.ground,
[0, -0.25, 0]
);
base.receiveShadow = true;
const pathRing = mesh(
new THREE.RingGeometry(6.45, 8.15, 72),
materials.path,
[0, 0.012, 0]
);
pathRing.rotation.x = -Math.PI / 2;
pathRing.castShadow = false;
const lawn = horizontalCircle(6.42, materials.lawn, 0.022);
const centralPatch = horizontalCircle(2.5, standard(0x86a66f), 0.03);
centralPatch.scale.set(1.45, 0.72, 1);
// Small path stones.
const stoneMaterial = standard(0xe3d3af);
for (let i = 0; i < 18; i++) {
const angle = (i / 18) * Math.PI * 2;
const radius = 7.3;
const stone = mesh(
new THREE.CylinderGeometry(0.22, 0.25, 0.06, 6),
stoneMaterial,
[Math.cos(angle) * radius, 0.055, Math.sin(angle) * radius]
);
stone.rotation.y = angle * 1.7;
stone.scale.z = 0.72;
}
const stations = [];
const pickableMarkers = [];
const stationData = [
{
angle: 2.45,
name: "Oak edge",
copy: "Oak edge — face in shade, canvas in light",
shirt: 0xc85f46,
hat: 0xe2a64f,
skin: materials.skin,
style: 0
},
{
angle: 3.87,
name: "Lime court",
copy: "Lime court — a cool patch with an open drawing plane",
shirt: 0x517b88,
hat: 0xe0c38b,
skin: materials.skinDark,
style: 1
},
{
angle: 0.55,
name: "Maple nook",
copy: "Maple nook — filtered canopy light reaches the paper",
shirt: 0x7c8e55,
hat: 0xa85e45,
skin: materials.skinLight,
style: 2
},
{
angle: 5.38,
name: "Pine alcove",
copy: "Pine alcove — broad shade, bright and uncluttered canvas",
shirt: 0x76607a,
hat: 0xc99a57,
skin: materials.skin,
style: 3
}
];
function createSketchLines(parent, style) {
const lineMaterial = new THREE.LineBasicMaterial({
color: 0x52665b,
transparent: true,
opacity: 0.7
});
const lineSets = [
[
[-0.48, -0.20, 0], [-0.48, 0.16, 0],
[-0.22, 0.29, 0], [0.02, 0.17, 0],
[0.02, -0.20, 0]
],
[
[-0.49, -0.22, 0], [0.48, -0.22, 0],
[0.48, 0.21, 0], [-0.49, 0.21, 0],
[-0.49, -0.22, 0]
],
[
[-0.25, -0.24, 0], [-0.25, 0.22, 0],
[0.08, 0.35, 0], [0.40, 0.19, 0],
[0.40, -0.24, 0]
],
[
[-0.52, -0.17, 0], [0.50, -0.17, 0],
[0.33, 0.03, 0], [0.08, 0.12, 0],
[-0.17, 0.02, 0], [-0.52, -0.17, 0]
]
];
const points = lineSets[style % lineSets.length].map(
(point) => new THREE.Vector3(...point)
);
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.Line(geometry, lineMaterial);
parent.add(line);
}
function createEasel(parent, style) {
const easel = new THREE.Group();
easel.position.z = 0.34;
parent.add(easel);
beam([-0.58, 0.08, 0], [-0.53, 1.82, 0], 0.035, materials.woodDark, easel);
beam([0.58, 0.08, 0], [0.53, 1.82, 0], 0.035, materials.woodDark, easel);
beam([0, 0.08, -0.75], [0, 1.64, 0], 0.035, materials.wood, easel);
beam([-0.58, 0.84, 0.035], [0.58, 0.84, 0.035], 0.045, materials.wood, easel);
const board = new THREE.Group();
board.position.set(0, 1.32, 0.06);
easel.add(board);
mesh(
new THREE.BoxGeometry(1.43, 0.98, 0.10),
materials.woodDark,
[0, 0, 0],
board
);
mesh(
new THREE.BoxGeometry(1.29, 0.84, 0.035),
materials.paper,
[0, 0, 0.069],
board
);
createSketchLines(board, style);
return easel;
}
function createVisitor(parent, data, style) {
const visitor = new THREE.Group();
visitor.position.z = -0.43;
parent.add(visitor);
const shirt = standard(data.shirt);
const trousers = standard(0x3e5149);
// Simple, solid low-poly figure.
mesh(new THREE.CylinderGeometry(0.30, 0.39, 0.78, 10), shirt, [0, 1.02, 0], visitor);
mesh(new THREE.SphereGeometry(0.25, 12, 8), data.skin, [0, 1.73, 0], visitor);
beam([-0.18, 0.76, 0], [-0.20, 0.10, 0.02], 0.09, trousers, visitor);
beam([0.18, 0.76, 0], [0.20, 0.10, 0.02], 0.09, trousers, visitor);
beam([-0.28, 1.30, 0], [-0.34, 1.04, 0.28], 0.075, shirt, visitor);
beam([0.28, 1.30, 0], [0.34, 1.04, 0.28], 0.075, shirt, visitor);
mesh(new THREE.SphereGeometry(0.065, 8, 6), data.skin, [-0.34, 1.03, 0.29], visitor);
mesh(new THREE.SphereGeometry(0.065, 8, 6), data.skin, [0.34, 1.03, 0.29], visitor);
// A small nose makes the face direction legible.
mesh(new THREE.ConeGeometry(0.045, 0.12, 6), data.skin, [0, 1.72, 0.26], visitor)
.rotation.x = Math.PI / 2;
const hatMaterial = standard(data.hat);
const brim = mesh(
new THREE.CylinderGeometry(0.56, 0.59, 0.075, 24),
hatMaterial,
[0, 1.94, 0],
visitor
);
brim.scale.z = 0.92;
const crown = mesh(
new THREE.CylinderGeometry(0.29, 0.34, 0.34, 16),
hatMaterial,
[0, 2.09, 0],
visitor
);
crown.scale.z = 0.94;
mesh(
new THREE.CylinderGeometry(0.35, 0.35, 0.065, 16),
materials.woodDark,
[0, 1.965, 0],
visitor
);
return visitor;
}
function createStool(parent) {
const stool = new THREE.Group();
stool.position.set(0.98, 0, -0.35);
stool.rotation.y = -0.22;
parent.add(stool);
const seat = mesh(
new THREE.CylinderGeometry(0.33, 0.34, 0.12, 16),
materials.stool,
[0, 0.68, 0],
stool
);
seat.scale.z = 0.93;
for (let i = 0; i < 3; i++) {
const angle = (i / 3) * Math.PI * 2 + 0.35;
beam(
[Math.cos(angle) * 0.22, 0.66, Math.sin(angle) * 0.22],
[Math.cos(angle) * 0.30, 0.05, Math.sin(angle) * 0.30],
0.035,
materials.woodDark,
stool
);
}
return stool;
}
function createTree(position, scale = 1, variant = 0) {
const tree = new THREE.Group();
tree.position.set(...position);
tree.scale.setScalar(scale);
scene.add(tree);
mesh(
new THREE.CylinderGeometry(0.20, 0.32, 2.65, 8),
variant % 2 ? materials.barkLight : materials.bark,
[0, 1.30, 0],
tree
);
beam([-0.02, 1.62, 0], [-0.75, 2.45, 0.15], 0.10, materials.bark, tree);
beam([0.03, 1.90, 0], [0.74, 2.58, -0.05], 0.09, materials.barkLight, tree);
const crownMaterials = [
materials.leafA,
materials.leafB,
materials.leafC,
materials.leafD
];
const crown = mesh(
new THREE.IcosahedronGeometry(1.55, 1),
crownMaterials[variant % crownMaterials.length],
[0, 3.05, 0],
tree
);
crown.scale.set(1.08, 0.92, 1.0);
mesh(
new THREE.IcosahedronGeometry(1.05, 1),
crownMaterials[(variant + 1) % crownMaterials.length],
[-1.02, 2.73, 0.16],
tree
);
mesh(
new THREE.IcosahedronGeometry(1.08, 1),
crownMaterials[(variant + 2) % crownMaterials.length],
[0.95, 2.87, -0.10],
tree
);
mesh(
new THREE.IcosahedronGeometry(0.86, 1),
crownMaterials[(variant + 3) % crownMaterials.length],
[0.14, 3.85, 0.10],
tree
);
return tree;
}
function createStation(data, index) {
const radius = 5.25;
const x = Math.cos(data.angle) * radius;
const z = Math.sin(data.angle) * radius;
const outward = new THREE.Vector3(x, 0, z).normalize();
const tangent = new THREE.Vector3(-outward.z, 0, outward.x);
const front = outward.clone().negate();
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = Math.atan2(front.x, front.z);
scene.add(group);
// A quiet graphic patch makes the available shade immediately readable.
const shadePatch = horizontalCircle(
1.28,
new THREE.MeshBasicMaterial({
color: 0x345b47,
transparent: true,
opacity: 0.16,
depthWrite: false
}),
0.042
);
shadePatch.position.set(x, 0.042, z);
shadePatch.scale.set(1.08, 0.82, 1);
shadePatch.castShadow = false;
shadePatch.receiveShadow = false;
createVisitor(group, data, data.style);
const easel = createEasel(group, data.style);
createStool(group);
const treePosition = outward.clone().multiplyScalar(1.35).add(tangent.clone().multiplyScalar(0.58));
treePosition.add(new THREE.Vector3(x, 0, z));
createTree(treePosition.toArray(), 1.0 + (index % 2) * 0.08, index);
const ringMaterial = new THREE.MeshBasicMaterial({
color: 0xf3d17d,
transparent: true,
opacity: 0.72,
depthWrite: false
});
const ring = mesh(
new THREE.TorusGeometry(0.69, 0.035, 8, 48),
ringMaterial,
[x, 0.065, z],
scene
);
ring.rotation.x = Math.PI / 2;
ring.castShadow = false;
ring.receiveShadow = false;
ring.userData.station = index;
pickableMarkers.push(ring);
const station = {
group,
easel,
front,
ring,
ringMaterial,
markerPosition: new THREE.Vector3(x, 2.65, z)
};
stations.push(station);
}
stationData.forEach(createStation);
// Additional distant planting gives the park depth without crowding the sketches.
createTree([-9.0, 0, -3.7], 0.78, 1);
createTree([8.9, 0, 4.4], 0.84, 3);
createTree([-1.2, 0, -9.0], 0.72, 2);
const bushMaterial = standard(0x617f57);
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2 + 0.18;
const radius = 9.7 + (i % 3) * 0.35;
const bush = mesh(
new THREE.IcosahedronGeometry(0.48 + (i % 2) * 0.08, 1),
bushMaterial,
[Math.cos(angle) * radius, 0.40, Math.sin(angle) * radius]
);
bush.scale.y = 0.78;
}
function setCameraFromState() {
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x + cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z + cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
}
function shortestAngle(from, to) {
let difference = (to - from + Math.PI) % (Math.PI * 2) - Math.PI;
if (difference < -Math.PI) difference += Math.PI * 2;
return from + difference;
}
function animateCamera(goal, duration = 850) {
cameraGoal.target.copy(goal.target);
cameraGoal.radius = goal.radius;
cameraGoal.theta = shortestAngle(cameraState.theta, goal.theta);
cameraGoal.phi = goal.phi;
cameraTween = {
start: performance.now(),
duration: duration
};
}
function focusStation(index) {
selectedStation = index;
const station = stations[index];
const canvasTarget = new THREE.Vector3();
station.easel.getWorldPosition(canvasTarget);
canvasTarget.y = 1.28;
const theta = Math.atan2(station.front.x, station.front.z) + 0.20;
animateCamera({
target: canvasTarget,
radius: 4.45,
theta,
phi: 1.30
});
spotButtons.forEach((button, i) => button.classList.toggle("active", i === index));
markers.forEach((marker, i) => marker.classList.toggle("active", i === index));
selectedCopy.textContent = stationData[index].copy;
document.body.classList.add("focused");
focusButton.classList.add("active");
overviewButton.classList.remove("active");
stations.forEach((item, i) => {
item.ringMaterial.color.setHex(i === index ? 0xf1bd56 : 0xffffff);
item.ringMaterial.opacity = i === index ? 0.95 : 0.40;
});
}
function overview() {
animateCamera({
target: new THREE.Vector3(0, 0.85, 0),
radius: 17,
theta: 0.62,
phi: 1.14
}, 950);
document.body.classList.remove("focused");
focusButton.classList.remove("active");
overviewButton.classList.add("active");
}
spotButtons.forEach((button) => {
button.addEventListener("click", () => {
focusStation(Number(button.dataset.station));
});
});
markers.forEach((marker) => {
marker.addEventListener("click", () => {
focusStation(Number(marker.dataset.marker));
});
});
focusButton.addEventListener("click", () => focusStation(selectedStation));
overviewButton.addEventListener("click", overview);
// Direct camera controls, implemented without external control addons.
let dragging = false;
let previousX = 0;
let previousY = 0;
let pointerId = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerId = event.pointerId;
previousX = event.clientX;
previousY = event.clientY;
cameraTween = null;
renderer.domElement.setPointerCapture(pointerId);
renderer.domElement.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging || event.pointerId !== pointerId) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
cameraState.theta -= deltaX * 0.0052;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi + deltaY * 0.0045,
0.48,
1.43
);
setCameraFromState();
});
function endDrag(event) {
if (!dragging || event.pointerId !== pointerId) return;
dragging = false;
renderer.domElement.style.cursor = "grab";
if (renderer.domElement.hasPointerCapture(pointerId)) {
renderer.domElement.releasePointerCapture(pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.style.cursor = "grab";
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraTween = null;
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.008,
2.4,
25
);
setCameraFromState();
},
{ passive: false }
);
// Ground rings are also clickable.
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let downPosition = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
downPosition = { x: event.clientX, y: event.clientY };
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!downPosition) return;
const moved = Math.hypot(
event.clientX - downPosition.x,
event.clientY - downPosition.y
);
downPosition = null;
if (moved > 5) return;
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;
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(pickableMarkers, false)[0];
if (hit) focusStation(hit.object.userData.station);
});
function easeInOut(value) {
return value < 0.5
? 4 * value * value * value
: 1 - Math.pow(-2 * value + 2, 3) / 2;
}
function updateProjectedMarkers() {
const width = renderer.domElement.clientWidth;
const height = renderer.domElement.clientHeight;
markers.forEach((marker, index) => {
const point = stations[index].markerPosition.clone().project(camera);
const visible = point.z > -1 && point.z < 1;
marker.style.display = visible ? "grid" : "none";
marker.style.left = `${(point.x * 0.5 + 0.5) * width}px`;
marker.style.top = `${(-point.y * 0.5 + 0.5) * height}px`;
});
}
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
if (cameraTween) {
const raw = Math.min((performance.now() - cameraTween.start) / cameraTween.duration, 1);
const eased = easeInOut(raw);
cameraState.target.lerp(cameraGoal.target, eased);
cameraState.radius = THREE.MathUtils.lerp(cameraState.radius, cameraGoal.radius, eased);
cameraState.theta = THREE.MathUtils.lerp(cameraState.theta, cameraGoal.theta, eased);
cameraState.phi = THREE.MathUtils.lerp(cameraState.phi, cameraGoal.phi, eased);
if (raw >= 1) cameraTween = null;
}
setCameraFromState();
stations.forEach((station, index) => {
const pulse = 1 + Math.sin(elapsed * 2.1 + index) * 0.035;
station.ring.scale.setScalar(pulse);
});
scene.updateMatrixWorld();
updateProjectedMarkers();
renderer.render(scene, camera);
}
setCameraFromState();
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 600);
});
</script>
</body>
</html>
```