Prompt specification
Build or customize the Three.js 3D scene "Performer audience-space rings" 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: Performer audience-space rings
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/performer-audience-space-rings-x0545
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a street musician and the space around a small audience, using clean stylized solid forms. The musician stands near a low plaza wall with an open instrument case on the ground. Arrange several simple visitor markers in a loose semicircle facing the performer, leaving gaps between them. Behind the audience, a contrasting strip of paving indicates a continuous walking passage from one edge of the tile to the other. Use the floor guides to distinguish the performance area, the audience footprint, and the through route without adding an oversized information panel.
Working Three.js Starter (performer-audience-space-rings-x0545):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Plaza Street Session</title>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #ebe6dc;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
#hint {
position: fixed;
right: 18px;
bottom: 14px;
z-index: 2;
color: rgba(48, 54, 54, 0.58);
font: 500 12px/1.3 system-ui, sans-serif;
letter-spacing: 0.04em;
pointer-events: none;
user-select: none;
}
@media (max-width: 600px) {
#hint {
right: 12px;
bottom: 10px;
font-size: 11px;
}
}
</style>
</head>
<body>
<div id="hint">Drag to orbit · Scroll or pinch to zoom</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xebe6dc);
scene.fog = new THREE.Fog(0xebe6dc, 30, 58);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Stylized plaza scene with a street musician, a semicircle of visitors, and a marked through route"
);
document.body.appendChild(renderer.domElement);
const hemi = new THREE.HemisphereLight(0xfff9ed, 0x73838a, 2.25);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xfff1d8, 3.1);
sun.position.set(-7, 13, 9);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -14;
sun.shadow.camera.right = 14;
sun.shadow.camera.top = 12;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 36;
sun.shadow.normalBias = 0.035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xb7d2dc, 0.75);
fill.position.set(9, 7, -8);
scene.add(fill);
const standard = (color, roughness = 0.82, metalness = 0) =>
new THREE.MeshStandardMaterial({ color, roughness, metalness });
const materials = {
backdrop: standard(0xe8e2d7),
slab: standard(0xcfc4b3),
floor: standard(0xded5c5),
route: standard(0x9bb7b3),
routeEdge: standard(0x668889),
wall: standard(0xbab3a8),
wallCap: standard(0xe0d9cd),
wallJoint: standard(0xaaa398),
skin: standard(0xd99c78),
skinLight: standard(0xe4b28d),
hair: standard(0x3c302b),
pants: standard(0x35434b),
shoes: standard(0x283238),
guitar: standard(0xc97643),
guitarDark: standard(0x75452d),
guitarBlack: standard(0x252728),
strings: standard(0xe8d7b7, 0.42, 0.15),
case: standard(0x49372f),
lining: standard(0xd3a15e),
coinCup: standard(0x485b5c),
goldGuide: new THREE.MeshBasicMaterial({ color: 0xd3a344 }),
audienceGuide: new THREE.MeshBasicMaterial({ color: 0xb67563 }),
routeMark: new THREE.MeshBasicMaterial({ color: 0xeaf2ec })
};
function addMesh(geometry, material, parent = scene) {
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBox(parent, width, height, depth, material, x, y, z) {
const mesh = addMesh(
new THREE.BoxGeometry(width, height, depth),
material,
parent
);
mesh.position.set(x, y, z);
return mesh;
}
function addRod(parent, a, b, radius, material, segments = 12) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const mesh = addMesh(
new THREE.CylinderGeometry(
radius,
radius,
direction.length(),
segments
),
material,
parent
);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
function roundedRectShape(width, height, radius) {
const x = -width / 2;
const y = -height / 2;
const shape = new THREE.Shape();
shape.moveTo(x + radius, y);
shape.lineTo(x + width - radius, y);
shape.quadraticCurveTo(x + width, y, x + width, y + radius);
shape.lineTo(x + width, y + height - radius);
shape.quadraticCurveTo(
x + width,
y + height,
x + width - radius,
y + height
);
shape.lineTo(x + radius, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - radius);
shape.lineTo(x, y + radius);
shape.quadraticCurveTo(x, y, x + radius, y);
return shape;
}
function barXZ(x1, z1, x2, z2, width, height, material, parent = scene) {
const dx = x2 - x1;
const dz = z2 - z1;
const length = Math.hypot(dx, dz);
const mesh = addBox(
parent,
length,
height,
width,
material,
(x1 + x2) / 2,
0.047,
(z1 + z2) / 2
);
mesh.rotation.y = -Math.atan2(dz, dx);
return mesh;
}
function dashedArc(cx, cz, radius, start, end, count, material) {
const step = (end - start) / count;
for (let i = 0; i < count; i++) {
const center = start + (i + 0.5) * step;
const half = step * 0.31;
const a1 = center - half;
const a2 = center + half;
const x1 = cx + Math.sin(a1) * radius;
const z1 = cz + Math.cos(a1) * radius;
const x2 = cx + Math.sin(a2) * radius;
const z2 = cz + Math.cos(a2) * radius;
barXZ(x1, z1, x2, z2, 0.065, 0.018, material);
}
}
function floorLabel(text, x, z, width, color) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 160;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = color;
ctx.font = "700 64px Arial, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, canvas.width / 2, canvas.height / 2 + 3);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
toneMapped: false
});
const label = new THREE.Mesh(
new THREE.PlaneGeometry(width, width * (160 / 768)),
material
);
label.rotation.x = -Math.PI / 2;
label.position.set(x, 0.076, z);
label.renderOrder = 4;
scene.add(label);
return label;
}
// Diorama tile and surrounding ground.
const backdrop = addMesh(
new THREE.PlaneGeometry(120, 120),
materials.backdrop
);
backdrop.rotation.x = -Math.PI / 2;
backdrop.position.y = -0.38;
backdrop.castShadow = false;
const slab = addBox(
scene,
18.4,
0.34,
12.0,
materials.slab,
0,
-0.17,
0
);
const floor = addBox(
scene,
18.35,
0.035,
11.95,
materials.floor,
0,
0.0175,
0
);
floor.castShadow = false;
// A continuous contrasting strip crosses the entire tile.
const routeZ = 2.25;
const routeDepth = 2.1;
const route = addBox(
scene,
18.38,
0.025,
routeDepth,
materials.route,
0,
0.043,
routeZ
);
route.castShadow = false;
for (const z of [routeZ - routeDepth / 2, routeZ + routeDepth / 2]) {
const edge = addBox(
scene,
18.38,
0.022,
0.065,
materials.routeEdge,
0,
0.057,
z
);
edge.castShadow = false;
}
// Low plaza wall.
addBox(scene, 18.4, 0.92, 0.5, materials.wall, 0, 0.46, -5.55);
addBox(scene, 18.55, 0.13, 0.67, materials.wallCap, 0, 0.985, -5.55);
for (let x = -8; x <= 8; x += 2) {
const seam = addBox(
scene,
0.025,
0.72,
0.018,
materials.wallJoint,
x,
0.46,
-5.291
);
seam.castShadow = false;
}
// Floor-zone guides.
const performerX = -0.45;
const performerZ = -3.35;
dashedArc(
performerX,
performerZ,
1.52,
0,
Math.PI * 2,
30,
materials.goldGuide
);
dashedArc(
performerX,
performerZ,
3.16,
THREE.MathUtils.degToRad(-70),
THREE.MathUtils.degToRad(70),
15,
materials.audienceGuide
);
// Route arrows point across the passage.
for (const x of [-7.25, -4.25, 4.25, 7.25]) {
barXZ(x - 0.42, routeZ, x + 0.12, routeZ, 0.075, 0.02, materials.routeMark);
barXZ(x + 0.12, routeZ, x - 0.23, routeZ - 0.31, 0.075, 0.02, materials.routeMark);
barXZ(x + 0.12, routeZ, x - 0.23, routeZ + 0.31, 0.075, 0.02, materials.routeMark);
}
floorLabel("PERFORM", -1.22, -2.92, 1.25, "#a77827");
floorLabel("AUDIENCE", 0, 0.78, 1.65, "#965b4e");
floorLabel("THROUGH ROUTE", 0, routeZ, 2.55, "#eef5f0");
// Street musician.
const musician = new THREE.Group();
musician.position.set(performerX, 0, performerZ);
scene.add(musician);
const coat = standard(0x315d63);
const coatDark = standard(0x26494f);
addBox(musician, 0.23, 0.11, 0.39, materials.shoes, -0.17, 0.085, 0.08);
addBox(musician, 0.23, 0.11, 0.39, materials.shoes, 0.17, 0.085, 0.08);
addRod(musician, [-0.17, 0.13, 0], [-0.17, 0.79, 0], 0.115, materials.pants);
addRod(musician, [0.17, 0.13, 0], [0.17, 0.79, 0], 0.115, materials.pants);
const torso = addMesh(
new THREE.CylinderGeometry(0.29, 0.34, 0.72, 16),
coat,
musician
);
torso.position.y = 1.08;
const collar = addMesh(
new THREE.CylinderGeometry(0.12, 0.14, 0.16, 14),
materials.skin,
musician
);
collar.position.y = 1.49;
const head = addMesh(
new THREE.SphereGeometry(0.235, 20, 14),
materials.skin,
musician
);
head.position.set(0, 1.66, 0.015);
const nose = addMesh(
new THREE.SphereGeometry(0.047, 10, 8),
materials.skin,
musician
);
nose.position.set(0, 1.64, 0.235);
const brim = addMesh(
new THREE.CylinderGeometry(0.31, 0.31, 0.045, 20),
coatDark,
musician
);
brim.position.y = 1.835;
const hat = addMesh(
new THREE.CylinderGeometry(0.205, 0.225, 0.17, 18),
coatDark,
musician
);
hat.position.y = 1.92;
// Guitar silhouette, neck, strings, and bridge.
const guitarShape = new THREE.Shape();
guitarShape.moveTo(0, -0.58);
guitarShape.bezierCurveTo(0.42, -0.59, 0.49, -0.2, 0.25, 0.015);
guitarShape.bezierCurveTo(0.5, 0.22, 0.38, 0.6, 0, 0.58);
guitarShape.bezierCurveTo(-0.38, 0.6, -0.5, 0.22, -0.25, 0.015);
guitarShape.bezierCurveTo(-0.49, -0.2, -0.42, -0.59, 0, -0.58);
const guitarBody = addMesh(
new THREE.ExtrudeGeometry(guitarShape, {
depth: 0.13,
bevelEnabled: true,
bevelSegments: 3,
steps: 1,
bevelSize: 0.045,
bevelThickness: 0.035
}),
materials.guitar,
musician
);
guitarBody.position.set(0.13, 0.96, 0.31);
const soundHole = addMesh(
new THREE.CylinderGeometry(0.105, 0.105, 0.018, 24),
materials.guitarBlack,
musician
);
soundHole.rotation.x = Math.PI / 2;
soundHole.position.set(0.13, 1.02, 0.475);
const neck = addBox(
musician,
0.13,
0.82,
0.12,
materials.guitarDark,
0.29,
1.72,
0.39
);
neck.rotation.z = -0.12;
const headstock = addBox(
musician,
0.18,
0.27,
0.13,
materials.guitarDark,
0.335,
2.17,
0.39
);
headstock.rotation.z = -0.12;
for (let i = 0; i < 3; i++) {
addRod(
musician,
[0.10 + i * 0.025, 1.16, 0.496],
[0.29 + i * 0.025, 2.18, 0.496],
0.0055,
materials.strings,
6
);
}
const bridge = addBox(
musician,
0.29,
0.045,
0.035,
materials.guitarBlack,
0.13,
0.69,
0.495
);
bridge.rotation.z = -0.06;
// Guitar strap.
addRod(
musician,
[-0.24, 1.38, 0.21],
[0.34, 1.38, 0.43],
0.027,
materials.guitarBlack,
8
);
// Arms and hands.
addRod(musician, [-0.28, 1.32, 0.03], [-0.42, 1.05, 0.24], 0.09, coat);
addRod(musician, [-0.42, 1.05, 0.24], [-0.08, 0.98, 0.51], 0.075, coat);
addRod(musician, [0.28, 1.32, 0.03], [0.51, 1.42, 0.23], 0.09, coat);
addRod(musician, [0.51, 1.42, 0.23], [0.34, 1.57, 0.49], 0.075, coat);
const leftHand = addMesh(
new THREE.SphereGeometry(0.085, 12, 8),
materials.skin,
musician
);
leftHand.position.set(-0.08, 0.98, 0.52);
const rightHand = addMesh(
new THREE.SphereGeometry(0.085, 12, 8),
materials.skin,
musician
);
rightHand.position.set(0.34, 1.57, 0.5);
// Open instrument case.
const caseGroup = new THREE.Group();
caseGroup.position.set(1.45, 0, -3.42);
scene.add(caseGroup);
const caseShape = roundedRectShape(1.55, 0.72, 0.26);
const caseGeometry = new THREE.ExtrudeGeometry(caseShape, {
depth: 0.12,
bevelEnabled: true,
bevelSegments: 3,
steps: 1,
bevelSize: 0.035,
bevelThickness: 0.025
});
const caseBase = addMesh(caseGeometry, materials.case, caseGroup);
caseBase.rotation.x = -Math.PI / 2;
caseBase.position.y = 0.045;
const liningGeometry = new THREE.ExtrudeGeometry(
roundedRectShape(1.33, 0.53, 0.21),
{
depth: 0.025,
bevelEnabled: false,
steps: 1
}
);
const caseLining = addMesh(liningGeometry, materials.lining, caseGroup);
caseLining.rotation.x = -Math.PI / 2;
caseLining.position.y = 0.155;
const lidHinge = new THREE.Group();
lidHinge.position.set(0, 0.15, -0.35);
lidHinge.rotation.x = -1.02;
caseGroup.add(lidHinge);
const lidGeometry = new THREE.ExtrudeGeometry(caseShape, {
depth: 0.085,
bevelEnabled: true,
bevelSegments: 3,
steps: 1,
bevelSize: 0.03,
bevelThickness: 0.02
});
const lid = addMesh(lidGeometry, materials.case, lidHinge);
lid.rotation.x = -Math.PI / 2;
lid.position.z = 0.36;
const lidLining = addMesh(liningGeometry, materials.lining, lidHinge);
lidLining.rotation.x = -Math.PI / 2;
lidLining.position.set(0, 0.093, 0.36);
lidLining.scale.set(0.9, 0.85, 1);
for (const x of [-0.55, 0.55]) {
addBox(caseGroup, 0.12, 0.07, 0.09, materials.guitarDark, x, 0.13, 0.37);
}
// Small tip cup.
const cup = addMesh(
new THREE.CylinderGeometry(0.14, 0.11, 0.25, 16),
materials.coinCup,
scene
);
cup.position.set(2.38, 0.125, -3.28);
const cupTop = addMesh(
new THREE.CircleGeometry(0.105, 20),
materials.guitarBlack,
scene
);
cupTop.rotation.x = -Math.PI / 2;
cupTop.position.set(2.38, 0.252, -3.28);
// Simple visitor markers in a loose audience semicircle.
const audienceColors = [
standard(0x71839a),
standard(0xb66f5d),
standard(0xd0a25b),
standard(0x718d7c),
standard(0x8a7597),
standard(0x5d818a)
];
const audienceData = [
[-64, 3.18, 0.95],
[-39, 3.23, 1.04],
[-14, 3.13, 0.91],
[14, 3.18, 1.02],
[40, 3.25, 0.94],
[65, 3.16, 1.06]
];
function makeVisitor(color, scale) {
const visitor = new THREE.Group();
const visitorPants = standard(0x4c5558);
addBox(visitor, 0.19, 0.09, 0.32, materials.shoes, -0.13, 0.075, 0.055);
addBox(visitor, 0.19, 0.09, 0.32, materials.shoes, 0.13, 0.075, 0.055);
addRod(visitor, [-0.13, 0.12, 0], [-0.13, 0.68, 0], 0.095, visitorPants);
addRod(visitor, [0.13, 0.12, 0], [0.13, 0.68, 0], 0.095, visitorPants);
const body = addMesh(
new THREE.CylinderGeometry(0.23, 0.28, 0.62, 14),
color,
visitor
);
body.position.y = 0.94;
const head = addMesh(
new THREE.SphereGeometry(0.205, 18, 12),
materials.skinLight,
visitor
);
head.position.y = 1.43;
const hair = addMesh(
new THREE.SphereGeometry(
0.212,
16,
10,
0,
Math.PI * 2,
0,
Math.PI * 0.53
),
materials.hair,
visitor
);
hair.position.y = 1.445;
const nose = addMesh(
new THREE.SphereGeometry(0.04, 8, 6),
materials.skinLight,
visitor
);
nose.position.set(0, 1.415, 0.195);
addRod(visitor, [-0.23, 1.15, 0], [-0.31, 0.79, 0.03], 0.07, color);
addRod(visitor, [0.23, 1.15, 0], [0.31, 0.79, 0.03], 0.07, color);
visitor.scale.setScalar(scale);
return visitor;
}
audienceData.forEach(([degrees, radius, scale], index) => {
const angle = THREE.MathUtils.degToRad(degrees);
const x = performerX + Math.sin(angle) * radius;
const z = performerZ + Math.cos(angle) * radius;
const visitor = makeVisitor(audienceColors[index], scale);
visitor.position.set(x, 0, z);
visitor.rotation.y = Math.atan2(performerX - x, performerZ - z);
scene.add(visitor);
const pad = new THREE.Mesh(
new THREE.RingGeometry(0.36, 0.405, 40),
materials.audienceGuide
);
pad.rotation.x = -Math.PI / 2;
pad.position.set(x, 0.056, z);
scene.add(pad);
});
// Custom orbit and zoom controls, implemented without addons.
const orbit = {
theta: 0.58,
phi: 0.94,
radius: 18.6,
target: new THREE.Vector3(0, 0.48, -0.85)
};
const pointers = new Map();
let draggingPointer = null;
let lastX = 0;
let lastY = 0;
let pinchDistance = 0;
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 1) {
draggingPointer = event.pointerId;
lastX = event.clientX;
lastY = event.clientY;
} else if (pointers.size === 2) {
const [a, b] = [...pointers.values()];
pinchDistance = Math.hypot(a.x - b.x, a.y - b.y);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 2) {
const [a, b] = [...pointers.values()];
const distance = Math.hypot(a.x - b.x, a.y - b.y);
if (pinchDistance > 0 && distance > 0) {
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * (pinchDistance / distance),
10,
28
);
}
pinchDistance = distance;
} else if (event.pointerId === draggingPointer) {
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
orbit.theta -= dx * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - dy * 0.005,
0.38,
1.35
);
lastX = event.clientX;
lastY = event.clientY;
}
updateCamera();
});
function releasePointer(event) {
pointers.delete(event.pointerId);
if (event.pointerId === draggingPointer) {
draggingPointer = null;
}
if (pointers.size < 2) {
pinchDistance = 0;
}
if (pointers.size === 1) {
const [id, point] = [...pointers.entries()][0];
draggingPointer = id;
lastX = point.x;
lastY = point.y;
}
}
renderer.domElement.addEventListener("pointerup", releasePointer);
renderer.domElement.addEventListener("pointercancel", releasePointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
10,
28
);
updateCamera();
},
{ passive: false }
);
window.addEventListener("keydown", (event) => {
if (event.key === "ArrowLeft") orbit.theta += 0.08;
if (event.key === "ArrowRight") orbit.theta -= 0.08;
if (event.key === "ArrowUp") orbit.phi = Math.max(0.38, orbit.phi - 0.06);
if (event.key === "ArrowDown") orbit.phi = Math.min(1.35, orbit.phi + 0.06);
if (event.key === "+" || event.key === "=") orbit.radius = Math.max(10, orbit.radius - 0.7);
if (event.key === "-") orbit.radius = Math.min(28, orbit.radius + 0.7);
updateCamera();
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
updateCamera();
renderer.setAnimationLoop(() => renderer.render(scene, camera));
</script>
</body>
</html>
```