Prompt specification
Build or customize the Three.js 3D scene "Manuscript wrapper and wooden book support" 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: Manuscript wrapper and wooden book support
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/manuscript-wrapper-and-wooden-book-support-x2397
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a manuscript bundle and reading support from Timbuktu. Model a wrapped manuscript bundle beside a simple wooden reading support. Show the protective cover and separate leaves without inventing a specific historic text. Stylized solid forms.
Working Three.js Starter (manuscript-wrapper-and-wooden-book-support-x2397):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Manuscript Bundle and Reading Support — Timbuktu</title>
<style>
:root {
color-scheme: light;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #c9ad83;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.caption {
position: fixed;
z-index: 2;
top: 22px;
left: 24px;
max-width: min(390px, calc(100vw - 48px));
padding: 15px 18px;
color: #fff7e8;
background: rgba(57, 31, 20, 0.78);
border: 1px solid rgba(255, 239, 208, 0.22);
border-radius: 12px;
backdrop-filter: blur(10px);
box-shadow: 0 12px 32px rgba(45, 25, 15, 0.18);
pointer-events: none;
}
.caption h1 {
margin: 0 0 5px;
font-size: clamp(1rem, 2vw, 1.28rem);
font-weight: 650;
letter-spacing: 0.01em;
}
.caption p {
margin: 0;
color: #e9d7ba;
font-size: 0.84rem;
line-height: 1.45;
}
.controls {
position: fixed;
z-index: 3;
right: 20px;
bottom: 20px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
button {
appearance: none;
border: 1px solid rgba(255, 239, 208, 0.28);
border-radius: 9px;
padding: 9px 13px;
color: #fff6e6;
background: rgba(57, 31, 20, 0.82);
font: inherit;
font-size: 0.83rem;
cursor: pointer;
backdrop-filter: blur(8px);
transition: background 150ms ease, transform 150ms ease;
}
button:hover {
background: rgba(91, 48, 29, 0.94);
}
button:active {
transform: translateY(1px);
}
button[aria-pressed="true"] {
color: #3d2417;
background: #e5c494;
}
.hint {
position: fixed;
z-index: 2;
left: 24px;
bottom: 22px;
color: rgba(61, 36, 23, 0.78);
font-size: 0.8rem;
pointer-events: none;
text-shadow: 0 1px 0 rgba(255, 245, 225, 0.35);
}
#loading {
position: fixed;
inset: 0;
z-index: 10;
display: grid;
place-items: center;
color: #5b3824;
background: #c9ad83;
font-size: 0.95rem;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 650px) {
.caption {
top: 12px;
left: 12px;
padding: 11px 13px;
}
.caption p {
font-size: 0.76rem;
}
.controls {
right: 12px;
bottom: 12px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<div class="caption">
<h1>Manuscript Bundle & Reading Support</h1>
<p>A stylized Timbuktu study: leather protection, blank separate leaves, and a simple wooden support.</p>
</div>
<div class="hint">Drag to orbit · Scroll or pinch to zoom · Arrow keys to adjust</div>
<div class="controls">
<button id="reset" type="button">Reset view</button>
<button id="rotate" type="button" aria-pressed="false">Auto rotate</button>
</div>
<div id="loading">Preparing the scene…</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer, camera, lighting, and environment
// ------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc9ad83);
scene.fog = new THREE.Fog(0xc9ad83, 11, 24);
const camera = new THREE.PerspectiveCamera(38, innerWidth / innerHeight, 0.1, 50);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, 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",
"Interactive three-dimensional model of a manuscript bundle, blank leaves, and a wooden reading support"
);
document.body.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xfff0cf, 0x65442f, 1.85);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffdfaa, 3.15);
keyLight.position.set(4.8, 7.5, 4.2);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -6;
keyLight.shadow.camera.right = 6;
keyLight.shadow.camera.top = 6;
keyLight.shadow.camera.bottom = -6;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 20;
keyLight.shadow.bias = -0.0004;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb8cbd0, 0.8);
fillLight.position.set(-4, 3.5, -3.5);
scene.add(fillLight);
const warmBounce = new THREE.DirectionalLight(0xe39a58, 0.55);
warmBounce.position.set(1, 2, 5);
scene.add(warmBounce);
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0xb69a73,
roughness: 1
});
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
floorMaterial
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.22;
floor.receiveShadow = true;
scene.add(floor);
const plinthMaterial = new THREE.MeshStandardMaterial({
color: 0xb58d5f,
roughness: 0.92
});
const plinth = new THREE.Mesh(
new THREE.CylinderGeometry(4.25, 4.38, 0.16, 96),
plinthMaterial
);
plinth.position.y = -0.08;
plinth.receiveShadow = true;
plinth.castShadow = true;
scene.add(plinth);
// ------------------------------------------------------------
// Materials
// ------------------------------------------------------------
const leatherMaterial = new THREE.MeshStandardMaterial({
color: 0x713820,
roughness: 0.82,
metalness: 0
});
const leatherSideMaterial = new THREE.MeshStandardMaterial({
color: 0x5d2d1c,
roughness: 0.88,
metalness: 0
});
const leatherPanelMaterial = new THREE.MeshStandardMaterial({
color: 0x85452a,
roughness: 0.76,
metalness: 0
});
const cordMaterial = new THREE.MeshStandardMaterial({
color: 0xc29a64,
roughness: 0.94,
metalness: 0
});
const stitchingMaterial = new THREE.MeshStandardMaterial({
color: 0xb88959,
roughness: 0.95,
metalness: 0
});
const pageMaterials = [
new THREE.MeshStandardMaterial({
color: 0xe2c99b,
roughness: 0.96,
metalness: 0
}),
new THREE.MeshStandardMaterial({
color: 0xd9bf90,
roughness: 0.97,
metalness: 0
}),
new THREE.MeshStandardMaterial({
color: 0xe7d1a7,
roughness: 0.95,
metalness: 0
})
];
const pageBlockMaterial = new THREE.MeshStandardMaterial({
color: 0xd7bd8b,
roughness: 0.98,
metalness: 0
});
const woodMaterial = new THREE.MeshStandardMaterial({
color: 0x653820,
roughness: 0.72,
metalness: 0
});
const woodEdgeMaterial = new THREE.MeshStandardMaterial({
color: 0x4c2b1a,
roughness: 0.8,
metalness: 0
});
// ------------------------------------------------------------
// Geometry helpers
// ------------------------------------------------------------
function roundedShape(width, depth, radius) {
const x = -width / 2;
const y = -depth / 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 + depth - radius);
shape.quadraticCurveTo(
x + width,
y + depth,
x + width - radius,
y + depth
);
shape.lineTo(x + radius, y + depth);
shape.quadraticCurveTo(x, y + depth, x, y + depth - radius);
shape.lineTo(x, y + radius);
shape.quadraticCurveTo(x, y, x + radius, y);
return shape;
}
function roundedSlab(width, depth, height, radius, bevel = 0.015) {
const geometry = new THREE.ExtrudeGeometry(
roundedShape(width, depth, radius),
{
depth: height,
steps: 1,
curveSegments: 10,
bevelEnabled: bevel > 0,
bevelSegments: 2,
bevelSize: bevel,
bevelThickness: bevel
}
);
// The slab is created in XY, extruded along Z, then laid on XZ.
geometry.rotateX(-Math.PI / 2);
geometry.computeBoundingBox();
geometry.translate(0, -geometry.boundingBox.min.y, 0);
geometry.computeVertexNormals();
return geometry;
}
function createTube(points, radius, material, closed = false, segments = 64) {
const curve = new THREE.CatmullRomCurve3(
points.map(point => new THREE.Vector3(...point)),
closed,
"catmullrom",
0.16
);
const geometry = new THREE.TubeGeometry(
curve,
segments,
radius,
8,
closed
);
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
return mesh;
}
function addMesh(parent, geometry, material, position = [0, 0, 0]) {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// ------------------------------------------------------------
// Wrapped manuscript bundle
// ------------------------------------------------------------
const bundle = new THREE.Group();
bundle.position.set(-1.35, 0.02, -0.08);
bundle.rotation.y = -0.13;
scene.add(bundle);
// Lower protective cover.
addMesh(
bundle,
roundedSlab(1.70, 2.20, 0.18, 0.17, 0.025),
leatherMaterial
);
// The compact manuscript block beneath the cover.
addMesh(
bundle,
roundedSlab(1.48, 1.96, 0.54, 0.12, 0.012),
pageBlockMaterial,
[0, 0.19, 0]
);
// Wrapped side and front portions of the protective cover.
const leftWrap = addMesh(
bundle,
new THREE.BoxGeometry(0.11, 0.54, 1.84),
leatherSideMaterial,
[-0.80, 0.45, 0]
);
leftWrap.castShadow = true;
const rightWrap = addMesh(
bundle,
new THREE.BoxGeometry(0.11, 0.54, 1.84),
leatherSideMaterial,
[0.80, 0.45, 0]
);
rightWrap.castShadow = true;
const frontWrap = addMesh(
bundle,
new THREE.BoxGeometry(1.52, 0.52, 0.10),
leatherSideMaterial,
[0, 0.44, 1.07]
);
frontWrap.rotation.x = -0.025;
frontWrap.castShadow = true;
// Upper protective cover.
addMesh(
bundle,
roundedSlab(1.72, 2.22, 0.16, 0.18, 0.028),
leatherMaterial,
[0, 0.71, 0]
);
// Plain raised cover panel: deliberately without writing or symbols.
addMesh(
bundle,
roundedSlab(1.13, 1.55, 0.028, 0.10, 0.006),
leatherPanelMaterial,
[0, 0.855, 0]
);
// Fine stitched border around the blank cover panel.
const stitchPoints = roundedShape(1.04, 1.44, 0.085)
.getSpacedPoints(88)
.map(point => new THREE.Vector3(point.x, 0.904, -point.y));
const stitchCurve = new THREE.CatmullRomCurve3(
stitchPoints,
true,
"catmullrom",
0.12
);
const stitching = new THREE.Mesh(
new THREE.TubeGeometry(stitchCurve, 112, 0.006, 6, true),
stitchingMaterial
);
stitching.castShadow = true;
bundle.add(stitching);
// Two leather-colored binding cords wrap around the bundle.
for (const z of [-0.53, 0.51]) {
const wrapPoints = [
[-0.89, 0.07, z],
[-0.89, 0.75, z],
[-0.73, 0.94, z],
[0.73, 0.94, z],
[0.89, 0.75, z],
[0.89, 0.07, z]
];
bundle.add(createTube(wrapPoints, 0.024, cordMaterial));
}
// Longitudinal tie and hanging tails.
bundle.add(
createTube(
[
[0.34, 0.95, -1.10],
[0.34, 0.96, -0.20],
[0.34, 0.96, 0.58],
[0.28, 0.87, 1.13],
[0.19, 0.64, 1.16]
],
0.018,
cordMaterial,
false,
72
)
);
bundle.add(
createTube(
[
[0.34, 0.95, 0.62],
[0.08, 1.00, 0.82],
[-0.10, 0.95, 0.72],
[0.34, 0.95, 0.62]
],
0.016,
cordMaterial,
true
)
);
bundle.add(
createTube(
[
[0.34, 0.95, 0.62],
[0.59, 0.99, 0.84],
[0.69, 0.94, 0.70],
[0.34, 0.95, 0.62]
],
0.016,
cordMaterial,
true
)
);
const knot = addMesh(
bundle,
new THREE.SphereGeometry(0.065, 18, 12),
cordMaterial,
[0.34, 0.96, 0.62]
);
knot.scale.set(1.0, 0.62, 1.0);
// ------------------------------------------------------------
// Separate blank manuscript leaves
// ------------------------------------------------------------
const leafStack = new THREE.Group();
leafStack.position.set(-0.06, 0.015, 1.43);
leafStack.rotation.y = 0.12;
scene.add(leafStack);
const leafOffsets = [
[-0.08, -0.04, -0.10],
[0.03, 0.02, -0.04],
[-0.02, 0.05, 0.02],
[0.06, 0.03, 0.07],
[0.01, -0.01, 0]
];
for (let i = 0; i < leafOffsets.length; i++) {
const [x, z, angle] = leafOffsets[i];
const leaf = addMesh(
leafStack,
roundedSlab(1.08, 1.50, 0.016, 0.055, 0.004),
pageMaterials[i % pageMaterials.length],
[x, 0.035 + i * 0.035, z]
);
leaf.rotation.y = angle;
}
// The upper leaf has a gentle solid curl, making the separation clear.
const curvedLeafGeometry = roundedSlab(1.10, 1.52, 0.018, 0.06, 0.004);
const curvedPositions = curvedLeafGeometry.attributes.position;
for (let i = 0; i < curvedPositions.count; i++) {
const localZ = curvedPositions.getZ(i);
const normalizedZ = localZ / 0.76;
const lift =
0.15 * (1 - normalizedZ * normalizedZ) +
0.025 * normalizedZ;
curvedPositions.setY(
i,
curvedPositions.getY(i) + lift
);
}
curvedPositions.needsUpdate = true;
curvedLeafGeometry.computeVertexNormals();
const curvedLeaf = addMesh(
leafStack,
curvedLeafGeometry,
pageMaterials[2],
[0.02, 0.22, 0]
);
curvedLeaf.rotation.y = -0.045;
// ------------------------------------------------------------
// Simple wooden reading support
// ------------------------------------------------------------
const support = new THREE.Group();
support.position.set(1.48, 0, -0.48);
support.rotation.y = -0.17;
scene.add(support);
// Sloping upper board.
const deck = new THREE.Group();
deck.position.y = 0.84;
deck.rotation.x = 0.19;
support.add(deck);
addMesh(
deck,
roundedSlab(1.48, 1.80, 0.12, 0.085, 0.014),
woodMaterial
);
// Two raised wooden retaining rails.
addMesh(
deck,
roundedSlab(0.13, 1.48, 0.09, 0.035, 0.009),
woodEdgeMaterial,
[-0.50, 0.11, 0]
);
addMesh(
deck,
roundedSlab(0.13, 1.48, 0.09, 0.035, 0.009),
woodEdgeMaterial,
[0.50, 0.11, 0]
);
// Four solid legs of different heights to meet the sloping deck.
const frontLegGeometry = new THREE.BoxGeometry(0.15, 0.62, 0.15);
const rearLegGeometry = new THREE.BoxGeometry(0.15, 0.89, 0.15);
for (const x of [-0.59, 0.59]) {
const frontLeg = addMesh(
support,
frontLegGeometry,
woodEdgeMaterial,
[x, 0.31, 0.65]
);
frontLeg.castShadow = true;
const rearLeg = addMesh(
support,
rearLegGeometry,
woodEdgeMaterial,
[x, 0.445, -0.62]
);
rearLeg.castShadow = true;
const frontFoot = addMesh(
support,
roundedSlab(0.27, 0.30, 0.065, 0.04, 0.008),
woodMaterial,
[x, 0, 0.65]
);
frontFoot.castShadow = true;
const rearFoot = addMesh(
support,
roundedSlab(0.27, 0.30, 0.065, 0.04, 0.008),
woodMaterial,
[x, 0, -0.62]
);
rearFoot.castShadow = true;
}
// Cross braces and lower side stretchers.
addMesh(
support,
new THREE.BoxGeometry(1.33, 0.14, 0.14),
woodMaterial,
[0, 0.61, 0.65]
);
addMesh(
support,
new THREE.BoxGeometry(1.33, 0.14, 0.14),
woodMaterial,
[0, 0.88, -0.62]
);
addMesh(
support,
new THREE.BoxGeometry(0.12, 0.12, 1.42),
woodEdgeMaterial,
[-0.59, 0.24, 0]
);
addMesh(
support,
new THREE.BoxGeometry(0.12, 0.12, 1.42),
woodEdgeMaterial,
[0.59, 0.24, 0]
);
// ------------------------------------------------------------
// Direct camera controls — no addons
// ------------------------------------------------------------
const target = new THREE.Vector3(0, 0.55, 0.18);
let radius = 7.45;
let theta = 0.58;
let phi = 1.04;
let autoRotate = false;
const pointerPositions = new Map();
let lastPinchDistance = 0;
function updateCamera() {
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(target);
}
function resetCamera() {
radius = 7.45;
theta = 0.58;
phi = 1.04;
target.set(0, 0.55, 0.18);
updateCamera();
}
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", event => {
pointerPositions.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
canvas.setPointerCapture(event.pointerId);
if (pointerPositions.size === 2) {
const points = [...pointerPositions.values()];
lastPinchDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
}
});
canvas.addEventListener("pointermove", event => {
const previous = pointerPositions.get(event.pointerId);
if (!previous) return;
const current = {
x: event.clientX,
y: event.clientY
};
if (pointerPositions.size === 1) {
const dx = current.x - previous.x;
const dy = current.y - previous.y;
theta -= dx * 0.006;
phi = THREE.MathUtils.clamp(phi - dy * 0.005, 0.34, 1.43);
} else if (pointerPositions.size === 2) {
pointerPositions.set(event.pointerId, current);
const points = [...pointerPositions.values()];
const distance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
if (lastPinchDistance > 0 && distance > 0) {
radius = THREE.MathUtils.clamp(
radius * (lastPinchDistance / distance),
4.2,
11.5
);
}
lastPinchDistance = distance;
return;
}
pointerPositions.set(event.pointerId, current);
updateCamera();
});
function releasePointer(event) {
pointerPositions.delete(event.pointerId);
if (pointerPositions.size < 2) {
lastPinchDistance = 0;
}
}
canvas.addEventListener("pointerup", releasePointer);
canvas.addEventListener("pointercancel", releasePointer);
canvas.addEventListener("lostpointercapture", releasePointer);
canvas.addEventListener("wheel", event => {
event.preventDefault();
radius = THREE.MathUtils.clamp(
radius * Math.exp(event.deltaY * 0.001),
4.2,
11.5
);
updateCamera();
}, { passive: false });
canvas.addEventListener("dblclick", resetCamera);
window.addEventListener("keydown", event => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
theta += 0.08;
break;
case "ArrowRight":
theta -= 0.08;
break;
case "ArrowUp":
phi = THREE.MathUtils.clamp(phi - 0.06, 0.34, 1.43);
break;
case "ArrowDown":
phi = THREE.MathUtils.clamp(phi + 0.06, 0.34, 1.43);
break;
case "+":
case "=":
radius = THREE.MathUtils.clamp(radius - 0.35, 4.2, 11.5);
break;
case "-":
radius = THREE.MathUtils.clamp(radius + 0.35, 4.2, 11.5);
break;
case "r":
case "R":
resetCamera();
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
updateCamera();
}
});
document.getElementById("reset").addEventListener("click", resetCamera);
const rotateButton = document.getElementById("rotate");
rotateButton.addEventListener("click", () => {
autoRotate = !autoRotate;
rotateButton.setAttribute("aria-pressed", String(autoRotate));
rotateButton.textContent = autoRotate ? "Stop rotation" : "Auto rotate";
});
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
});
// ------------------------------------------------------------
// Animation
// ------------------------------------------------------------
const clock = new THREE.Clock();
let firstFrame = true;
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
if (autoRotate) {
theta += delta * 0.11;
updateCamera();
}
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
document.getElementById("loading").classList.add("hidden");
}
}
updateCamera();
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```