Prompt specification
Build or customize the Three.js 3D scene "Ribbed rubber door wedge" 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: Ribbed rubber door wedge
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/ribbed-rubber-door-wedge-x0009
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a rubber door wedge. Build a triangular rubber wedge with ridged top, low insertion tip, and pull tab; position it beside a slightly open door to show scale. Stylized solid forms.
Working Three.js Starter (ribbed-rubber-door-wedge-x0009):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rubber Door Wedge</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e7e1d6;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
canvas.dragging {
cursor: grabbing;
}
.title-card {
position: fixed;
top: 28px;
left: 30px;
z-index: 2;
max-width: 320px;
color: #293031;
pointer-events: none;
user-select: none;
}
.eyebrow {
margin-bottom: 8px;
color: #65706f;
font-size: 11px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(27px, 4vw, 46px);
font-weight: 780;
letter-spacing: -0.045em;
line-height: 0.98;
}
.subtitle {
margin-top: 10px;
color: #687170;
font-size: 13px;
line-height: 1.5;
}
.controls {
position: fixed;
right: 24px;
bottom: 22px;
z-index: 3;
display: flex;
align-items: center;
gap: 12px;
}
.hint {
color: rgba(46, 54, 54, 0.68);
font-size: 12px;
font-weight: 600;
pointer-events: none;
user-select: none;
}
button {
appearance: none;
border: 1px solid rgba(50, 59, 59, 0.16);
border-radius: 999px;
padding: 10px 15px;
background: rgba(255, 255, 255, 0.72);
color: #354040;
box-shadow: 0 8px 28px rgba(54, 49, 40, 0.09);
backdrop-filter: blur(12px);
cursor: pointer;
font: inherit;
font-size: 12px;
font-weight: 720;
}
button:hover {
background: rgba(255, 255, 255, 0.94);
}
button:active {
transform: translateY(1px);
}
@media (max-width: 640px) {
.title-card {
top: 20px;
left: 20px;
}
.subtitle {
display: none;
}
.hint {
display: none;
}
.controls {
right: 16px;
bottom: 16px;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div class="title-card">
<div class="eyebrow">Solid-form product study</div>
<h1>Rubber<br>Door Wedge</h1>
<div class="subtitle">Low insertion tip, ribbed top surface, and an integrated pull loop.</div>
</div>
<div class="controls">
<span class="hint">Drag to orbit · Scroll to zoom</span>
<button id="reset" type="button">Reset view</button>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const container = document.getElementById("scene");
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;
renderer.domElement.setAttribute(
"aria-label",
"Interactive 3D view of a ribbed rubber door wedge beside a slightly open door"
);
container.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe7e1d6);
scene.fog = new THREE.Fog(0xe7e1d6, 12, 23);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
60
);
// Lightweight, custom orbit controls implemented directly here.
const view = {
target: new THREE.Vector3(0.22, 1.12, -0.78),
radius: 8.25,
theta: -0.59,
phi: 1.03
};
const defaultView = {
radius: view.radius,
theta: view.theta,
phi: view.phi
};
function updateCamera() {
const sinPhi = Math.sin(view.phi);
camera.position.set(
view.target.x + view.radius * sinPhi * Math.sin(view.theta),
view.target.y + view.radius * Math.cos(view.phi),
view.target.z + view.radius * sinPhi * Math.cos(view.theta)
);
camera.lookAt(view.target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xfffbef, 0x77736c, 1.85);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff4dc, 3.4);
keyLight.position.set(-4.5, 8.5, 6.2);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -7;
keyLight.shadow.camera.right = 7;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -7;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 22;
keyLight.shadow.bias = -0.00025;
keyLight.shadow.normalBias = 0.025;
keyLight.target.position.set(0.25, 0.7, -0.7);
scene.add(keyLight, keyLight.target);
const fillLight = new THREE.DirectionalLight(0xc9e1e3, 1.2);
fillLight.position.set(5, 4, 2);
scene.add(fillLight);
const rimLight = new THREE.DirectionalLight(0xffffff, 0.7);
rimLight.position.set(-3, 4, -5);
scene.add(rimLight);
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0xd6cfc2,
roughness: 0.94,
metalness: 0
});
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
floorMaterial
);
floor.rotation.x = -Math.PI / 2;
floor.receiveShadow = true;
scene.add(floor);
const wallMaterial = new THREE.MeshStandardMaterial({
color: 0xe9e2d7,
roughness: 0.88,
metalness: 0
});
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0x766d61,
roughness: 0.72,
metalness: 0.03
});
const openingMaterial = new THREE.MeshStandardMaterial({
color: 0x303637,
roughness: 1,
metalness: 0
});
const doorMaterial = new THREE.MeshStandardMaterial({
color: 0x719b99,
roughness: 0.64,
metalness: 0.02
});
const doorInsetMaterial = new THREE.MeshStandardMaterial({
color: 0x80aaa7,
roughness: 0.68,
metalness: 0.01
});
const hardwareMaterial = new THREE.MeshStandardMaterial({
color: 0x444a4a,
roughness: 0.46,
metalness: 0.58
});
// Wall built around a doorway so the open door reads clearly.
const leftWall = new THREE.Mesh(
new THREE.BoxGeometry(6.4, 5.45, 0.22),
wallMaterial
);
leftWall.position.set(-3.2, 2.725, -2.15);
leftWall.castShadow = true;
leftWall.receiveShadow = true;
scene.add(leftWall);
const rightWall = new THREE.Mesh(
new THREE.BoxGeometry(4.6, 5.45, 0.22),
wallMaterial
);
rightWall.position.set(4.55, 2.725, -2.15);
rightWall.castShadow = true;
rightWall.receiveShadow = true;
scene.add(rightWall);
const topWall = new THREE.Mesh(
new THREE.BoxGeometry(2.25, 1.8, 0.22),
wallMaterial
);
topWall.position.set(1.125, 4.55, -2.15);
topWall.castShadow = true;
topWall.receiveShadow = true;
scene.add(topWall);
const opening = new THREE.Mesh(
new THREE.BoxGeometry(2.25, 3.65, 0.12),
openingMaterial
);
opening.position.set(1.125, 1.825, -2.18);
opening.receiveShadow = true;
scene.add(opening);
const leftJamb = new THREE.Mesh(
new THREE.BoxGeometry(0.16, 3.7, 0.28),
frameMaterial
);
leftJamb.position.set(-0.03, 1.85, -1.98);
leftJamb.castShadow = true;
leftJamb.receiveShadow = true;
scene.add(leftJamb);
const rightJamb = leftJamb.clone();
rightJamb.position.x = 2.28;
scene.add(rightJamb);
const header = new THREE.Mesh(
new THREE.BoxGeometry(2.47, 0.16, 0.28),
frameMaterial
);
header.position.set(1.125, 3.68, -1.98);
header.castShadow = true;
header.receiveShadow = true;
scene.add(header);
// Slightly open door, hinged at its left edge.
const door = new THREE.Group();
door.position.set(0.06, 0, -1.8);
door.rotation.y = -0.32;
scene.add(door);
const doorWidth = 2.05;
const doorHeight = 3.25;
const doorBottom = 0.075;
const doorPanel = new THREE.Mesh(
new THREE.BoxGeometry(doorWidth, doorHeight, 0.13),
doorMaterial
);
doorPanel.position.set(doorWidth / 2, doorBottom + doorHeight / 2, 0);
doorPanel.castShadow = true;
doorPanel.receiveShadow = true;
door.add(doorPanel);
const doorInset = new THREE.Mesh(
new THREE.BoxGeometry(doorWidth - 0.3, doorHeight - 0.42, 0.026),
doorInsetMaterial
);
doorInset.position.set(doorWidth / 2, doorBottom + doorHeight / 2, 0.078);
doorInset.castShadow = true;
door.add(doorInset);
const innerInset = new THREE.Mesh(
new THREE.BoxGeometry(doorWidth - 0.48, doorHeight - 0.66, 0.018),
doorMaterial
);
innerInset.position.set(doorWidth / 2, doorBottom + doorHeight / 2, 0.097);
innerInset.castShadow = true;
door.add(innerInset);
for (const y of [0.68, 2.55]) {
const hinge = new THREE.Mesh(
new THREE.CylinderGeometry(0.052, 0.052, 0.27, 16),
hardwareMaterial
);
hinge.position.set(0.01, y, 0);
hinge.castShadow = true;
door.add(hinge);
}
const handleRose = new THREE.Mesh(
new THREE.CylinderGeometry(0.072, 0.072, 0.045, 20),
hardwareMaterial
);
handleRose.rotation.x = Math.PI / 2;
handleRose.position.set(doorWidth - 0.19, 1.42, 0.115);
handleRose.castShadow = true;
door.add(handleRose);
const handle = new THREE.Mesh(
new THREE.BoxGeometry(0.31, 0.055, 0.075),
hardwareMaterial
);
handle.position.set(doorWidth - 0.34, 1.42, 0.158);
handle.castShadow = true;
door.add(handle);
// Main rubber wedge.
const wedge = new THREE.Group();
wedge.position.set(-0.55, 0.012, -1.25);
wedge.rotation.y = Math.PI + 0.12;
scene.add(wedge);
const length = 1.45;
const width = 0.72;
const height = 0.5;
const rubberMaterial = new THREE.MeshStandardMaterial({
color: 0x252b2c,
roughness: 0.88,
metalness: 0
});
const ridgeMaterial = new THREE.MeshStandardMaterial({
color: 0x333a3b,
roughness: 0.82,
metalness: 0
});
// Extruded triangular profile: thin insertion end and tall rear.
const wedgeProfile = new THREE.Shape();
wedgeProfile.moveTo(0, 0);
wedgeProfile.lineTo(length, 0);
wedgeProfile.lineTo(length, height);
wedgeProfile.closePath();
const wedgeGeometry = new THREE.ExtrudeGeometry(wedgeProfile, {
depth: width,
steps: 1,
bevelEnabled: true,
bevelThickness: 0.018,
bevelSize: 0.018,
bevelOffset: 0,
bevelSegments: 3,
curveSegments: 1
});
wedgeGeometry.translate(-length / 2, 0, -width / 2);
wedgeGeometry.computeVertexNormals();
const wedgeBody = new THREE.Mesh(wedgeGeometry, rubberMaterial);
wedgeBody.castShadow = true;
wedgeBody.receiveShadow = true;
wedge.add(wedgeBody);
// Rounded transverse ridges molded into the sloping upper surface.
const slopeAngle = Math.atan2(height, length);
const ridgeCount = 7;
const ridgeGeometry = new THREE.CylinderGeometry(
0.034,
0.034,
width * 0.84,
14,
1,
false
);
ridgeGeometry.rotateX(Math.PI / 2);
for (let i = 0; i < ridgeCount; i++) {
const along = 0.16 + (i * (length - 0.34)) / (ridgeCount - 1);
const surfaceX = along - length / 2;
const surfaceY = (along / length) * height;
const ridge = new THREE.Mesh(ridgeGeometry, ridgeMaterial);
ridge.position.set(
surfaceX - Math.sin(slopeAngle) * 0.023,
surfaceY + Math.cos(slopeAngle) * 0.023,
0
);
ridge.rotation.z = slopeAngle;
ridge.castShadow = true;
ridge.receiveShadow = true;
wedge.add(ridge);
}
// Horizontal U-shaped pull loop attached to the tall rear of the wedge.
const pullPoints = [
new THREE.Vector3(length / 2, height * 0.58, -width * 0.33),
new THREE.Vector3(length / 2 + 0.16, height * 0.58, -width * 0.29),
new THREE.Vector3(length / 2 + 0.29, height * 0.58, -width * 0.12),
new THREE.Vector3(length / 2 + 0.32, height * 0.58, 0),
new THREE.Vector3(length / 2 + 0.29, height * 0.58, width * 0.12),
new THREE.Vector3(length / 2 + 0.16, height * 0.58, width * 0.29),
new THREE.Vector3(length / 2, height * 0.58, width * 0.33)
];
const pullCurve = new THREE.CatmullRomCurve3(
pullPoints,
false,
"catmullrom",
0.35
);
const pullLoop = new THREE.Mesh(
new THREE.TubeGeometry(pullCurve, 40, 0.036, 10, false),
rubberMaterial
);
pullLoop.castShadow = true;
pullLoop.receiveShadow = true;
wedge.add(pullLoop);
// Small molded anchor pads where the pull loop meets the body.
for (const z of [-width * 0.33, width * 0.33]) {
const anchor = new THREE.Mesh(
new THREE.BoxGeometry(0.07, 0.12, 0.12),
rubberMaterial
);
anchor.position.set(length / 2 + 0.008, height * 0.58, z);
anchor.castShadow = true;
wedge.add(anchor);
}
// Pointer interaction.
let dragging = false;
let pointerX = 0;
let pointerY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.classList.add("dragging");
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
view.theta = THREE.MathUtils.clamp(
view.theta - dx * 0.006,
-1.45,
1.15
);
view.phi = THREE.MathUtils.clamp(
view.phi - dy * 0.006,
0.52,
1.42
);
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();
view.radius = THREE.MathUtils.clamp(
view.radius * Math.exp(event.deltaY * 0.001),
5.1,
12
);
updateCamera();
},
{ passive: false }
);
function resetView() {
view.radius = defaultView.radius;
view.theta = defaultView.theta;
view.phi = defaultView.phi;
updateCamera();
}
canvas.addEventListener("dblclick", resetView);
document.getElementById("reset").addEventListener("click", resetView);
window.addEventListener("keydown", (event) => {
const step = 0.08;
if (event.key === "ArrowLeft") view.theta += step;
if (event.key === "ArrowRight") view.theta -= step;
if (event.key === "ArrowUp") view.phi -= step;
if (event.key === "ArrowDown") view.phi += step;
if (event.key === "+" || event.key === "=") view.radius -= 0.3;
if (event.key === "-" || event.key === "_") view.radius += 0.3;
view.theta = THREE.MathUtils.clamp(view.theta, -1.45, 1.15);
view.phi = THREE.MathUtils.clamp(view.phi, 0.52, 1.42);
view.radius = THREE.MathUtils.clamp(view.radius, 5.1, 12);
updateCamera();
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```