Prompt specification
Build or customize the Three.js 3D scene "Character Coat Layers and Shoulder Straps" 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: Character Coat Layers and Shoulder Straps
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/character-coat-layers-and-shoulder-straps-x3705
Scene Description Prompt:
Build an HTML scene with Three.js from cdnjs featuring an original low-poly character whose layered coat and backpack straps remain outside the torso.
Working Three.js Starter (character-coat-layers-and-shoulder-straps-x3705):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Nera — Ridge Courier</title>
<style>
:root {
color-scheme: light;
--ink: #173038;
--paper: rgba(246, 244, 234, 0.86);
--accent: #d69c4b;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d9e5e3;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.hud {
position: fixed;
top: clamp(18px, 4vw, 42px);
left: clamp(18px, 4vw, 46px);
z-index: 2;
width: min(340px, calc(100vw - 36px));
padding: 22px 24px 20px;
border: 1px solid rgba(23, 48, 56, 0.12);
border-radius: 18px;
background: var(--paper);
box-shadow: 0 16px 45px rgba(31, 57, 61, 0.13);
backdrop-filter: blur(12px);
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
color: #527078;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.eyebrow::before {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--accent);
content: "";
box-shadow: 0 0 0 4px rgba(214, 156, 75, 0.16);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4vw, 44px);
font-weight: 500;
line-height: 0.92;
letter-spacing: -0.04em;
}
h1 span {
display: block;
margin-top: 8px;
color: #527078;
font-family: inherit;
font-size: 0.53em;
font-style: italic;
letter-spacing: 0;
}
.description {
margin: 16px 0 18px;
color: #526970;
font-size: 12px;
line-height: 1.55;
}
.palette {
display: flex;
align-items: center;
gap: 9px;
pointer-events: auto;
}
.swatch {
width: 24px;
height: 24px;
padding: 0;
border: 2px solid rgba(255, 255, 255, 0.8);
border-radius: 50%;
outline: 1px solid rgba(23, 48, 56, 0.16);
cursor: pointer;
transition:
transform 150ms ease,
outline-color 150ms ease;
}
.swatch:hover {
transform: translateY(-2px);
}
.swatch.active {
outline: 2px solid var(--ink);
outline-offset: 2px;
}
.reset {
margin-left: auto;
padding: 7px 9px;
border: 0;
border-radius: 8px;
background: rgba(23, 48, 56, 0.08);
color: var(--ink);
font: inherit;
font-size: 10px;
font-weight: 750;
cursor: pointer;
}
.reset:hover {
background: rgba(23, 48, 56, 0.14);
}
.hint {
position: fixed;
right: 22px;
bottom: 20px;
z-index: 2;
padding: 9px 12px;
border: 1px solid rgba(23, 48, 56, 0.1);
border-radius: 999px;
background: rgba(246, 244, 234, 0.7);
color: #526970;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.06em;
backdrop-filter: blur(8px);
pointer-events: none;
}
@media (max-width: 600px) {
.hud {
padding: 17px 18px;
}
.description {
margin-bottom: 14px;
}
.hint {
right: 12px;
bottom: 12px;
}
}
</style>
</head>
<body>
<main id="scene" aria-label="Interactive low-poly character scene"></main>
<section class="hud">
<div class="eyebrow">Field study 07 · North Pass</div>
<h1>
Nera
<span>Ridge Courier</span>
</h1>
<p class="description">
A weather-ready courier with a double-layered coat, raised backpack
straps, and enough room for maps, tea, and one small horn.
</p>
<div class="palette" aria-label="Coat color palette">
<button
class="swatch active"
style="background: #245f67"
data-main="#245f67"
data-inner="#57938b"
data-lining="#d69c4b"
aria-label="Teal coat"
aria-pressed="true"
></button>
<button
class="swatch"
style="background: #9a4f3d"
data-main="#9a4f3d"
data-inner="#c77a54"
data-lining="#e1b86b"
aria-label="Clay coat"
aria-pressed="false"
></button>
<button
class="swatch"
style="background: #414d76"
data-main="#414d76"
data-inner="#6f78a3"
data-lining="#d39a56"
aria-label="Indigo coat"
aria-pressed="false"
></button>
<button id="reset" class="reset">Reset view</button>
</div>
</section>
<div class="hint">Drag to orbit · Scroll to zoom · Double-click to reset</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.querySelector("#scene");
// ---------------------------------------------------------------------
// Renderer, scene, camera, and lighting
// ---------------------------------------------------------------------
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.setAttribute(
"aria-label",
"Drag to rotate Nera, and use the mouse wheel to zoom"
);
container.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd9e5e3);
scene.fog = new THREE.Fog(0xd9e5e3, 11, 26);
const camera = new THREE.PerspectiveCamera(
40,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(0, 1.9, 0);
const desiredView = {
theta: 0.74,
phi: 1.23,
radius: 7.5
};
const currentView = {
theta: desiredView.theta,
phi: desiredView.phi,
radius: desiredView.radius
};
function updateCamera() {
const sinPhi = Math.sin(currentView.phi);
camera.position.set(
target.x + currentView.radius * sinPhi * Math.sin(currentView.theta),
target.y + currentView.radius * Math.cos(currentView.phi),
target.z + currentView.radius * sinPhi * Math.cos(currentView.theta)
);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(
0xe8f3ef,
0x647371,
2.15
);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(
0xfff0d4,
3.1
);
sun.position.set(-5, 9, 7);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -5;
sun.shadow.camera.right = 5;
sun.shadow.camera.top = 6;
sun.shadow.camera.bottom = -4;
sun.shadow.camera.near = 0.5;
sun.shadow.camera.far = 24;
sun.shadow.bias = -0.0004;
scene.add(sun);
const rim = new THREE.DirectionalLight(
0x8fc5d0,
1.5
);
rim.position.set(6, 5, -6);
scene.add(rim);
// ---------------------------------------------------------------------
// Materials and geometry helpers
// ---------------------------------------------------------------------
function makeMaterial(color, roughness = 0.82, metalness = 0) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness,
flatShading: true
});
}
const coatOuterMaterial = makeMaterial(0x245f67);
coatOuterMaterial.side = THREE.DoubleSide;
const coatInnerMaterial = makeMaterial(0x57938b);
coatInnerMaterial.side = THREE.DoubleSide;
const sleeveMaterial = makeMaterial(0x245f67);
const liningMaterial = makeMaterial(0xd69c4b);
const sweaterMaterial = makeMaterial(0x73584b);
const trouserMaterial = makeMaterial(0x29383e);
const bootMaterial = makeMaterial(0x253136);
const soleMaterial = makeMaterial(0x171f23);
const skinMaterial = makeMaterial(0xc78c68);
const hairMaterial = makeMaterial(0x342722);
const strapMaterial = makeMaterial(0xc9913d, 0.76);
const packMaterial = makeMaterial(0x79513a);
const packDarkMaterial = makeMaterial(0x563a2d);
const eyeMaterial = makeMaterial(0x172126, 0.5);
const buckleMaterial = makeMaterial(0xc8a565, 0.48, 0.35);
const character = new THREE.Group();
character.position.y = 0.13;
scene.add(character);
function addMesh(
geometry,
material,
position = [0, 0, 0],
parent = character
) {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addCylinderBetween(
start,
end,
radiusStart,
radiusEnd,
material,
radialSegments = 6,
parent = character
) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
radiusEnd,
radiusStart,
length,
radialSegments,
1,
false
);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addTube(points, radius, material, parent = character) {
const curve = new THREE.CatmullRomCurve3(
points.map((point) => new THREE.Vector3(...point)),
false,
"catmullrom",
0.12
);
const geometry = new THREE.TubeGeometry(
curve,
32,
radius,
4,
false
);
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// ---------------------------------------------------------------------
// Torso
//
// The torso's largest radius is 0.50. Every coat shell begins at
// radius 0.55 or greater, while the front panels sit at z >= 0.55.
// This intentionally leaves clearance around the torso.
// ---------------------------------------------------------------------
addMesh(
new THREE.CylinderGeometry(0.40, 0.50, 1.15, 8),
sweaterMaterial,
[0, 2.0, 0]
);
// Visible sweater placket.
addMesh(
new THREE.BoxGeometry(0.085, 0.83, 0.05),
liningMaterial,
[0, 1.98, 0.515]
);
// ---------------------------------------------------------------------
// Layered coat
// ---------------------------------------------------------------------
// Outer coat: a broad open shell wrapping the back and sides.
addMesh(
new THREE.CylinderGeometry(
0.58,
0.69,
1.50,
10,
1,
true,
0.62,
Math.PI * 2 - 1.24
),
coatOuterMaterial,
[0, 1.75, 0]
);
// Inner coat layer: slightly smaller, but still outside the torso.
addMesh(
new THREE.CylinderGeometry(
0.55,
0.63,
1.48,
10,
1,
true,
0.40,
Math.PI * 2 - 0.80
),
coatInnerMaterial,
[0, 1.74, 0]
);
// Raised, rounded hem.
const hem = addMesh(
new THREE.TorusGeometry(0.665, 0.045, 4, 14),
liningMaterial,
[0, 1.01, 0]
);
hem.rotation.x = Math.PI / 2;
// Front apron panels.
for (const side of [-1, 1]) {
const panel = addMesh(
new THREE.BoxGeometry(0.30, 0.84, 0.10),
coatInnerMaterial,
[side * 0.29, 1.47, 0.60]
);
panel.rotation.z = side * -0.055;
}
// Contrasting lapels, offset in front of the inner coat layer.
for (const side of [-1, 1]) {
const lapel = addMesh(
new THREE.BoxGeometry(0.21, 0.82, 0.10),
liningMaterial,
[side * 0.20, 2.10, 0.59]
);
lapel.rotation.z = side * 0.12;
}
// Raised outer edges emphasize the layered construction.
for (const side of [-1, 1]) {
addTube(
[
[side * 0.34, 2.48, 0.49],
[side * 0.36, 2.20, 0.54],
[side * 0.39, 1.78, 0.59],
[side * 0.42, 1.04, 0.65]
],
0.035,
coatOuterMaterial
);
}
// Small coat buttons.
for (const y of [2.29, 2.08, 1.87]) {
const button = addMesh(
new THREE.CylinderGeometry(0.045, 0.045, 0.045, 6),
buckleMaterial,
[0, y, 0.555]
);
button.rotation.x = Math.PI / 2;
}
// ---------------------------------------------------------------------
// Arms, hands, legs, and boots
// ---------------------------------------------------------------------
for (const side of [-1, 1]) {
const shoulder = addMesh(
new THREE.IcosahedronGeometry(0.19, 1),
sleeveMaterial,
[side * 0.64, 2.40, 0]
);
shoulder.scale.set(1, 0.92, 1);
addCylinderBetween(
[side * 0.64, 2.39, 0],
[side * 0.74, 1.83, 0.03],
0.18,
0.145,
sleeveMaterial
);
addCylinderBetween(
[side * 0.74, 1.83, 0.03],
[side * 0.79, 1.30, 0.12],
0.145,
0.115,
coatOuterMaterial
);
const cuff = addCylinderBetween(
[side * 0.78, 1.39, 0.10],
[side * 0.79, 1.28, 0.12],
0.13,
0.12,
liningMaterial
);
cuff.castShadow = true;
addMesh(
new THREE.IcosahedronGeometry(0.145, 1),
skinMaterial,
[side * 0.80, 1.18, 0.14]
);
addCylinderBetween(
[side * 0.19, 0.38, 0],
[side * 0.20, 1.42, 0],
0.17,
0.19,
trouserMaterial
);
addMesh(
new THREE.BoxGeometry(0.36, 0.38, 0.48),
bootMaterial,
[side * 0.20, 0.20, 0.08]
);
addMesh(
new THREE.BoxGeometry(0.37, 0.21, 0.20),
bootMaterial,
[side * 0.20, 0.13, 0.34]
);
addMesh(
new THREE.BoxGeometry(0.39, 0.07, 0.56),
soleMaterial,
[side * 0.20, 0.035, 0.11]
);
}
// ---------------------------------------------------------------------
// Backpack
//
// The pack's frontmost face is approximately z = -0.74, while the
// torso's rear surface never extends beyond approximately z = -0.50.
// ---------------------------------------------------------------------
addMesh(
new THREE.BoxGeometry(0.82, 0.94, 0.36),
packMaterial,
[0, 2.13, -0.92]
);
addMesh(
new THREE.BoxGeometry(0.86, 0.30, 0.40),
packDarkMaterial,
[0, 2.53, -0.94]
);
for (const side of [-1, 1]) {
addMesh(
new THREE.BoxGeometry(0.16, 0.40, 0.30),
packDarkMaterial,
[side * 0.44, 1.97, -0.95]
);
addMesh(
new THREE.BoxGeometry(0.11, 0.12, 0.05),
buckleMaterial,
[side * 0.21, 2.47, -1.16]
);
}
const handle = addMesh(
new THREE.TorusGeometry(0.18, 0.035, 4, 12, Math.PI),
packDarkMaterial,
[0, 2.73, -0.93]
);
handle.rotation.z = Math.PI;
// ---------------------------------------------------------------------
// Raised backpack straps
//
// These paths stay at z >= 0.68 on the chest. Including the strap
// radius, their nearest surface remains outside the torso. The upper
// sections travel above the shoulder rather than cutting through it.
// ---------------------------------------------------------------------
for (const side of [-1, 1]) {
addTube(
[
[side * 0.24, 2.52, -0.73],
[side * 0.30, 2.74, -0.60],
[side * 0.31, 2.91, -0.14],
[side * 0.30, 2.76, 0.38],
[side * 0.27, 2.44, 0.69],
[side * 0.25, 1.87, 0.71],
[side * 0.24, 1.34, 0.68]
],
0.055,
strapMaterial
);
addMesh(
new THREE.BoxGeometry(0.17, 0.13, 0.07),
buckleMaterial,
[side * 0.25, 1.96, 0.76]
);
}
// ---------------------------------------------------------------------
// Neck, scarf, head, hair, and face
// ---------------------------------------------------------------------
addMesh(
new THREE.CylinderGeometry(0.14, 0.15, 0.25, 8),
skinMaterial,
[0, 2.63, 0]
);
const scarf = addMesh(
new THREE.TorusGeometry(0.205, 0.075, 5, 12),
liningMaterial,
[0, 2.65, 0]
);
scarf.rotation.x = Math.PI / 2;
const scarfTail = addMesh(
new THREE.BoxGeometry(0.16, 0.43, 0.07),
liningMaterial,
[-0.14, 2.35, 0.49]
);
scarfTail.rotation.z = 0.16;
addMesh(
new THREE.IcosahedronGeometry(0.415, 1),
skinMaterial,
[0, 3.05, 0]
);
addMesh(
new THREE.SphereGeometry(
0.435,
8,
5,
0,
Math.PI * 2,
0,
1.18
),
hairMaterial,
[0, 3.06, 0]
);
// A small angular hair tuft.
const tuft = addMesh(
new THREE.ConeGeometry(0.14, 0.27, 5),
hairMaterial,
[0.20, 3.43, -0.04]
);
tuft.rotation.z = -0.45;
for (const side of [-1, 1]) {
addMesh(
new THREE.IcosahedronGeometry(0.045, 1),
eyeMaterial,
[side * 0.115, 3.08, 0.39]
);
addMesh(
new THREE.IcosahedronGeometry(0.09, 1),
skinMaterial,
[side * 0.40, 3.04, -0.015]
);
}
const nose = addMesh(
new THREE.ConeGeometry(0.065, 0.15, 5),
skinMaterial,
[0, 3.01, 0.415]
);
nose.rotation.x = Math.PI / 2;
addMesh(
new THREE.BoxGeometry(0.10, 0.018, 0.018),
eyeMaterial,
[0, 2.91, 0.39]
);
// Ensure all character pieces participate in shadow casting.
character.traverse((object) => {
if (object.isMesh) {
object.castShadow = true;
object.receiveShadow = true;
}
});
// ---------------------------------------------------------------------
// Ground, pedestal, and low-poly scenery
// ---------------------------------------------------------------------
const ground = addMesh(
new THREE.PlaneGeometry(40, 40),
makeMaterial(0xb9c7bd),
[0, -0.02, 0],
scene
);
ground.rotation.x = -Math.PI / 2;
ground.castShadow = false;
const pedestal = addMesh(
new THREE.CylinderGeometry(1.55, 1.68, 0.14, 12),
makeMaterial(0x7f9189),
[0, 0.05, 0],
scene
);
pedestal.castShadow = true;
const rockMaterialA = makeMaterial(0x788b82);
const rockMaterialB = makeMaterial(0x89998e);
const rockData = [
[-2.5, 0.18, 0.3, 0.55],
[2.3, 0.13, -0.8, 0.38],
[-1.9, 0.10, -2.0, 0.32],
[3.4, 0.16, 1.6, 0.62],
[-3.5, 0.12, 1.8, 0.43]
];
rockData.forEach((data, index) => {
const [x, y, z, scale] = data;
const rock = addMesh(
new THREE.IcosahedronGeometry(1, 0),
index % 2 === 0 ? rockMaterialA : rockMaterialB,
[x, y, z],
scene
);
rock.scale.set(scale * 1.2, scale * 0.55, scale);
rock.rotation.set(index * 0.2, index * 0.47, index * 0.12);
});
// ---------------------------------------------------------------------
// Direct camera controls — no addons or example modules
// ---------------------------------------------------------------------
let dragging = false;
let previousX = 0;
let previousY = 0;
const canvas = renderer.domElement;
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;
desiredView.theta -= deltaX * 0.006;
desiredView.phi = THREE.MathUtils.clamp(
desiredView.phi + deltaY * 0.005,
0.42,
1.48
);
});
function endDrag(event) {
dragging = false;
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();
desiredView.radius = THREE.MathUtils.clamp(
desiredView.radius * Math.exp(event.deltaY * 0.001),
4.4,
12
);
},
{ passive: false }
);
function resetCamera() {
desiredView.theta = 0.74;
desiredView.phi = 1.23;
desiredView.radius = 7.5;
}
canvas.addEventListener("dblclick", resetCamera);
document.querySelector("#reset").addEventListener("click", resetCamera);
// ---------------------------------------------------------------------
// Palette controls
// ---------------------------------------------------------------------
const swatches = [...document.querySelectorAll(".swatch")];
swatches.forEach((swatch) => {
swatch.addEventListener("click", () => {
coatOuterMaterial.color.set(swatch.dataset.main);
sleeveMaterial.color.set(swatch.dataset.main);
coatInnerMaterial.color.set(swatch.dataset.inner);
liningMaterial.color.set(swatch.dataset.lining);
swatches.forEach((item) => {
const selected = item === swatch;
item.classList.toggle("active", selected);
item.setAttribute("aria-pressed", String(selected));
});
});
});
// ---------------------------------------------------------------------
// Resize and animation
// ---------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
const clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
const elapsed = clock.getElapsedTime();
// Gentle idle motion.
character.position.y = 0.13 + Math.sin(elapsed * 1.25) * 0.012;
character.rotation.y = Math.sin(elapsed * 0.36) * 0.022;
scarfTail.rotation.z = 0.16 + Math.sin(elapsed * 1.8) * 0.045;
// Damped camera motion.
currentView.theta +=
(desiredView.theta - currentView.theta) * 0.09;
currentView.phi +=
(desiredView.phi - currentView.phi) * 0.09;
currentView.radius +=
(desiredView.radius - currentView.radius) * 0.09;
updateCamera();
renderer.render(scene, camera);
});
</script>
</body>
</html>
```