Prompt specification
Build or customize the Three.js 3D scene "Sign contrast sample pair" 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: Sign contrast sample pair
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/sign-contrast-sample-pair-x0413
Scene Description Prompt:
Compare identical stylized arrow signs against high- and low-contrast backgrounds under matching lighting. Three.js from cdnjs, one HTML file.
Working Three.js Starter (sign-contrast-sample-pair-x0413):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Signal Lab — Arrow Contrast Study</title>
<style>
:root {
color-scheme: dark;
--bg: #080b10;
--panel: #10151d;
--panel-soft: #151b24;
--line: rgba(255, 255, 255, 0.1);
--text: #f3f5f7;
--muted: #8e98a8;
--accent: #f5a623;
--green: #70e1a1;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
body {
display: flex;
flex-direction: column;
overflow: hidden;
background:
radial-gradient(circle at 50% -20%, #1a2432 0%, transparent 42%),
var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
.topbar {
flex: 0 0 auto;
min-height: 76px;
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 24px;
padding: 14px 24px;
border-bottom: 1px solid var(--line);
background: rgba(8, 11, 16, 0.82);
backdrop-filter: blur(18px);
z-index: 10;
}
.brand {
display: flex;
align-items: center;
gap: 11px;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.16em;
}
.brand-mark {
width: 31px;
height: 31px;
position: relative;
display: grid;
place-items: center;
border: 1px solid rgba(245, 166, 35, 0.38);
border-radius: 9px;
background: rgba(245, 166, 35, 0.09);
}
.brand-mark::before {
content: "";
width: 14px;
height: 10px;
background: var(--accent);
clip-path: polygon(
0 25%,
56% 25%,
56% 0,
100% 50%,
56% 100%,
56% 75%,
0 75%
);
}
.page-title {
text-align: center;
}
.page-title h1 {
margin: 0;
font-size: clamp(15px, 2vw, 20px);
font-weight: 650;
letter-spacing: -0.02em;
}
.page-title p {
margin: 4px 0 0;
color: var(--muted);
font-size: 11px;
letter-spacing: 0.04em;
}
.linked-status {
justify-self: end;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 11px;
border: 1px solid rgba(112, 225, 161, 0.2);
border-radius: 999px;
color: #b9f4d3;
background: rgba(112, 225, 161, 0.06);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.11em;
white-space: nowrap;
}
.linked-status i {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 0 4px rgba(112, 225, 161, 0.1);
}
main {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.stage {
position: relative;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
#scene {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
#scene.dragging {
cursor: grabbing;
}
.panes {
position: absolute;
inset: 0;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
padding: 12px;
pointer-events: none;
z-index: 2;
}
.pane {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.11);
border-radius: 8px;
box-shadow:
0 14px 38px rgba(0, 0, 0, 0.24),
inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}
.pane::after {
content: "";
position: absolute;
inset: 0;
background:
linear-gradient(
180deg,
rgba(4, 7, 12, 0.22),
transparent 25%,
transparent 72%,
rgba(4, 7, 12, 0.22)
);
pointer-events: none;
}
.pane-heading {
position: absolute;
z-index: 2;
top: 18px;
left: 18px;
display: flex;
align-items: flex-start;
gap: 11px;
}
.pane-index {
display: grid;
place-items: center;
width: 30px;
height: 30px;
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 8px;
background: rgba(7, 10, 15, 0.46);
backdrop-filter: blur(10px);
color: rgba(255, 255, 255, 0.85);
font-size: 10px;
font-weight: 750;
}
.pane-heading h2 {
margin: 0;
padding: 6px 9px 5px;
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 7px;
background: rgba(7, 10, 15, 0.46);
backdrop-filter: blur(10px);
font-size: 10px;
line-height: 1;
font-weight: 800;
letter-spacing: 0.12em;
}
.pane-heading p {
margin: 7px 0 0;
color: rgba(255, 255, 255, 0.7);
font-size: 11px;
text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.contrast-card {
position: absolute;
z-index: 2;
left: 18px;
bottom: 18px;
min-width: 165px;
padding: 12px 13px;
border: 1px solid rgba(255, 255, 255, 0.14);
border-radius: 9px;
background: rgba(7, 10, 15, 0.64);
backdrop-filter: blur(14px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.contrast-card .label {
display: flex;
align-items: center;
gap: 7px;
color: rgba(255, 255, 255, 0.62);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.swatch {
width: 9px;
height: 9px;
border-radius: 3px;
border: 1px solid rgba(255, 255, 255, 0.24);
}
.contrast-card strong {
display: block;
margin-top: 6px;
font-size: 25px;
line-height: 1;
font-weight: 680;
letter-spacing: -0.04em;
}
.contrast-card small {
display: block;
margin-top: 5px;
color: rgba(255, 255, 255, 0.48);
font-size: 9px;
}
.stage-hint {
position: absolute;
z-index: 3;
left: 50%;
bottom: 26px;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 999px;
background: rgba(7, 10, 15, 0.55);
backdrop-filter: blur(10px);
color: rgba(255, 255, 255, 0.58);
font-size: 9px;
letter-spacing: 0.05em;
pointer-events: none;
}
.stage-hint::before {
content: "";
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--accent);
}
.dock {
flex: 0 0 auto;
min-height: 92px;
display: grid;
grid-template-columns: minmax(210px, 1fr) auto auto minmax(220px, 1fr);
align-items: center;
gap: 24px;
padding: 14px 24px;
border-top: 1px solid var(--line);
background: rgba(12, 16, 22, 0.9);
backdrop-filter: blur(18px);
z-index: 10;
}
.control-block {
display: flex;
align-items: center;
gap: 13px;
}
.control-label {
display: block;
margin-bottom: 7px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.slider-wrap {
display: flex;
align-items: center;
gap: 11px;
}
input[type="range"] {
width: min(190px, 17vw);
accent-color: var(--accent);
cursor: pointer;
}
output {
min-width: 43px;
color: var(--text);
font-variant-numeric: tabular-nums;
font-size: 12px;
font-weight: 700;
}
.segmented {
display: inline-flex;
padding: 4px;
border: 1px solid var(--line);
border-radius: 10px;
background: #090d13;
}
.segmented button,
.reset-button {
border: 0;
border-radius: 7px;
background: transparent;
color: var(--muted);
cursor: pointer;
font-size: 11px;
font-weight: 700;
transition:
color 160ms ease,
background 160ms ease,
box-shadow 160ms ease;
}
.segmented button {
min-width: 57px;
padding: 8px 10px;
}
.segmented button:hover,
.reset-button:hover {
color: var(--text);
}
.segmented button.active {
color: #fff;
background: #222a35;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.reset-button {
padding: 10px 13px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.025);
}
.dock-note {
justify-self: end;
max-width: 290px;
color: var(--muted);
font-size: 10px;
line-height: 1.55;
text-align: right;
}
.dock-note strong {
color: #dce2e9;
font-weight: 650;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
body[data-view="high"] .panes,
body[data-view="low"] .panes {
grid-template-columns: minmax(0, 1fr);
}
body[data-view="high"] .pane[data-scene="low"],
body[data-view="low"] .pane[data-scene="high"] {
display: none;
}
@media (max-width: 980px) {
.topbar {
grid-template-columns: 1fr auto;
}
.page-title {
display: none;
}
.dock {
grid-template-columns: 1fr auto auto;
}
.dock-note {
display: none;
}
}
@media (max-width: 700px) {
body {
height: auto;
min-height: 100%;
overflow: auto;
}
.topbar {
min-height: 66px;
padding: 12px 14px;
}
.linked-status {
font-size: 8px;
padding: 7px 9px;
}
.stage {
flex: none;
height: 940px;
}
.panes {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: repeat(2, minmax(0, 1fr));
gap: 10px;
padding: 10px;
}
body[data-view="high"] .panes,
body[data-view="low"] .panes {
grid-template-rows: minmax(0, 1fr);
}
.stage-hint {
display: none;
}
.dock {
grid-template-columns: 1fr;
gap: 16px;
padding: 18px 16px;
}
.control-block {
justify-content: space-between;
}
.segmented {
width: 100%;
}
.segmented button {
flex: 1;
}
input[type="range"] {
width: min(210px, 45vw);
}
}
</style>
</head>
<body data-view="split">
<header class="topbar">
<div class="brand">
<span class="brand-mark" aria-hidden="true"></span>
<span>SIGNAL / LAB</span>
</div>
<div class="page-title">
<h1>Arrow contrast, without the confounders.</h1>
<p>Identical sign geometry and synchronized illumination</p>
</div>
<div class="linked-status" title="Both scenes receive identical light values">
<i aria-hidden="true"></i>
LIGHTING LINKED
</div>
</header>
<main>
<section class="stage" id="stage" aria-label="Interactive arrow contrast comparison">
<canvas
id="scene"
tabindex="0"
aria-label="Two identical orange arrow signs. Drag to orbit and use the mouse wheel to zoom."
></canvas>
<div class="panes">
<article class="pane" data-scene="high">
<div class="pane-heading">
<span class="pane-index">01</span>
<div>
<h2>HIGH CONTRAST</h2>
<p>Deep blue field / orange sign</p>
</div>
</div>
<div class="contrast-card">
<div class="label">
<span class="swatch" style="background:#091321"></span>
Estimated contrast
</div>
<strong id="high-ratio">—</strong>
<small>Base-color contrast ratio</small>
</div>
</article>
<article class="pane" data-scene="low">
<div class="pane-heading">
<span class="pane-index">02</span>
<div>
<h2>LOW CONTRAST</h2>
<p>Warm gray field / orange sign</p>
</div>
</div>
<div class="contrast-card">
<div class="label">
<span class="swatch" style="background:#8f8577"></span>
Estimated contrast
</div>
<strong id="low-ratio">—</strong>
<small>Base-color contrast ratio</small>
</div>
</article>
</div>
<div class="stage-hint">DRAG TO ORBIT · SCROLL TO ZOOM · DOUBLE-CLICK TO RESET</div>
</section>
<section class="dock" aria-label="Comparison controls">
<div class="control-block">
<div>
<span class="control-label">Shared illumination</span>
<div class="slider-wrap">
<input
id="light-slider"
type="range"
min="60"
max="150"
value="100"
step="1"
aria-label="Shared light intensity"
>
<output id="light-output" for="light-slider">100%</output>
</div>
</div>
</div>
<div class="control-block">
<div>
<span class="control-label">Comparison view</span>
<div class="segmented" role="group" aria-label="Comparison view">
<button class="active" data-view-button="split" aria-pressed="true">Split</button>
<button data-view-button="high" aria-pressed="false">High</button>
<button data-view-button="low" aria-pressed="false">Low</button>
</div>
</div>
</div>
<div class="control-block">
<div>
<span class="control-label">Camera</span>
<button class="reset-button" id="reset-camera">Reset view</button>
</div>
</div>
<div class="dock-note">
<strong>Controlled comparison.</strong><br>
One shared camera, one arrow mesh/material set, and identical light values in both scenes.
</div>
</section>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const stage = document.querySelector("#stage");
const lightSlider = document.querySelector("#light-slider");
const lightOutput = document.querySelector("#light-output");
const COLORS = {
highBackground: 0x091321,
lowBackground: 0x8f8577,
arrowFront: 0xf5a623,
arrowSide: 0xc97812
};
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor(0x080b10, 1);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 50);
const cameraTarget = new THREE.Vector3(0, -0.12, 0);
const defaultCamera = {
yaw: 0.24,
pitch: 0.12,
radius: 6.6
};
const cameraState = { ...defaultCamera };
function updateCamera() {
const { yaw, pitch, radius } = cameraState;
camera.position.set(
cameraTarget.x + Math.sin(yaw) * Math.cos(pitch) * radius,
cameraTarget.y + Math.sin(pitch) * radius,
cameraTarget.z + Math.cos(yaw) * Math.cos(pitch) * radius
);
camera.lookAt(cameraTarget);
}
updateCamera();
/*
Shared geometry and materials guarantee that the two signs are identical.
Separate meshes are required because each mesh can only belong to one scene.
*/
function createArrowGeometry() {
const shape = new THREE.Shape();
shape.moveTo(-1.45, -0.5);
shape.lineTo(0.13, -0.5);
shape.lineTo(0.13, -1.0);
shape.lineTo(1.35, 0);
shape.lineTo(0.13, 1.0);
shape.lineTo(0.13, 0.5);
shape.lineTo(-1.45, 0.5);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.28,
bevelEnabled: true,
bevelThickness: 0.055,
bevelSize: 0.05,
bevelOffset: 0,
bevelSegments: 5,
curveSegments: 2
});
geometry.center();
geometry.computeVertexNormals();
return geometry;
}
const arrowGeometry = createArrowGeometry();
const arrowFrontMaterial = new THREE.MeshStandardMaterial({
color: COLORS.arrowFront,
roughness: 0.36,
metalness: 0.06
});
const arrowSideMaterial = new THREE.MeshStandardMaterial({
color: COLORS.arrowSide,
roughness: 0.48,
metalness: 0.04
});
const postMaterial = new THREE.MeshStandardMaterial({
color: 0x303640,
roughness: 0.48,
metalness: 0.34
});
const baseMaterial = new THREE.MeshStandardMaterial({
color: 0x252b33,
roughness: 0.42,
metalness: 0.3
});
const postGeometry = new THREE.CylinderGeometry(0.055, 0.065, 0.64, 20);
const baseGeometry = new THREE.CylinderGeometry(0.5, 0.61, 0.14, 48);
const floorGeometry = new THREE.PlaneGeometry(30, 30);
function addSign(scene) {
const arrow = new THREE.Mesh(
arrowGeometry,
[arrowFrontMaterial, arrowSideMaterial]
);
arrow.position.set(0, 0.23, 0);
arrow.rotation.y = -0.08;
arrow.castShadow = true;
arrow.receiveShadow = true;
scene.add(arrow);
const post = new THREE.Mesh(postGeometry, postMaterial);
post.position.set(0, -1.03, 0);
post.castShadow = true;
post.receiveShadow = true;
scene.add(post);
const base = new THREE.Mesh(baseGeometry, baseMaterial);
base.position.set(0, -1.31, 0);
base.castShadow = true;
base.receiveShadow = true;
scene.add(base);
const shadowFloor = new THREE.Mesh(
floorGeometry,
new THREE.ShadowMaterial({
color: 0x000000,
opacity: 0.24
})
);
shadowFloor.rotation.x = -Math.PI / 2;
shadowFloor.position.y = -1.385;
shadowFloor.receiveShadow = true;
scene.add(shadowFloor);
}
/*
Both scenes receive identical light positions, colors, and intensities.
The UI changes every corresponding light at the same time.
*/
function addMatchedLightRig(scene) {
const rig = {
hemisphere: new THREE.HemisphereLight(
0xf7fbff,
0x20242c,
1.05
),
ambient: new THREE.AmbientLight(0xffffff, 0.16),
key: new THREE.DirectionalLight(0xfff1d8, 3.1),
fill: new THREE.DirectionalLight(0xd9e7ff, 1.05),
rim: new THREE.DirectionalLight(0xffffff, 1.15)
};
rig.key.position.set(-3.8, 5.4, 5.2);
rig.key.castShadow = true;
rig.key.shadow.mapSize.set(1024, 1024);
rig.key.shadow.camera.left = -5;
rig.key.shadow.camera.right = 5;
rig.key.shadow.camera.top = 5;
rig.key.shadow.camera.bottom = -5;
rig.key.shadow.camera.near = 0.5;
rig.key.shadow.camera.far = 16;
rig.key.shadow.bias = -0.0005;
rig.fill.position.set(4.2, 1.8, 4.5);
rig.rim.position.set(2.5, 3.5, -4.2);
scene.add(
rig.hemisphere,
rig.ambient,
rig.key,
rig.fill,
rig.rim
);
return rig;
}
function createScene(backgroundColor) {
const scene = new THREE.Scene();
scene.background = new THREE.Color(backgroundColor);
addSign(scene);
const rig = addMatchedLightRig(scene);
return { scene, rig };
}
const highScene = createScene(COLORS.highBackground);
const lowScene = createScene(COLORS.lowBackground);
const sceneMap = {
high: highScene,
low: lowScene
};
function setLightIntensity(percent) {
const factor = percent / 100;
for (const { rig } of Object.values(sceneMap)) {
rig.hemisphere.intensity = 1.05 * factor;
rig.ambient.intensity = 0.16 * factor;
rig.key.intensity = 3.1 * factor;
rig.fill.intensity = 1.05 * factor;
rig.rim.intensity = 1.15 * factor;
}
}
setLightIntensity(Number(lightSlider.value));
lightSlider.addEventListener("input", () => {
const value = Number(lightSlider.value);
lightOutput.value = `${value}%`;
lightOutput.textContent = `${value}%`;
setLightIntensity(value);
});
/*
WCAG-style relative luminance and contrast ratio calculation.
These are estimates based on the unlit design colors; live lighting,
tone mapping, and display calibration can affect the final appearance.
*/
function hexToRgb(hex) {
const value = parseInt(hex.replace("#", ""), 16);
return [
(value >> 16) & 255,
(value >> 8) & 255,
value & 255
];
}
function srgbToLinear(channel) {
const value = channel / 255;
return value <= 0.04045
? value / 12.92
: Math.pow((value + 0.055) / 1.055, 2.4);
}
function relativeLuminance(hex) {
const [r, g, b] = hexToRgb(hex).map(srgbToLinear);
return (
0.2126 * r +
0.7152 * g +
0.0722 * b
);
}
function contrastRatio(first, second) {
const a = relativeLuminance(first);
const b = relativeLuminance(second);
return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
}
document.querySelector("#high-ratio").textContent =
`${contrastRatio("#f5a623", "#091321").toFixed(1)}:1`;
document.querySelector("#low-ratio").textContent =
`${contrastRatio("#f5a623", "#8f8577").toFixed(1)}:1`;
/*
Custom camera controls implemented directly here.
A single camera is rendered into both viewport regions.
*/
let dragging = false;
let pointerX = 0;
let pointerY = 0;
function resetCamera() {
Object.assign(cameraState, defaultCamera);
updateCamera();
}
canvas.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
canvas.classList.add("dragging");
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - pointerX;
const deltaY = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraState.yaw -= deltaX * 0.005;
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + deltaY * 0.0035,
-0.12,
0.62
);
updateCamera();
});
function endDrag(event) {
dragging = false;
canvas.classList.remove("dragging");
if (event.pointerId !== undefined && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
4.5,
9.5
);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetCamera);
document.querySelector("#reset-camera").addEventListener("click", resetCamera);
/*
View controls: 1 = split, 2 = high, 3 = low.
Both scenes always remain synchronized.
*/
function setView(view) {
document.body.dataset.view = view;
document.querySelectorAll("[data-view-button]").forEach((button) => {
const active = button.dataset.viewButton === view;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
}
document.querySelectorAll("[data-view-button]").forEach((button) => {
button.addEventListener("click", () => {
setView(button.dataset.viewButton);
});
});
window.addEventListener("keydown", (event) => {
const tag = document.activeElement?.tagName;
if (tag === "INPUT" || tag === "BUTTON") return;
if (event.key === "1") setView("split");
if (event.key === "2") setView("high");
if (event.key === "3") setView("low");
if (event.key.toLowerCase() === "r") resetCamera();
});
function resizeRenderer() {
const width = Math.max(1, stage.clientWidth);
const height = Math.max(1, stage.clientHeight);
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resizeRenderer);
resizeObserver.observe(stage);
resizeRenderer();
/*
One renderer with scissor viewports. Each pane maps directly to a
scene background and receives a rendered view of the same camera.
*/
renderer.setAnimationLoop(() => {
const stageRect = stage.getBoundingClientRect();
const width = stage.clientWidth;
const height = stage.clientHeight;
renderer.setScissorTest(false);
renderer.setViewport(0, 0, width, height);
renderer.clear();
renderer.setScissorTest(true);
document.querySelectorAll(".pane").forEach((pane) => {
if (pane.offsetParent === null) return;
const rect = pane.getBoundingClientRect();
const x = rect.left - stageRect.left;
const y = stageRect.bottom - rect.bottom;
renderer.setViewport(x, y, rect.width, rect.height);
renderer.setScissor(x, y, rect.width, rect.height);
camera.aspect = rect.width / Math.max(1, rect.height);
camera.updateProjectionMatrix();
const entry = sceneMap[pane.dataset.scene];
renderer.render(entry.scene, camera);
});
renderer.setScissorTest(false);
});
</script>
</body>
</html>
```