Prompt specification
Build or customize the Three.js 3D scene "Dentate-stamped pottery fragment display" 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: Dentate-stamped pottery fragment display
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/dentate-stamped-pottery-fragment-display-x2285
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a Lapita pottery fragment. Model a small pottery fragment with repeated dentate impressions and a curved rim. Present the decoration as a referenced stylization rather than a copied complete artifact. Voxel style.
Working Three.js Starter (dentate-stamped-pottery-fragment-display-x2285):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#e9dfcf">
<title>Lapita-Inspired Dentate-Stamped Sherd</title>
<style>
:root {
--ink: #32251f;
--muted: #75665b;
--paper: #e9dfcf;
--clay: #b96739;
--stamp: #583126;
--rim: #d58b4d;
--line: rgba(67, 45, 34, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
background:
radial-gradient(circle at 64% 42%, rgba(255, 250, 238, 0.92), transparent 42%),
linear-gradient(145deg, #f2eadc 0%, #e5d8c5 100%);
}
#stage,
#stage canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
#stage canvas {
cursor: grab;
touch-action: none;
outline: none;
}
#stage canvas:active {
cursor: grabbing;
}
.vignette {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
background:
linear-gradient(90deg, rgba(231, 220, 202, 0.34), transparent 32%),
radial-gradient(circle at 52% 45%, transparent 52%, rgba(66, 42, 29, 0.09));
}
.identity {
position: fixed;
z-index: 5;
top: clamp(22px, 4vw, 52px);
left: clamp(22px, 4vw, 58px);
width: min(360px, calc(100vw - 44px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 28px;
height: 1px;
background: currentColor;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(34px, 4.4vw, 64px);
font-weight: 400;
line-height: 0.94;
letter-spacing: -0.045em;
}
.intro {
max-width: 310px;
margin: 19px 0 0;
color: #66564b;
font-size: 13px;
line-height: 1.65;
}
.material-note {
position: fixed;
z-index: 5;
left: clamp(22px, 4vw, 58px);
bottom: clamp(20px, 4vw, 48px);
width: min(430px, calc(100vw - 44px));
padding-top: 14px;
border-top: 1px solid var(--line);
color: #78685d;
font-size: 10px;
line-height: 1.6;
letter-spacing: 0.025em;
pointer-events: none;
}
.material-note strong {
color: var(--ink);
font-weight: 750;
}
.panel {
position: fixed;
z-index: 6;
right: clamp(18px, 3vw, 42px);
bottom: clamp(18px, 3vw, 38px);
width: 220px;
padding: 16px;
border: 1px solid rgba(83, 56, 42, 0.16);
border-radius: 3px;
background: rgba(244, 237, 225, 0.72);
box-shadow: 0 18px 50px rgba(71, 46, 31, 0.08);
backdrop-filter: blur(12px);
}
.legend-title,
.control-title {
margin: 0 0 10px;
color: #67564a;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.legend-row {
display: grid;
grid-template-columns: 11px 1fr;
align-items: center;
gap: 9px;
margin: 8px 0;
color: #594a40;
font-size: 11px;
}
.swatch {
width: 10px;
height: 10px;
border-radius: 1px;
box-shadow: inset 0 0 0 1px rgba(55, 35, 25, 0.12);
}
.swatch.clay {
background: var(--clay);
}
.swatch.stamp {
background: var(--stamp);
}
.swatch.rim {
background: var(--rim);
}
.divider {
height: 1px;
margin: 14px 0;
background: var(--line);
}
.control-title {
margin-bottom: 8px;
}
.hint {
margin: 0 0 12px;
color: #75665b;
font-size: 10px;
line-height: 1.55;
}
.button-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
}
button {
min-height: 34px;
padding: 7px 9px;
border: 1px solid rgba(77, 52, 38, 0.2);
border-radius: 2px;
background: rgba(255, 252, 245, 0.64);
color: #4d3d33;
font: inherit;
font-size: 10px;
font-weight: 700;
cursor: pointer;
transition:
background 160ms ease,
transform 160ms ease;
}
button:hover {
background: rgba(255, 252, 245, 0.95);
transform: translateY(-1px);
}
button:focus-visible {
outline: 2px solid rgba(120, 72, 42, 0.55);
outline-offset: 2px;
}
.study-number {
position: fixed;
z-index: 4;
top: clamp(22px, 4vw, 52px);
right: clamp(22px, 4vw, 58px);
color: rgba(65, 44, 32, 0.48);
font-family: Georgia, "Times New Roman", serif;
font-size: 12px;
font-style: italic;
pointer-events: none;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: var(--paper);
color: #75665b;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
transition: opacity 500ms ease;
}
#loading.is-hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 720px) {
.identity {
top: 20px;
}
h1 {
max-width: 260px;
font-size: 37px;
}
.intro {
display: none;
}
.material-note {
bottom: 20px;
max-width: calc(100vw - 270px);
font-size: 9px;
}
.panel {
right: 14px;
bottom: 14px;
width: 202px;
padding: 13px;
}
.study-number {
display: none;
}
}
@media (max-width: 480px) {
.material-note {
display: none;
}
.panel {
left: 14px;
right: 14px;
bottom: 14px;
width: auto;
}
.legend {
display: none;
}
.divider {
margin: 10px 0;
}
}
</style>
</head>
<body>
<main id="stage" aria-label="Interactive three-dimensional voxel pottery fragment"></main>
<div class="vignette" aria-hidden="true"></div>
<header class="identity">
<div class="eyebrow">Lapita-inspired · Voxel study</div>
<h1>Dentate-stamped<br>sherd</h1>
<p class="intro">
A small curved-rim fragment interpreted through stepped clay cells,
recessed serrated impressions, and repeated horizontal stamp bands.
</p>
</header>
<div class="study-number" aria-hidden="true">Form study — 01</div>
<aside class="panel" aria-label="Visualization legend and controls">
<div class="legend">
<p class="legend-title">Material key</p>
<div class="legend-row">
<span class="swatch clay" aria-hidden="true"></span>
<span>Oxidized terracotta body</span>
</div>
<div class="legend-row">
<span class="swatch stamp" aria-hidden="true"></span>
<span>Recessed dentate impressions</span>
</div>
<div class="legend-row">
<span class="swatch rim" aria-hidden="true"></span>
<span>Thickened curved rim</span>
</div>
</div>
<div class="divider"></div>
<p class="control-title">Camera</p>
<p class="hint">Drag to orbit · Scroll or pinch to zoom</p>
<div class="button-row">
<button id="reset-view" type="button">Reset view</button>
<button id="toggle-orbit" type="button" aria-pressed="false">Start orbit</button>
</div>
</aside>
<div class="material-note">
<strong>Interpretive reference.</strong>
Stylized from generalized Lapita dentate-stamped ceramic conventions;
this is not a facsimile, scan, or reconstruction of a complete vessel.
</div>
<div id="loading">Preparing ceramic study…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.querySelector("#stage");
const loading = document.querySelector("#loading");
const resetButton = document.querySelector("#reset-view");
const orbitButton = document.querySelector("#toggle-orbit");
const prefersReducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
// ------------------------------------------------------------------
// Renderer, scene, and camera
// ------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeadfce);
scene.fog = new THREE.Fog(0xeadfce, 11, 23);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
60
);
let renderer;
try {
renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
} catch (error) {
loading.textContent = "WebGL is required to display this study.";
throw error;
}
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;
stage.appendChild(renderer.domElement);
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Orbitable voxel model of a curved-rim, dentate-stamped pottery fragment"
);
const displayOffsetX = 0.32;
const displayCenterZ = 1.65;
// ------------------------------------------------------------------
// Lighting and display environment
// ------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(
0xfff2d8,
0x725345,
1.55
);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffd8a9, 4.1);
keyLight.position.set(-3.8, 7.5, 6.5);
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.0005;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xa8c8dc, 1.25);
fillLight.position.set(5, 3.5, -4.5);
scene.add(fillLight);
const rimLight = new THREE.PointLight(0xf1a65f, 16, 12, 2);
rimLight.position.set(-3.5, 2.8, 2.5);
scene.add(rimLight);
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
new THREE.MeshStandardMaterial({
color: 0xe4d8c7,
roughness: 1,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -2.035;
ground.receiveShadow = true;
scene.add(ground);
function addBox(width, height, depth, x, y, z, color, roughness = 0.92) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
new THREE.MeshStandardMaterial({
color,
roughness,
metalness: 0,
flatShading: true
})
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
// A restrained, stepped display plinth reinforces the voxel language.
addBox(
4.15,
0.20,
3.15,
displayOffsetX,
-1.92,
displayCenterZ,
0xc8bba8
);
addBox(
3.55,
0.16,
2.65,
displayOffsetX,
-1.74,
displayCenterZ,
0xd8cdbb
);
const grid = new THREE.GridHelper(
3.45,
8,
0x9e8976,
0xb5a28e
);
grid.position.set(displayOffsetX, -1.653, displayCenterZ);
grid.material.transparent = true;
grid.material.opacity = 0.16;
scene.add(grid);
// ------------------------------------------------------------------
// Procedural voxel sherd
//
// The artifact is an intentionally incomplete shell patch, not a
// complete vessel. Its angular span, irregular lower break, and
// chipped side edges establish it as a fragment.
// ------------------------------------------------------------------
const artifact = new THREE.Group();
artifact.position.x = displayOffsetX;
scene.add(artifact);
const columns = 68;
const rows = 34;
const minTheta = -0.80;
const maxTheta = 0.80;
const thetaStep = (maxTheta - minTheta) / columns;
const bottomY = -1.65;
const rowStep = 0.078;
const baseRadius = 2.08;
const middleColumn = (columns - 1) / 2;
function hash(value) {
const x = Math.sin(value * 127.1 + 311.7) * 43758.5453123;
return x - Math.floor(x);
}
function clayColor(column, row, motif = false) {
if (motif) {
return new THREE.Color().setHSL(
0.045 + hash(column + row * 0.07) * 0.018,
0.39,
0.18 + hash(column * 2.1 + row) * 0.025
);
}
if (row === rows - 1) {
return new THREE.Color().setHSL(
0.075,
0.61,
0.52 + hash(column * 3.7) * 0.035
);
}
if (row === rows - 2) {
return new THREE.Color().setHSL(
0.055,
0.56,
0.33 + hash(column * 1.9) * 0.025
);
}
const hue = 0.045 + hash(column * 1.37 + row * 0.23) * 0.026;
const saturation = 0.55 + hash(column + row * 0.61) * 0.15;
const lightness = 0.39 + hash(column * 2.7 + row * 0.91) * 0.12;
return new THREE.Color().setHSL(hue, saturation, lightness);
}
// Each motif is a small stepped, serrated impression. The arrangement
// is deliberately generic rather than copied from a particular object.
const stampOffsets = [
[-2, -1], [0, -1], [2, -1],
[-1, 0], [1, 0],
[-2, 1], [0, 1], [2, 1]
];
const motifCells = new Set();
const motifCenters = [8, 15, 22, 29, 36, 43, 50, 57];
const motifRows = [24, 18, 12];
for (const row of motifRows) {
for (const column of motifCenters) {
for (const [offsetX, offsetY] of stampOffsets) {
motifCells.add(`${column + offsetX},${row + offsetY}`);
}
}
}
function cellExists(column, row) {
const t = row / (rows - 1);
const jaggedHalfWidth =
THREE.MathUtils.lerp(22.0, 33.2, t) +
(hash(column * 8.4 + 1.7) - 0.5) * 2.15;
const brokenBottom = Math.floor(hash(column * 2.73 + 4.1) * 4.7);
if (row < brokenBottom) return false;
if (Math.abs(column - middleColumn) > jaggedHalfWidth) return false;
// Small chips interrupt the otherwise readable curved rim.
const atEdge = column <= 1 || column >= columns - 2;
if (atEdge && row >= rows - 2 && hash(column * 9.3) > 0.34) {
return false;
}
return true;
}
const outerCells = [];
const innerCells = [];
for (let column = 0; column < columns; column++) {
for (let row = 0; row < rows; row++) {
if (!cellExists(column, row)) continue;
const theta =
minTheta + (column + 0.5) * thetaStep;
const y = bottomY + (row + 0.5) * rowStep;
const localRadius =
baseRadius +
Math.sin(column * 0.73 + row * 0.11) * 0.009 +
Math.sin(row * 0.58) * 0.007;
const motif = motifCells.has(`${column},${row}`);
const isRim = row === rows - 1;
const tangentialSize =
localRadius * thetaStep * (isRim ? 0.98 : 0.94);
const verticalSize = rowStep * (isRim ? 1.32 : 0.92);
// Motif cells are shifted inward and shortened, creating a
// readable recessed impression instead of a painted overlay.
const outerRadius = motif
? localRadius - 0.035
: localRadius + (isRim ? 0.015 : 0);
const outerDepth = motif
? 0.16
: isRim
? 0.27
: 0.22;
outerCells.push({
theta,
y,
radius: outerRadius,
scaleX: tangentialSize,
scaleY: verticalSize,
scaleZ: outerDepth,
color: clayColor(column, row, motif)
});
// A darker inner voxel layer gives the broken shell visual
// thickness and remains visible along the irregular edges.
innerCells.push({
theta,
y,
radius: 1.93 + Math.sin(column * 0.4) * 0.006,
scaleX: tangentialSize * 0.96,
scaleY: rowStep * 0.92,
scaleZ: 0.16,
color: new THREE.Color().setHSL(
0.035,
0.42,
0.25 + hash(column + row * 0.4) * 0.025
)
});
}
}
const voxelGeometry = new THREE.BoxGeometry(1, 1, 1);
const dummy = new THREE.Object3D();
function makeInstancedMesh(records, material) {
const mesh = new THREE.InstancedMesh(
voxelGeometry,
material,
records.length
);
for (let index = 0; index < records.length; index++) {
const cell = records[index];
const theta = cell.theta;
// Local X follows the vessel tangent, local Y is vertical,
// and local Z points radially through the ceramic wall.
const tangent = new THREE.Vector3(
Math.cos(theta),
0,
-Math.sin(theta)
);
const up = new THREE.Vector3(0, 1, 0);
const radial = new THREE.Vector3(
Math.sin(theta),
0,
Math.cos(theta)
);
const basis = new THREE.Matrix4().makeBasis(
tangent,
up,
radial
);
dummy.position.set(
Math.sin(theta) * cell.radius,
cell.y,
Math.cos(theta) * cell.radius
);
dummy.quaternion.setFromRotationMatrix(basis);
dummy.scale.set(
cell.scaleX,
cell.scaleY,
cell.scaleZ
);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
mesh.setColorAt(index, cell.color);
}
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) {
mesh.instanceColor.needsUpdate = true;
}
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.frustumCulled = false;
artifact.add(mesh);
return mesh;
}
makeInstancedMesh(
outerCells,
new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.94,
metalness: 0,
flatShading: true
})
);
makeInstancedMesh(
innerCells,
new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 1,
metalness: 0,
flatShading: true
})
);
// ------------------------------------------------------------------
// Direct camera controls — no external control modules
// ------------------------------------------------------------------
const target = new THREE.Vector3(
displayOffsetX,
-0.28,
displayCenterZ + 0.08
);
const defaultView = {
theta: 0.58,
phi: 1.19,
radius: 6.8
};
let targetTheta = defaultView.theta;
let targetPhi = defaultView.phi;
let targetRadius = defaultView.radius;
let currentTheta = targetTheta;
let currentPhi = targetPhi;
let currentRadius = targetRadius;
let autoOrbit = false;
const pointers = new Map();
let previousPinchDistance = 0;
function clampView() {
targetPhi = THREE.MathUtils.clamp(targetPhi, 0.48, 1.46);
targetRadius = THREE.MathUtils.clamp(targetRadius, 4.35, 10.5);
}
function pinchDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.focus({ preventScroll: true });
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 2) {
previousPinchDistance = pinchDistance();
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
const previous = pointers.get(event.pointerId);
if (!previous) return;
const next = {
x: event.clientX,
y: event.clientY
};
pointers.set(event.pointerId, next);
if (pointers.size >= 2) {
const distance = pinchDistance();
if (previousPinchDistance > 0 && distance > 0) {
targetRadius *=
previousPinchDistance / distance;
clampView();
}
previousPinchDistance = distance;
return;
}
const deltaX = next.x - previous.x;
const deltaY = next.y - previous.y;
targetTheta -= deltaX * 0.006;
targetPhi -= deltaY * 0.005;
clampView();
});
function endPointer(event) {
pointers.delete(event.pointerId);
previousPinchDistance = pinchDistance();
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener("lostpointercapture", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
targetRadius *= Math.exp(event.deltaY * 0.001);
clampView();
},
{ passive: false }
);
renderer.domElement.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
targetTheta -= 0.12;
break;
case "ArrowRight":
targetTheta += 0.12;
break;
case "ArrowUp":
targetPhi -= 0.08;
break;
case "ArrowDown":
targetPhi += 0.08;
break;
case "+":
case "=":
targetRadius -= 0.35;
break;
case "-":
case "_":
targetRadius += 0.35;
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
clampView();
}
});
function resetView() {
targetTheta = defaultView.theta;
targetPhi = defaultView.phi;
targetRadius = defaultView.radius;
clampView();
}
resetButton.addEventListener("click", resetView);
renderer.domElement.addEventListener("dblclick", resetView);
function updateOrbitButton() {
orbitButton.textContent = autoOrbit
? "Pause orbit"
: "Start orbit";
orbitButton.setAttribute(
"aria-pressed",
String(autoOrbit)
);
}
orbitButton.addEventListener("click", () => {
autoOrbit = !autoOrbit;
updateOrbitButton();
});
if (prefersReducedMotion) {
autoOrbit = false;
updateOrbitButton();
}
// ------------------------------------------------------------------
// Resize and render loop
// ------------------------------------------------------------------
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
camera.aspect = aspect;
camera.fov = aspect < 0.75 ? 48 : 38;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
resize();
let previousTime = performance.now();
let firstFrame = true;
renderer.setAnimationLoop((time) => {
const delta = Math.min(
0.05,
Math.max(0.001, (time - previousTime) / 1000)
);
previousTime = time;
if (autoOrbit && pointers.size === 0) {
targetTheta += delta * 0.16;
}
const smoothing = 1 - Math.exp(-delta * 10);
currentTheta +=
(targetTheta - currentTheta) * smoothing;
currentPhi +=
(targetPhi - currentPhi) * smoothing;
currentRadius +=
(targetRadius - currentRadius) * smoothing;
const sinPhi = Math.sin(currentPhi);
const cosPhi = Math.cos(currentPhi);
camera.position.set(
target.x +
currentRadius * sinPhi * Math.sin(currentTheta),
target.y + currentRadius * cosPhi,
target.z +
currentRadius * sinPhi * Math.cos(currentTheta)
);
camera.lookAt(target);
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
loading.classList.add("is-hidden");
}
});
</script>
</body>
</html>
```