Prompt specification
Build or customize the Three.js 3D scene "Wrapper folding work surface" 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: Wrapper folding work surface
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/wrapper-folding-work-surface-x0098
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts folded dumplings. Animate a circular wrapper lifting around a filling mound, then bring opposing edges together in ordered pleats; keep the filling contained throughout the closing sequence. Low-poly.
Working Three.js Starter (wrapper-folding-work-surface-x0098):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Folded Dumpling — Three.js</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e8e2d8;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.hud {
position: fixed;
top: 22px;
left: 22px;
z-index: 2;
width: min(330px, calc(100vw - 44px));
padding: 16px 18px 14px;
border: 1px solid rgba(73, 58, 42, 0.12);
border-radius: 16px;
background: rgba(255, 252, 245, 0.78);
box-shadow: 0 12px 35px rgba(64, 49, 33, 0.12);
backdrop-filter: blur(12px);
user-select: none;
pointer-events: none;
}
h1 {
margin: 0 0 4px;
color: #49392a;
font-size: 18px;
font-weight: 750;
letter-spacing: -0.02em;
}
.subtitle {
margin: 0;
color: #887563;
font-size: 12px;
line-height: 1.45;
}
.status-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 13px;
}
#status {
color: #66513e;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
button {
pointer-events: auto;
border: 0;
border-radius: 999px;
padding: 7px 12px;
color: #fffaf0;
background: #8c6848;
box-shadow: 0 4px 12px rgba(93, 65, 43, 0.2);
font: inherit;
font-size: 11px;
font-weight: 750;
cursor: pointer;
transition:
transform 150ms ease,
background 150ms ease;
}
button:hover {
background: #765238;
transform: translateY(-1px);
}
button:active {
transform: translateY(0);
}
.progress {
height: 3px;
margin-top: 12px;
overflow: hidden;
border-radius: 99px;
background: rgba(111, 83, 58, 0.12);
}
#progressFill {
width: 100%;
height: 100%;
border-radius: inherit;
background: #b58b62;
transform: scaleX(0);
transform-origin: left center;
}
.hint {
position: fixed;
right: 20px;
bottom: 18px;
z-index: 2;
color: rgba(71, 54, 39, 0.65);
font-size: 11px;
letter-spacing: 0.02em;
pointer-events: none;
}
@media (max-width: 600px) {
.hud {
top: 14px;
left: 14px;
padding: 13px 15px 12px;
}
.hint {
right: 14px;
bottom: 12px;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="An animated low-poly dumpling folding around its filling"></canvas>
<div class="hud">
<h1>Folded Dumpling</h1>
<p class="subtitle">
A circular wrapper rises around the filling, then gathers into ten regular pleats.
</p>
<div class="status-row">
<span id="status">Preparing wrapper</span>
<button id="replay" type="button">Replay</button>
</div>
<div class="progress">
<div id="progressFill"></div>
</div>
</div>
<div class="hint">Drag to orbit · Scroll to zoom · Space to replay</div>
<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 statusElement = document.querySelector("#status");
const progressElement = document.querySelector("#progressFill");
const replayButton = document.querySelector("#replay");
// -------------------------------------------------------------------------
// Renderer and scene
// -------------------------------------------------------------------------
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe8e2d8);
scene.fog = new THREE.Fog(0xe8e2d8, 8, 18);
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
50
);
// Custom camera orbit state. No external controls are imported.
const orbit = {
theta: 0.62,
phi: 1.04,
radius: 5.15,
target: new THREE.Vector3(0, 0.62, 0)
};
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
updateCamera();
// -------------------------------------------------------------------------
// Lighting
// -------------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(0xfff5df, 0x887969, 2.15);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff0d4, 3.1);
keyLight.position.set(4.5, 6.2, 3.8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -3.5;
keyLight.shadow.camera.right = 3.5;
keyLight.shadow.camera.top = 3.5;
keyLight.shadow.camera.bottom = -3.5;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 15;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xc7dcff, 1.05);
fillLight.position.set(-4, 2.8, -3.5);
scene.add(fillLight);
const rimLight = new THREE.PointLight(0xffd69c, 18, 8, 2);
rimLight.position.set(-1.7, 3.5, 2.5);
scene.add(rimLight);
// -------------------------------------------------------------------------
// Plate and table
// -------------------------------------------------------------------------
const table = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
new THREE.MeshStandardMaterial({
color: 0xd9d1c4,
roughness: 1,
metalness: 0
})
);
table.rotation.x = -Math.PI / 2;
table.position.y = -0.015;
table.receiveShadow = true;
scene.add(table);
const plate = new THREE.Mesh(
new THREE.CylinderGeometry(1.76, 1.86, 0.12, 48),
new THREE.MeshStandardMaterial({
color: 0x73878b,
roughness: 0.72,
metalness: 0.03
})
);
plate.position.y = 0.055;
plate.castShadow = true;
plate.receiveShadow = true;
scene.add(plate);
const plateRim = new THREE.Mesh(
new THREE.TorusGeometry(1.72, 0.025, 6, 48),
new THREE.MeshStandardMaterial({
color: 0xa8b8b8,
roughness: 0.55,
metalness: 0.05
})
);
plateRim.rotation.x = Math.PI / 2;
plateRim.position.y = 0.118;
plateRim.castShadow = true;
scene.add(plateRim);
// -------------------------------------------------------------------------
// Filling: kept stationary and entirely inside the wrapper's safe path.
// -------------------------------------------------------------------------
const fillingMaterial = new THREE.MeshStandardMaterial({
color: 0xc96f42,
roughness: 0.9,
flatShading: true
});
const filling = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.53, 1),
fillingMaterial
);
filling.scale.set(1, 0.78, 1);
filling.position.y = 0.57;
filling.castShadow = true;
filling.receiveShadow = true;
scene.add(filling);
const chunkGeometry = new THREE.IcosahedronGeometry(0.055, 0);
const chunkMaterials = [
new THREE.MeshStandardMaterial({
color: 0x759b58,
roughness: 0.95,
flatShading: true
}),
new THREE.MeshStandardMaterial({
color: 0xe7b56d,
roughness: 0.95,
flatShading: true
}),
new THREE.MeshStandardMaterial({
color: 0xb95545,
roughness: 0.95,
flatShading: true
})
];
for (let i = 0; i < 12; i++) {
const angle = i * 2.399963 + 0.22;
const radius = 0.15 + (i % 4) * 0.055;
const surfaceY =
0.57 +
0.78 * 0.53 *
Math.sqrt(Math.max(0, 1 - (radius / 0.53) ** 2));
const chunk = new THREE.Mesh(
chunkGeometry,
chunkMaterials[i % chunkMaterials.length]
);
chunk.position.set(
Math.cos(angle) * radius,
surfaceY + 0.015,
Math.sin(angle) * radius
);
chunk.rotation.set(angle * 0.31, angle, angle * 0.17);
chunk.scale.set(
0.8 + (i % 3) * 0.15,
0.65 + (i % 2) * 0.2,
0.8 + ((i + 1) % 3) * 0.12
);
chunk.castShadow = true;
scene.add(chunk);
}
// -------------------------------------------------------------------------
// Wrapper geometry
//
// The wrapper starts as a flat circular sheet. Its radial rings are mapped
// onto a safe cross-sectional path:
//
// flat disk -> shallow bowl -> outside of filling -> top pinch
//
// This keeps every part of the wrapper either below or outside the filling
// while the upper rings progressively fold over it.
// -------------------------------------------------------------------------
const BASE_Y = 0.15;
const WRAPPER_RADIUS = 1.26;
const RADIAL_SEGMENTS = 18;
const ANGULAR_SEGMENTS = 80;
const PLEAT_COUNT = 10;
// Cross-section in the radius/height plane.
const wrapperPath = [
{ r: 0.00, y: BASE_Y },
{ r: 0.58, y: BASE_Y },
{ r: 1.18, y: BASE_Y },
{ r: 1.26, y: 0.68 },
{ r: 1.14, y: 0.98 },
{ r: 0.82, y: 1.20 },
{ r: 0.42, y: 1.30 },
{ r: 0.00, y: 1.34 }
];
const pathCumulative = [0];
for (let i = 1; i < wrapperPath.length; i++) {
const a = wrapperPath[i - 1];
const b = wrapperPath[i];
const length = Math.hypot(b.r - a.r, b.y - a.y);
pathCumulative.push(pathCumulative[i - 1] + length);
}
const totalPathLength = pathCumulative[pathCumulative.length - 1];
for (let i = 0; i < pathCumulative.length; i++) {
pathCumulative[i] /= totalPathLength;
}
const pathSample = { r: 0, y: 0 };
function samplePath(s, out) {
s = THREE.MathUtils.clamp(s, 0, 1);
let i = 1;
while (i < pathCumulative.length - 1 && pathCumulative[i] < s) {
i++;
}
const a = wrapperPath[i - 1];
const b = wrapperPath[i];
const span = pathCumulative[i] - pathCumulative[i - 1];
const u = span > 0 ? (s - pathCumulative[i - 1]) / span : 0;
out.r = THREE.MathUtils.lerp(a.r, b.r, u);
out.y = THREE.MathUtils.lerp(a.y, b.y, u);
return out;
}
function bowlPathPosition(q) {
if (q <= 0.46) {
return (
pathCumulative[1] *
(q / 0.46)
);
}
if (q <= 0.92) {
return THREE.MathUtils.lerp(
pathCumulative[1],
pathCumulative[2],
(q - 0.46) / 0.46
);
}
return THREE.MathUtils.lerp(
pathCumulative[2],
pathCumulative[3],
(q - 0.92) / 0.08
);
}
function smoothstep(min, max, value) {
const x = THREE.MathUtils.clamp((value - min) / (max - min), 0, 1);
return x * x * (3 - 2 * x);
}
function triangleWave(phase) {
return (2 / Math.PI) * Math.asin(Math.sin(phase));
}
const surfacePoint = {
x: 0,
y: 0,
z: 0
};
function getSurfacePoint(q, theta, bowlAmount, closure, out) {
let s = bowlPathPosition(q);
// During closure the radial rings travel forward along the wrapper's
// exterior path. The filling remains enclosed by the path design.
if (closure > 0) {
s = THREE.MathUtils.lerp(s, q, closure);
}
// A small alternating bias makes the two opposing sides gather with a
// slight, controlled lead rather than collapsing perfectly symmetrically.
const opposingBias =
0.018 *
Math.sin(Math.PI * closure) *
Math.cos(theta) *
smoothstep(0.68, 0.93, s);
s = THREE.MathUtils.clamp(s + opposingBias, 0, 1);
samplePath(s, pathSample);
let radius = pathSample.r;
let height = pathSample.y;
// Blend the safe path from the original flat circular disk into a bowl.
if (bowlAmount < 1) {
const flatRadius = WRAPPER_RADIUS * q;
radius = THREE.MathUtils.lerp(flatRadius, radius, bowlAmount);
height = THREE.MathUtils.lerp(BASE_Y, height, bowlAmount);
}
// Ten regular accordion pleats appear around the upper half.
const pleatWeight =
smoothstep(0.48, 0.72, s) *
(1 - smoothstep(0.90, 1.0, s));
const pleatAmplitude =
0.075 * smoothstep(0.08, 0.75, closure);
const pleat =
triangleWave(theta * PLEAT_COUNT + Math.PI / 2);
radius += pleatAmplitude * pleatWeight * pleat;
height +=
0.022 *
pleatWeight *
(pleat * 0.5 + 0.5);
out.x = Math.cos(theta) * radius;
out.y = height;
out.z = Math.sin(theta) * radius;
return out;
}
const wrapperVertexCount =
1 + RADIAL_SEGMENTS * ANGULAR_SEGMENTS;
const wrapperPositions = new Float32Array(wrapperVertexCount * 3);
const wrapperColors = new Float32Array(wrapperVertexCount * 3);
const wrapperIndices = [];
// Center fan.
for (let a = 0; a < ANGULAR_SEGMENTS; a++) {
const current = 1 + a;
const next = 1 + ((a + 1) % ANGULAR_SEGMENTS);
wrapperIndices.push(0, next, current);
}
// Ring quads.
for (let ring = 1; ring < RADIAL_SEGMENTS; ring++) {
const innerStart = 1 + (ring - 1) * ANGULAR_SEGMENTS;
const outerStart = 1 + ring * ANGULAR_SEGMENTS;
for (let a = 0; a < ANGULAR_SEGMENTS; a++) {
const nextA = (a + 1) % ANGULAR_SEGMENTS;
const innerCurrent = innerStart + a;
const innerNext = innerStart + nextA;
const outerCurrent = outerStart + a;
const outerNext = outerStart + nextA;
wrapperIndices.push(
innerCurrent, outerNext, outerCurrent,
innerNext, outerNext, innerCurrent
);
}
}
const wrapperGeometry = new THREE.BufferGeometry();
wrapperGeometry.setAttribute(
"position",
new THREE.BufferAttribute(wrapperPositions, 3)
);
wrapperGeometry.setAttribute(
"color",
new THREE.BufferAttribute(wrapperColors, 3)
);
wrapperGeometry.setIndex(wrapperIndices);
const wrapperMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
vertexColors: true,
roughness: 0.88,
metalness: 0,
side: THREE.DoubleSide,
flatShading: true
});
const wrapper = new THREE.Mesh(wrapperGeometry, wrapperMaterial);
wrapper.castShadow = true;
wrapper.receiveShadow = true;
wrapper.frustumCulled = false;
scene.add(wrapper);
// Subtle colored variation emphasizes the low-poly folds.
const wrapperBaseColor = new THREE.Color(0xf0d4a3);
for (let ring = 1; ring <= RADIAL_SEGMENTS; ring++) {
const q = ring / RADIAL_SEGMENTS;
for (let a = 0; a < ANGULAR_SEGMENTS; a++) {
const theta = (a / ANGULAR_SEGMENTS) * Math.PI * 2;
const vertex = 1 + (ring - 1) * ANGULAR_SEGMENTS + a;
const pleat = triangleWave(
theta * PLEAT_COUNT + Math.PI / 2
);
const shade =
0.88 -
q * 0.045 +
pleat * 0.018;
wrapperColors[vertex * 3] = wrapperBaseColor.r * shade;
wrapperColors[vertex * 3 + 1] = wrapperBaseColor.g * shade;
wrapperColors[vertex * 3 + 2] = wrapperBaseColor.b * shade;
}
}
wrapperColors[0] = wrapperBaseColor.r * 0.86;
wrapperColors[1] = wrapperBaseColor.g * 0.86;
wrapperColors[2] = wrapperBaseColor.b * 0.86;
// -------------------------------------------------------------------------
// Fine crease lines following the ten principal pleat ridges
// -------------------------------------------------------------------------
const creaseSegments = 17;
const creaseVertexCount =
PLEAT_COUNT * creaseSegments * 2;
const creasePositions = new Float32Array(creaseVertexCount * 3);
const creaseGeometry = new THREE.BufferGeometry();
creaseGeometry.setAttribute(
"position",
new THREE.BufferAttribute(creasePositions, 3)
);
const creaseMaterial = new THREE.LineBasicMaterial({
color: 0x9f7548,
transparent: true,
opacity: 0,
depthWrite: false
});
const creaseLines = new THREE.LineSegments(
creaseGeometry,
creaseMaterial
);
creaseLines.frustumCulled = false;
scene.add(creaseLines);
// -------------------------------------------------------------------------
// Small crumpled pinch at the top of the finished dumpling
// -------------------------------------------------------------------------
const knotMaterial = new THREE.MeshStandardMaterial({
color: 0xeccb96,
roughness: 0.9,
flatShading: true
});
const knot = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.13, 0),
knotMaterial
);
knot.position.y = 1.29;
knot.visible = false;
knot.castShadow = true;
scene.add(knot);
// -------------------------------------------------------------------------
// Geometry updates
// -------------------------------------------------------------------------
const linePointA = { x: 0, y: 0, z: 0 };
const linePointB = { x: 0, y: 0, z: 0 };
function updateWrapper(bowlAmount, closure) {
const positionAttribute = wrapperGeometry.getAttribute("position");
// Center.
getSurfacePoint(0, 0, bowlAmount, closure, surfacePoint);
positionAttribute.setXYZ(0, surfacePoint.x, surfacePoint.y, surfacePoint.z);
for (let ring = 1; ring <= RADIAL_SEGMENTS; ring++) {
const q = ring / RADIAL_SEGMENTS;
for (let a = 0; a < ANGULAR_SEGMENTS; a++) {
const theta = (a / ANGULAR_SEGMENTS) * Math.PI * 2;
const vertex = 1 + (ring - 1) * ANGULAR_SEGMENTS + a;
getSurfacePoint(
q,
theta,
bowlAmount,
closure,
surfacePoint
);
positionAttribute.setXYZ(
vertex,
surfacePoint.x,
surfacePoint.y,
surfacePoint.z
);
}
}
positionAttribute.needsUpdate = true;
wrapperGeometry.computeVertexNormals();
// Crease lines.
let cursor = 0;
for (let pleat = 0; pleat < PLEAT_COUNT; pleat++) {
const theta = (pleat / PLEAT_COUNT) * Math.PI * 2;
for (let segment = 0; segment < creaseSegments; segment++) {
const q0 = 0.44 + (0.56 * segment) / creaseSegments;
const q1 = 0.44 + (0.56 * (segment + 1)) / creaseSegments;
getSurfacePoint(
q0, theta, bowlAmount, closure, linePointA
);
getSurfacePoint(
q1, theta, bowlAmount, closure, linePointB
);
creasePositions[cursor++] = linePointA.x * 1.008;
creasePositions[cursor++] = linePointA.y + 0.002;
creasePositions[cursor++] = linePointA.z * 1.008;
creasePositions[cursor++] = linePointB.x * 1.008;
creasePositions[cursor++] = linePointB.y + 0.002;
creasePositions[cursor++] = linePointB.z * 1.008;
}
}
creaseGeometry.getAttribute("position").needsUpdate = true;
creaseMaterial.opacity =
0.23 * smoothstep(0.18, 0.68, closure);
// The pinch appears only after the opposing sides have nearly met.
const knotAmount = smoothstep(0.78, 0.98, closure);
knot.visible = knotAmount > 0.001;
knot.scale.set(
0.001 + 1.10 * knotAmount,
0.001 + 0.55 * knotAmount,
0.001 + 1.00 * knotAmount
);
knot.rotation.y = closure * Math.PI * 0.4;
}
// -------------------------------------------------------------------------
// Animation timeline
// -------------------------------------------------------------------------
let startTime = performance.now();
function replay() {
startTime = performance.now();
}
replayButton.addEventListener("click", replay);
window.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
replay();
}
});
function easeInOutCubic(value) {
return value < 0.5
? 4 * value * value * value
: 1 - Math.pow(-2 * value + 2, 3) / 2;
}
function updateStatus(time) {
let status;
let progress;
if (time < 0.25) {
status = "Circular wrapper";
progress = 0;
} else if (time < 1.7) {
status = "Lifting around filling";
progress = (time - 0.25) / 1.45;
} else if (time < 4.4) {
status = "Gathering ordered pleats";
progress = 0.45 + 0.55 * ((time - 1.7) / 2.7);
} else {
status = "Sealed dumpling";
progress = 1;
}
statusElement.textContent = status;
progressElement.style.transform = `scaleX(${progress})`;
}
updateWrapper(0, 0);
renderer.setAnimationLoop((now) => {
const time = (now - startTime) / 1000;
const bowlAmount = easeInOutCubic(
THREE.MathUtils.clamp((time - 0.25) / 1.45, 0, 1)
);
const closure = easeInOutCubic(
THREE.MathUtils.clamp((time - 1.7) / 2.7, 0, 1)
);
updateWrapper(bowlAmount, closure);
updateStatus(time);
updateCamera();
renderer.render(scene, camera);
});
// -------------------------------------------------------------------------
// Custom pointer camera controls
// -------------------------------------------------------------------------
let dragging = false;
let previousX = 0;
let previousY = 0;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
orbit.theta -= deltaX * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi + deltaY * 0.005,
0.34,
1.46
);
});
function stopDragging(event) {
dragging = false;
if (event.pointerId !== undefined) {
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener("lostpointercapture", () => {
dragging = false;
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.004,
3.25,
8.5
);
},
{ passive: false }
);
// -------------------------------------------------------------------------
// Resize
// -------------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
});
</script>
</body>
</html>
```