Prompt specification
Build or customize the Three.js 3D scene "Relief Stamp and Mirrored Mark" 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: Relief Stamp and Mirrored Mark
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/relief-stamp-and-mirrored-mark-x3333
Scene Description Prompt:
Create a standalone stylized scene in one HTML file using Three.js from cdnjs. Place a raised asymmetric geometric symbol on a stamp beside its printed impression. Make their mirror relationship obvious using a notch rather than relying on readable letters.
Working Three.js Starter (relief-stamp-and-mirrored-mark-x3333):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notched Stamp Study</title>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e7e0d3;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
box-shadow: inset 0 0 130px rgba(67, 53, 39, 0.14);
}
</style>
</head>
<body>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
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;
document.body.appendChild(renderer.domElement);
renderer.domElement.setAttribute(
"aria-label",
"A raised geometric stamp symbol beside its mirrored printed impression"
);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe7e0d3);
scene.fog = new THREE.Fog(0xe7e0d3, 19, 34);
const camera = new THREE.OrthographicCamera(-6, 6, 4, -4, 0.1, 100);
const target = new THREE.Vector3(0.15, 0.7, 0.05);
let theta = 0.17;
let phi = 0.77;
const cameraRadius = 14;
function updateCamera() {
camera.position.set(
target.x + cameraRadius * Math.sin(phi) * Math.sin(theta),
target.y + cameraRadius * Math.cos(phi),
target.z + cameraRadius * Math.sin(phi) * Math.cos(theta)
);
camera.lookAt(target);
}
updateCamera();
// Lighting
scene.add(
new THREE.HemisphereLight(0xfff7e9, 0x82796d, 2.05)
);
const keyLight = new THREE.DirectionalLight(0xffefd9, 4.1);
keyLight.position.set(-5, 11, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.normalBias = 0.025;
keyLight.shadow.bias = -0.0002;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xc8dcff, 1.25);
fillLight.position.set(7, 6, -5);
scene.add(fillLight);
// Procedural textures
let seed = 78231;
function random() {
seed = (seed * 1664525 + 1013904223) >>> 0;
return seed / 4294967296;
}
function makeWoodTexture() {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 512;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#9b5a38";
ctx.fillRect(0, 0, 512, 512);
for (let x = -20; x < 540; x += 7) {
const darkness = 0.035 + random() * 0.11;
ctx.strokeStyle = `rgba(55, 24, 12, ${darkness})`;
ctx.lineWidth = 1 + random() * 3;
ctx.beginPath();
ctx.moveTo(x, 0);
ctx.bezierCurveTo(
x + random() * 25 - 12,
150,
x + random() * 28 - 14,
350,
x + random() * 18 - 9,
512
);
ctx.stroke();
}
for (let i = 0; i < 900; i++) {
ctx.fillStyle = `rgba(255, 218, 160, ${random() * 0.055})`;
ctx.fillRect(
random() * 512,
random() * 512,
1 + random() * 2,
8 + random() * 28
);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function makePaperTexture() {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 512;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#faf7ef";
ctx.fillRect(0, 0, 512, 512);
for (let i = 0; i < 17000; i++) {
const alpha = random() * 0.045;
ctx.fillStyle = `rgba(94, 77, 54, ${alpha})`;
ctx.fillRect(
random() * 512,
random() * 512,
0.6 + random() * 1.8,
0.6 + random() * 1.8
);
}
for (let i = 0; i < 150; i++) {
ctx.strokeStyle = `rgba(125, 104, 76, ${random() * 0.035})`;
ctx.lineWidth = 0.6;
const x = random() * 512;
const y = random() * 512;
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + random() * 35, y + random() * 5);
ctx.stroke();
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
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 roundedRectGeometry(
width,
height,
radius,
depth,
bevelSize = 0.04
) {
const geometry = new THREE.ExtrudeGeometry(
roundedRectShape(width, height, radius),
{
depth,
steps: 1,
bevelEnabled: true,
bevelSegments: 3,
bevelSize,
bevelThickness: bevelSize,
curveSegments: 12
}
);
geometry.translate(0, 0, -depth / 2);
geometry.rotateX(-Math.PI / 2);
geometry.computeVertexNormals();
return geometry;
}
// The single deep edge notch makes the mirroring readable without letters.
function makeEmblemShape(mirrored = false) {
const outer = [
[-1.00, -0.72],
[ 0.62, -0.72],
[ 1.02, -0.40],
[ 0.48, -0.04], // deep triangular notch
[ 1.02, 0.34],
[ 0.54, 0.74],
[-0.38, 0.58],
[-1.02, 0.82],
[-1.02, -0.72]
];
const hole = [
[-0.18, 0.28],
[ 0.16, -0.05],
[-0.34, -0.20]
];
const transform = points => {
const result = points.map(
([x, y]) => new THREE.Vector2(mirrored ? -x : x, y)
);
// Reflection reverses winding, so reverse the point order as well.
return mirrored ? result.reverse() : result;
};
const shape = new THREE.Shape();
const transformedOuter = transform(outer);
shape.moveTo(
transformedOuter[0].x,
transformedOuter[0].y
);
for (let i = 1; i < transformedOuter.length; i++) {
shape.lineTo(
transformedOuter[i].x,
transformedOuter[i].y
);
}
shape.closePath();
const transformedHole = transform(hole);
const holePath = new THREE.Path();
holePath.moveTo(
transformedHole[0].x,
transformedHole[0].y
);
for (let i = 1; i < transformedHole.length; i++) {
holePath.lineTo(
transformedHole[i].x,
transformedHole[i].y
);
}
holePath.closePath();
shape.holes.push(holePath);
return shape;
}
const woodTexture = makeWoodTexture();
const paperTexture = makePaperTexture();
const woodMaterial = new THREE.MeshStandardMaterial({
map: woodTexture,
roughness: 0.62,
metalness: 0
});
const rubberMaterial = new THREE.MeshStandardMaterial({
color: 0x183f45,
roughness: 0.88,
metalness: 0
});
const emblemMaterial = new THREE.MeshStandardMaterial({
color: 0xe25243,
roughness: 0.62,
metalness: 0
});
const brassMaterial = new THREE.MeshStandardMaterial({
color: 0xc89d5e,
roughness: 0.28,
metalness: 0.78
});
// Ground
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
new THREE.MeshStandardMaterial({
color: 0xd7cebf,
roughness: 1
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.015;
ground.receiveShadow = true;
scene.add(ground);
// Stamp
const stampGroup = new THREE.Group();
stampGroup.position.set(-2.1, 0, 0);
stampGroup.rotation.y = 0.035;
scene.add(stampGroup);
const stampBody = new THREE.Mesh(
roundedRectGeometry(3.15, 2.85, 0.24, 0.66, 0.08),
woodMaterial
);
stampBody.position.y = 0.35;
stampBody.castShadow = true;
stampBody.receiveShadow = true;
stampGroup.add(stampBody);
const rubberPad = new THREE.Mesh(
roundedRectGeometry(2.62, 2.32, 0.18, 0.10, 0.025),
rubberMaterial
);
rubberPad.position.y = 0.73;
rubberPad.castShadow = true;
rubberPad.receiveShadow = true;
stampGroup.add(rubberPad);
const raisedGeometry = new THREE.ExtrudeGeometry(
makeEmblemShape(false),
{
depth: 0.20,
steps: 1,
bevelEnabled: true,
bevelSegments: 3,
bevelSize: 0.035,
bevelThickness: 0.035,
curveSegments: 12
}
);
raisedGeometry.rotateX(-Math.PI / 2);
raisedGeometry.computeVertexNormals();
const raisedEmblem = new THREE.Mesh(
raisedGeometry,
emblemMaterial
);
raisedEmblem.position.set(0, 0.785, 0.20);
raisedEmblem.castShadow = true;
raisedEmblem.receiveShadow = true;
stampGroup.add(raisedEmblem);
// Handle, placed toward the back so it does not hide the relief.
const handleStem = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.13, 0.56, 32),
brassMaterial
);
handleStem.position.set(0, 1.05, -0.94);
handleStem.castShadow = true;
stampGroup.add(handleStem);
const handleProfile = [
new THREE.Vector2(0.13, 0.00),
new THREE.Vector2(0.17, 0.06),
new THREE.Vector2(0.13, 0.18),
new THREE.Vector2(0.10, 0.56),
new THREE.Vector2(0.14, 0.72),
new THREE.Vector2(0.23, 0.88),
new THREE.Vector2(0.29, 1.10),
new THREE.Vector2(0.27, 1.30),
new THREE.Vector2(0.18, 1.42),
new THREE.Vector2(0.10, 1.48),
new THREE.Vector2(0.00, 1.50)
];
const handle = new THREE.Mesh(
new THREE.LatheGeometry(handleProfile, 48),
woodMaterial
);
handle.position.set(0, 1.30, -0.94);
handle.castShadow = true;
handle.receiveShadow = true;
stampGroup.add(handle);
const collar = new THREE.Mesh(
new THREE.TorusGeometry(0.18, 0.035, 12, 48),
brassMaterial
);
collar.rotation.x = Math.PI / 2;
collar.position.set(0, 0.89, -0.94);
collar.castShadow = true;
stampGroup.add(collar);
// Printed sheet
const paperGroup = new THREE.Group();
paperGroup.position.set(2.15, 0.02, 0.10);
paperGroup.rotation.y = -0.055;
scene.add(paperGroup);
const paperMaterial = new THREE.MeshStandardMaterial({
map: paperTexture,
color: 0xffffff,
roughness: 0.98,
metalness: 0
});
const paper = new THREE.Mesh(
roundedRectGeometry(4.75, 5.4, 0.16, 0.055, 0.012),
paperMaterial
);
paper.castShadow = true;
paper.receiveShadow = true;
paperGroup.add(paper);
const inkMaterial = new THREE.MeshStandardMaterial({
color: 0xd94d40,
roughness: 0.96,
metalness: 0,
side: THREE.DoubleSide,
polygonOffset: true,
polygonOffsetFactor: -2,
polygonOffsetUnits: -2
});
const inkGeometry = new THREE.ShapeGeometry(
makeEmblemShape(true),
24
);
inkGeometry.rotateX(-Math.PI / 2);
// A faint enlarged duplicate suggests slight ink spread.
const inkBleed = new THREE.Mesh(
inkGeometry.clone(),
new THREE.MeshBasicMaterial({
color: 0xd94d40,
transparent: true,
opacity: 0.13,
side: THREE.DoubleSide,
depthWrite: false
})
);
inkBleed.position.set(0.012, 0.058, 0.012);
inkBleed.scale.set(1.014, 1, 1.014);
paperGroup.add(inkBleed);
const impression = new THREE.Mesh(
inkGeometry,
inkMaterial
);
impression.position.set(0, 0.062, 0.14);
impression.receiveShadow = true;
paperGroup.add(impression);
// Direct camera controls, implemented without addons.
let dragging = false;
let previousX = 0;
let previousY = 0;
renderer.domElement.addEventListener("pointerdown", event => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", event => {
if (!dragging) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
theta -= deltaX * 0.005;
phi = THREE.MathUtils.clamp(
phi - deltaY * 0.004,
0.45,
1.18
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined) {
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
}
renderer.domElement.addEventListener(
"pointerup",
endDrag
);
renderer.domElement.addEventListener(
"pointercancel",
endDrag
);
renderer.domElement.addEventListener("wheel", event => {
event.preventDefault();
camera.zoom = THREE.MathUtils.clamp(
camera.zoom * Math.exp(-event.deltaY * 0.001),
0.75,
1.55
);
camera.updateProjectionMatrix();
}, { passive: false });
renderer.domElement.addEventListener("dblclick", () => {
theta = 0.17;
phi = 0.77;
camera.zoom = 1;
camera.updateProjectionMatrix();
updateCamera();
});
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
renderer.setSize(width, height, false);
const viewHeight = Math.max(7.0, 10.4 / aspect);
camera.left = -viewHeight * aspect / 2;
camera.right = viewHeight * aspect / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
resize();
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```