Prompt specification
Build or customize the Three.js 3D scene "Family homecoming living room" 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: Family homecoming living room
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/family-homecoming-living-room-x3891
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: family homecoming living room. Compose a modest living room with seated parents, wrapped infant, older sibling, and welcome meal; small gestures convey shared attention without exaggerated emotion or medical claims. Return one self-contained HTML file.
Working Three.js Starter (family-homecoming-living-room-x3891):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Homecoming — A Family Living Room</title>
<style>
:root {
color-scheme: light;
--ink: #27332f;
--paper: rgba(250, 246, 237, 0.88);
--line: rgba(39, 51, 47, 0.14);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8d0c5;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--ink);
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
outline: none;
}
canvas:active { cursor: grabbing; }
.title {
position: fixed;
left: clamp(18px, 3vw, 38px);
bottom: clamp(18px, 3vw, 36px);
max-width: min(370px, calc(100vw - 36px));
padding: 16px 18px;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--paper);
box-shadow: 0 12px 40px rgba(47, 39, 30, 0.12);
backdrop-filter: blur(10px);
pointer-events: none;
}
.title small {
display: block;
margin-bottom: 5px;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.18em;
text-transform: uppercase;
opacity: 0.58;
}
.title h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(24px, 3vw, 34px);
font-weight: 500;
letter-spacing: -0.025em;
}
.title p {
margin: 6px 0 0;
font-size: 12px;
line-height: 1.5;
opacity: 0.7;
}
.controls {
position: fixed;
top: clamp(14px, 2.4vw, 26px);
right: clamp(14px, 2.4vw, 26px);
display: flex;
align-items: center;
gap: 10px;
padding: 9px 10px 9px 14px;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--paper);
box-shadow: 0 8px 30px rgba(47, 39, 30, 0.1);
backdrop-filter: blur(10px);
color: var(--ink);
}
.controls span {
font-size: 11px;
letter-spacing: 0.02em;
opacity: 0.64;
white-space: nowrap;
}
button {
border: 0;
border-radius: 999px;
padding: 9px 13px;
background: #34463f;
color: #fffaf0;
font: inherit;
font-size: 11px;
font-weight: 700;
cursor: pointer;
transition: transform 150ms ease, background 150ms ease;
}
button:hover {
background: #263a33;
transform: translateY(-1px);
}
button:focus-visible {
outline: 3px solid rgba(200, 159, 91, 0.65);
outline-offset: 2px;
}
@media (max-width: 640px) {
.title p { display: none; }
.title { padding: 13px 15px; }
.controls span { display: none; }
.controls { padding-left: 10px; }
}
</style>
</head>
<body>
<canvas
id="scene"
tabindex="0"
aria-label="A stylized living room where two seated parents, a wrapped infant, and an older sibling gather around a welcome meal."
></canvas>
<section class="title" aria-label="Scene title">
<small>A quiet homecoming</small>
<h1>Welcome home</h1>
<p>A small meal, familiar hands, and everyone gathered close.</p>
</section>
<div class="controls" aria-label="Camera controls">
<span>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 canvas = document.getElementById("scene");
const resetButton = document.getElementById("reset");
const scene = new THREE.Scene();
scene.background = new THREE.Color("#d8d0c5");
scene.fog = new THREE.Fog("#d8d0c5", 13, 24);
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);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
60
);
const hemi = new THREE.HemisphereLight("#fff2d8", "#6c6258", 1.7);
scene.add(hemi);
const sun = new THREE.DirectionalLight("#fff1cf", 3.25);
sun.position.set(4.5, 7.5, 6.5);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -7;
sun.shadow.camera.right = 7;
sun.shadow.camera.top = 7;
sun.shadow.camera.bottom = -5;
sun.shadow.camera.near = 0.5;
sun.shadow.camera.far = 24;
sun.shadow.bias = -0.00035;
sun.target.position.set(0, 1.1, -0.5);
scene.add(sun, sun.target);
const fill = new THREE.DirectionalLight("#bfd6db", 0.7);
fill.position.set(-5, 3, 4);
scene.add(fill);
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.02,
...options
});
const mats = {
wall: material("#d9d1c4"),
sideWall: material("#c9bbaa"),
trim: material("#eee8dc"),
floor: material("#a77954"),
floorSeam: material("#895d43"),
rug: material("#d6c5a8"),
rugBorder: material("#a87d64"),
sofa: material("#6f8378"),
cushion: material("#91a498"),
sofaDark: material("#5d7167"),
wood: material("#74503b"),
darkWood: material("#49372f"),
brass: material("#c6a15e", { metalness: 0.48, roughness: 0.36 }),
cream: material("#eee4cf"),
terracotta: material("#b96f52"),
leaf: material("#587c61"),
leafLight: material("#789978"),
black: material("#28302d", { roughness: 0.5 }),
skinLight: material("#e5ad84"),
skinMedium: material("#bb7956"),
skinDeep: material("#81513c"),
hairBrown: material("#3a2924"),
hairDark: material("#272321"),
hairGray: material("#6b625b"),
teal: material("#527d78"),
rust: material("#b8654d"),
mustard: material("#d5a24d"),
navy: material("#405467"),
blanket: material("#a9c9c0"),
blanketLight: material("#dbe7dc"),
soup: material("#c87935", { roughness: 0.5 }),
bread: material("#c9894d"),
breadScore: material("#8e5834"),
sky: material("#a9cbd5", { roughness: 0.55 }),
hill: material("#809b78"),
lampShade: material("#f3d79c", {
emissive: "#d9a85f",
emissiveIntensity: 0.38,
roughness: 0.7
})
};
function mesh(
geometry,
mat,
position = [0, 0, 0],
scale = [1, 1, 1],
parent = scene,
rotation = [0, 0, 0]
) {
const object = new THREE.Mesh(geometry, mat);
object.position.set(...position);
object.scale.set(...scale);
object.rotation.set(...rotation);
object.castShadow = true;
object.receiveShadow = true;
parent.add(object);
return object;
}
function roundedBoxGeometry(width, height, depth, radius = 0.08) {
const bevel = Math.min(0.035, radius * 0.42);
const x = -width / 2;
const y = -height / 2;
const r = Math.max(0.001, radius);
const shape = new THREE.Shape();
shape.moveTo(x + r, y);
shape.lineTo(x + width - r, y);
shape.quadraticCurveTo(x + width, y, x + width, y + r);
shape.lineTo(x + width, y + height - r);
shape.quadraticCurveTo(x + width, y + height, x + width - r, y + height);
shape.lineTo(x + r, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - r);
shape.lineTo(x, y + r);
shape.quadraticCurveTo(x, y, x + r, y);
const depthBody = Math.max(0.01, depth - bevel * 2);
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: depthBody,
bevelEnabled: true,
bevelSegments: 3,
steps: 1,
bevelSize: bevel,
bevelThickness: bevel,
curveSegments: 6
});
geometry.translate(0, 0, -depthBody / 2);
geometry.computeVertexNormals();
return geometry;
}
function rod(parent, start, end, radius, mat) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = new THREE.Vector3().subVectors(b, a);
const midpoint = new THREE.Vector3().addVectors(a, b).multiplyScalar(0.5);
const object = mesh(
new THREE.CylinderGeometry(radius, radius, direction.length(), 14),
mat,
midpoint.toArray(),
[1, 1, 1],
parent
);
object.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return object;
}
function ellipsoid(parent, mat, position, scale) {
return mesh(
new THREE.SphereGeometry(1, 24, 16),
mat,
position,
scale,
parent
);
}
function curveTube(parent, points, radius, mat) {
const curve = new THREE.CatmullRomCurve3(
points.map(point => new THREE.Vector3(...point))
);
return mesh(
new THREE.TubeGeometry(curve, 20, radius, 7, false),
mat,
[0, 0, 0],
[1, 1, 1],
parent
);
}
// Room shell
mesh(
new THREE.BoxGeometry(9.2, 0.16, 6.9),
mats.floor,
[0, -0.09, 0.12]
);
mesh(
new THREE.BoxGeometry(9.2, 3.65, 0.16),
mats.wall,
[0, 1.82, -3.34]
);
mesh(
new THREE.BoxGeometry(0.16, 3.65, 6.9),
mats.sideWall,
[-4.66, 1.82, 0.12]
);
mesh(
new THREE.BoxGeometry(9.1, 0.16, 0.12),
mats.trim,
[0, 0.13, -3.22]
);
mesh(
new THREE.BoxGeometry(0.12, 0.16, 6.85),
mats.trim,
[-4.54, 0.13, 0.12]
);
for (let z = -3.0; z <= 3.2; z += 0.56) {
mesh(
new THREE.BoxGeometry(9.05, 0.008, 0.012),
mats.floorSeam,
[0, 0.003, z]
);
}
// Rug
mesh(
roundedBoxGeometry(6.55, 0.055, 4.65, 0.18),
mats.rug,
[0, 0.035, 0.35]
);
mesh(
roundedBoxGeometry(6.15, 0.014, 4.25, 0.15),
mats.rugBorder,
[0, 0.068, 0.35]
);
mesh(
roundedBoxGeometry(5.83, 0.018, 3.94, 0.14),
mats.rug,
[0, 0.079, 0.35]
);
// Window
mesh(
new THREE.BoxGeometry(2.15, 1.55, 0.055),
mats.sky,
[-2.72, 2.34, -3.205]
);
mesh(
new THREE.CircleGeometry(0.23, 28),
material("#f5d68d", { emissive: "#e7b960", emissiveIntensity: 0.18 }),
[-2.28, 2.72, -3.17]
);
mesh(
new THREE.CircleGeometry(0.72, 32),
mats.hill,
[-3.12, 1.96, -3.165],
[1, 0.58, 1]
);
mesh(
new THREE.CircleGeometry(0.82, 32),
mats.leafLight,
[-2.17, 1.88, -3.16],
[1, 0.48, 1]
);
mesh(
new THREE.BoxGeometry(0.09, 1.58, 0.1),
mats.darkWood,
[-2.72, 2.34, -3.10]
);
mesh(
new THREE.BoxGeometry(2.2, 0.09, 0.1),
mats.darkWood,
[-2.72, 2.34, -3.10]
);
mesh(
new THREE.BoxGeometry(2.2, 0.09, 0.1),
mats.darkWood,
[-2.72, 2.34, -3.10]
);
mesh(
new THREE.BoxGeometry(0.08, 1.6, 0.12),
mats.darkWood,
[-3.8, 2.34, -3.08]
);
mesh(
new THREE.BoxGeometry(0.08, 1.6, 0.12),
mats.darkWood,
[-1.64, 2.34, -3.08]
);
mesh(
new THREE.BoxGeometry(2.42, 0.09, 0.1),
mats.wood,
[-2.72, 3.14, -3.07]
);
// Curtains
for (const x of [-3.94, -1.5]) {
mesh(
new THREE.CylinderGeometry(0.13, 0.19, 2.15, 14, 1, false),
material("#e6ddca"),
[x, 2.15, -2.98],
[1, 1, 0.48]
);
}
// Welcome-home sign
const signCanvas = document.createElement("canvas");
signCanvas.width = 768;
signCanvas.height = 240;
const signContext = signCanvas.getContext("2d");
signContext.fillStyle = "#efe4cf";
signContext.fillRect(0, 0, 768, 240);
signContext.strokeStyle = "#88725b";
signContext.lineWidth = 8;
signContext.strokeRect(22, 22, 724, 196);
signContext.fillStyle = "#3d5148";
signContext.textAlign = "center";
signContext.textBaseline = "middle";
signContext.font = "52px Georgia";
signContext.fillText("WELCOME HOME", 384, 113);
signContext.font = "21px sans-serif";
signContext.fillStyle = "#8a6c55";
signContext.fillText("we saved you a seat", 384, 170);
const signTexture = new THREE.CanvasTexture(signCanvas);
signTexture.colorSpace = THREE.SRGBColorSpace;
mesh(
roundedBoxGeometry(1.85, 0.65, 0.1, 0.06),
mats.wood,
[0.45, 2.76, -3.17]
);
const sign = mesh(
new THREE.PlaneGeometry(1.7, 0.53),
new THREE.MeshBasicMaterial({ map: signTexture }),
[0.45, 2.76, -3.108]
);
sign.castShadow = false;
// Abstract framed art
const artCanvas = document.createElement("canvas");
artCanvas.width = 400;
artCanvas.height = 320;
const artContext = artCanvas.getContext("2d");
artContext.fillStyle = "#e8dfcd";
artContext.fillRect(0, 0, 400, 320);
artContext.fillStyle = "#c58a58";
artContext.beginPath();
artContext.arc(285, 88, 43, 0, Math.PI * 2);
artContext.fill();
artContext.fillStyle = "#748d78";
artContext.beginPath();
artContext.moveTo(0, 230);
artContext.bezierCurveTo(95, 135, 175, 275, 400, 185);
artContext.lineTo(400, 320);
artContext.lineTo(0, 320);
artContext.fill();
artContext.fillStyle = "#4f6c5e";
artContext.beginPath();
artContext.moveTo(0, 282);
artContext.bezierCurveTo(105, 195, 225, 315, 400, 235);
artContext.lineTo(400, 320);
artContext.lineTo(0, 320);
artContext.fill();
const artTexture = new THREE.CanvasTexture(artCanvas);
artTexture.colorSpace = THREE.SRGBColorSpace;
mesh(
roundedBoxGeometry(1.48, 1.22, 0.1, 0.04),
mats.wood,
[3.15, 2.3, -3.17]
);
const art = mesh(
new THREE.PlaneGeometry(1.32, 1.06),
new THREE.MeshBasicMaterial({ map: artTexture }),
[3.15, 2.3, -3.108]
);
art.castShadow = false;
// Sofa
mesh(
roundedBoxGeometry(4.85, 0.34, 1.58, 0.14),
mats.sofaDark,
[0, 0.42, -1.52]
);
mesh(
roundedBoxGeometry(4.86, 1.18, 0.4, 0.16),
mats.sofa,
[0, 1.27, -2.15]
);
for (const x of [-1.5, 0, 1.5]) {
mesh(
roundedBoxGeometry(1.43, 0.24, 1.24, 0.1),
mats.cushion,
[x, 0.69, -1.55]
);
}
for (const x of [-2.43, 2.43]) {
mesh(
roundedBoxGeometry(0.36, 1.02, 1.68, 0.14),
mats.sofa,
[x, 0.83, -1.55]
);
}
for (const x of [-2.08, 2.08]) {
for (const z of [-2.02, -1.05]) {
mesh(
new THREE.CylinderGeometry(0.075, 0.09, 0.3, 12),
mats.darkWood,
[x, 0.17, z]
);
}
}
const pillowLeft = mesh(
roundedBoxGeometry(0.62, 0.58, 0.19, 0.12),
material("#c8a475"),
[-1.87, 1.25, -1.89],
[1, 1, 1],
scene,
[0.08, 0.08, -0.13]
);
const pillowRight = mesh(
roundedBoxGeometry(0.58, 0.54, 0.18, 0.11),
material("#d9c9aa"),
[1.92, 1.22, -1.9],
[1, 1, 1],
scene,
[-0.06, -0.05, 0.12]
);
// Character factory
function createPerson({
x,
z = -1.48,
rotation = 0,
scale = 1,
y = 0.76,
skin,
hair,
top,
trousers,
hairstyle = "short",
nearSide = 1,
nearHand = 0.98,
nearElbow = 0.70,
cardigan = false,
longSleeve = true
}) {
const group = new THREE.Group();
group.position.set(x, y, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
ellipsoid(group, trousers, [0, 0.06, 0.02], [0.39, 0.23, 0.31]);
ellipsoid(group, top, [0, 0.61, 0], [0.38, 0.54, 0.27]);
if (cardigan) {
ellipsoid(group, mats.cream, [0, 0.64, 0.215], [0.23, 0.36, 0.075]);
const lapelLeft = mesh(
roundedBoxGeometry(0.09, 0.38, 0.035, 0.02),
top,
[-0.14, 0.69, 0.272],
[1, 1, 1],
group,
[0, 0, -0.16]
);
const lapelRight = mesh(
roundedBoxGeometry(0.09, 0.38, 0.035, 0.02),
top,
[0.14, 0.69, 0.272],
[1, 1, 1],
group,
[0, 0, 0.16]
);
}
mesh(
new THREE.CylinderGeometry(0.11, 0.12, 0.18, 14),
skin,
[0, 1.01, 0.015],
[1, 1, 1],
group
);
// Seated legs
for (const side of [-1, 1]) {
const hip = [side * 0.18, 0.08, 0.06];
const knee = [side * 0.23, 0.02, 0.57];
const ankle = [side * 0.24, -0.55, 0.64];
rod(group, hip, knee, 0.135, trousers);
ellipsoid(group, trousers, knee, [0.14, 0.13, 0.14]);
rod(group, knee, ankle, 0.105, trousers);
ellipsoid(group, mats.black, [side * 0.24, -0.64, 0.74], [0.15, 0.10, 0.25]);
}
function arm(side, elbow, hand, sleeveMaterial, skinMaterial) {
const shoulder = [side * 0.34, 0.83, 0];
rod(group, shoulder, elbow, 0.115, sleeveMaterial);
ellipsoid(group, sleeveMaterial, elbow, [0.12, 0.12, 0.12]);
rod(group, elbow, hand, 0.082, longSleeve ? sleeveMaterial : skinMaterial);
ellipsoid(group, skinMaterial, hand, [0.092, 0.085, 0.09]);
}
const nearElbowPoint = [nearSide * nearElbow, 0.49, 0.18];
const nearHandPoint = [nearSide * nearHand, 0.30, 0.59];
const farElbowPoint = [-nearSide * 0.49, 0.43, 0.13];
const farHandPoint = [-nearSide * 0.17, 0.14, 0.52];
arm(nearSide, nearElbowPoint, nearHandPoint, top, skin);
arm(-nearSide, farElbowPoint, farHandPoint, top, skin);
// Head and face
const head = new THREE.Group();
head.position.set(0, 1.28, 0.02);
head.rotation.x = 0.075;
group.add(head);
ellipsoid(head, skin, [0, 0, 0], [0.28, 0.30, 0.26]);
ellipsoid(head, skin, [-0.276, -0.01, 0], [0.065, 0.09, 0.06]);
ellipsoid(head, skin, [0.276, -0.01, 0], [0.065, 0.09, 0.06]);
const hairCap = mesh(
new THREE.SphereGeometry(
0.294, 26, 14, 0, Math.PI * 2, 0, Math.PI * 0.54
),
hair,
[0, 0.025, -0.008],
[1, 1.02, 1],
head
);
if (hairstyle === "bob") {
ellipsoid(head, hair, [-0.247, -0.075, -0.01], [0.095, 0.20, 0.23]);
ellipsoid(head, hair, [0.247, -0.075, -0.01], [0.095, 0.20, 0.23]);
} else if (hairstyle === "curly") {
const curls = [
[-0.18, 0.20, 0.00],
[-0.08, 0.25, -0.04],
[0.05, 0.26, -0.04],
[0.18, 0.20, 0.00],
[-0.22, 0.09, -0.02],
[0.22, 0.09, -0.02]
];
curls.forEach(([cx, cy, cz]) => {
ellipsoid(head, hair, [cx, cy, cz], [0.11, 0.11, 0.11]);
});
}
ellipsoid(head, mats.black, [-0.073, 0.025, 0.247], [0.018, 0.023, 0.014]);
ellipsoid(head, mats.black, [0.073, 0.025, 0.247], [0.018, 0.023, 0.014]);
ellipsoid(head, skin, [0, -0.03, 0.268], [0.035, 0.035, 0.04]);
curveTube(
head,
[[-0.038, -0.10, 0.252], [0, -0.112, 0.265], [0.038, -0.10, 0.252]],
0.0065,
material("#7c4438")
);
const browMaterial = material(hair === mats.gray ? "#665e58" : "#4c3730");
const browLeft = mesh(
new THREE.BoxGeometry(0.07, 0.012, 0.012),
browMaterial,
[-0.073, 0.083, 0.245],
[1, 1, 1],
head,
[0, 0, -0.05]
);
const browRight = mesh(
new THREE.BoxGeometry(0.07, 0.012, 0.012),
browMaterial,
[0.073, 0.083, 0.245],
[1, 1, 1],
head,
[0, 0, 0.05]
);
return group;
}
// Parents and older sibling
createPerson({
x: -1.28,
rotation: 0.15,
skin: mats.skinLight,
hair: mats.hairBrown,
top: mats.teal,
trousers: material("#4f5962"),
hairstyle: "short",
nearSide: 1,
nearHand: 0.98,
nearElbow: 0.70,
cardigan: true,
longSleeve: true
});
createPerson({
x: 1.08,
rotation: -0.18,
skin: mats.skinMedium,
hair: mats.hairDark,
top: mats.rust,
trousers: material("#55534f"),
hairstyle: "bob",
nearSide: -1,
nearHand: -0.98,
nearElbow: -0.70,
cardigan: false,
longSleeve: true
});
createPerson({
x: 2.08,
z: -1.49,
rotation: -0.48,
scale: 0.9,
y: 0.68,
skin: mats.skinDeep,
hair: mats.hairDark,
top: mats.mustard,
trousers: mats.navy,
hairstyle: "curly",
nearSide: -1,
nearHand: -0.74,
nearElbow: -0.59,
cardigan: false,
longSleeve: true
});
// Wrapped infant
const baby = new THREE.Group();
baby.position.set(-0.10, 0.91, -1.10);
baby.rotation.z = -0.045;
baby.rotation.x = 0.06;
scene.add(baby);
ellipsoid(baby, mats.blanket, [0, 0.17, 0], [0.29, 0.43, 0.25]);
ellipsoid(baby, mats.blanketLight, [0, 0.02, 0.215], [0.19, 0.25, 0.06]);
const swaddleBand = mesh(
new THREE.TorusGeometry(0.215, 0.018, 8, 30),
mats.blanketLight,
[0, 0.08, 0.02],
[1, 1.2, 1],
baby,
[Math.PI / 2, 0.12, 0]
);
mesh(
new THREE.CylinderGeometry(0.08, 0.09, 0.13, 12),
mats.skinDeep,
[0, 0.54, 0],
[1, 1, 1],
baby
);
const babyHead = new THREE.Group();
babyHead.position.set(0, 0.69, 0.015);
babyHead.rotation.x = 0.04;
baby.add(babyHead);
ellipsoid(babyHead, mats.skinDeep, [0, 0, 0], [0.18, 0.19, 0.17]);
mesh(
new THREE.SphereGeometry(
0.19, 24, 12, 0, Math.PI * 2, 0, Math.PI * 0.48
),
mats.blanketLight,
[0, 0.025, -0.004],
[1, 0.85, 1],
babyHead
);
curveTube(
babyHead,
[[-0.105, 0.018, 0.155], [-0.067, 0.004, 0.166], [-0.032, 0.018, 0.157]],
0.006,
mats.black
);
curveTube(
babyHead,
[[0.032, 0.018, 0.157], [0.067, 0.004, 0.166], [0.105, 0.018, 0.155]],
0.006,
mats.black
);
// Welcome meal table
const tableCenter = new THREE.Vector3(-0.45, 0, 1.10);
mesh(
new THREE.CylinderGeometry(1, 1, 0.14, 48),
mats.wood,
[tableCenter.x, 0.64, tableCenter.z],
[1.66, 1, 1.02]
);
for (const dx of [-1.05, 1.05]) {
for (const dz of [-0.47, 0.47]) {
mesh(
new THREE.CylinderGeometry(0.075, 0.095, 0.58, 12),
mats.darkWood,
[tableCenter.x + dx, 0.30, tableCenter.z + dz],
[1, 1, 0.82]
);
}
}
function plate(localX, localZ) {
const x = tableCenter.x + localX;
const z = tableCenter.z + localZ;
mesh(
new THREE.CylinderGeometry(0.255, 0.235, 0.025, 32),
mats.cream,
[x, 0.727, z]
);
const rim = mesh(
new THREE.TorusGeometry(0.238, 0.016, 8, 36),
material("#d5c5a9"),
[x, 0.744, z],
[1, 1, 1],
scene,
[Math.PI / 2, 0, 0]
);
}
function mealBowl(localX, localZ) {
const x = tableCenter.x + localX;
const z = tableCenter.z + localZ;
plate(localX, localZ);
mesh(
new THREE.CylinderGeometry(0.205, 0.145, 0.14, 28),
material("#e7dcc8"),
[x, 0.805, z]
);
mesh(
new THREE.CylinderGeometry(0.182, 0.182, 0.012, 28),
mats.soup,
[x, 0.879, z]
);
mesh(
new THREE.TorusGeometry(0.199, 0.014, 8, 30),
material("#f1e8d7"),
[x, 0.875, z],
[1, 1, 1],
scene,
[Math.PI / 2, 0, 0]
);
}
function mug(localX, localZ) {
const x = tableCenter.x + localX;
const z = tableCenter.z + localZ;
mesh(
new THREE.CylinderGeometry(0.09, 0.08, 0.16, 20),
material("#6e8e88"),
[x, 0.80, z]
);
mesh(
new THREE.TorusGeometry(0.062, 0.017, 8, 22),
material("#6e8e88"),
[x + 0.095, 0.81, z],
[1, 1, 1],
scene,
[0, Math.PI / 2, 0]
);
mesh(
new THREE.CylinderGeometry(0.071, 0.071, 0.008, 20),
mats.cream,
[x, 0.884, z]
);
}
mealBowl(-1.18, -0.38);
mealBowl(-0.30, -0.50);
mealBowl(0.73, -0.35);
mealBowl(-0.14, 0.48);
mug(-0.89, -0.39);
mug(-0.01, -0.51);
mug(1.02, -0.35);
mug(0.15, 0.49);
// Serving dish
const servingX = tableCenter.x + 0.37;
const servingZ = tableCenter.z + 0.12;
mesh(
new THREE.CylinderGeometry(0.32, 0.25, 0.13, 32),
material("#d4a362"),
[servingX, 0.78, servingZ]
);
mesh(
new THREE.CylinderGeometry(0.275, 0.275, 0.012, 32),
mats.soup,
[servingX, 0.849, servingZ]
);
mesh(
new THREE.TorusGeometry(0.304, 0.018, 8, 34),
material("#edcf91"),
[servingX, 0.85, servingZ],
[1, 1, 1],
scene,
[Math.PI / 2, 0, 0]
);
// Bread and board
const breadX = tableCenter.x - 0.98;
const breadZ = tableCenter.z + 0.32;
mesh(
roundedBoxGeometry(0.64, 0.035, 0.34, 0.04),
material("#a97a50"),
[breadX, 0.735, breadZ]
);
ellipsoid(
scene,
mats.bread,
[breadX, 0.82, breadZ],
[0.34, 0.16, 0.17]
);
for (const offset of [-0.16, 0, 0.16]) {
const score = mesh(
new THREE.BoxGeometry(0.025, 0.014, 0.18),
mats.breadScore,
[breadX + offset, 0.943, breadZ],
[1, 1, 1],
scene,
[0, 0.2, 0]
);
}
// Gentle steam above the shared dish
const steamMaterial = new THREE.MeshBasicMaterial({
color: "#fff8e8",
transparent: true,
opacity: 0.32,
depthWrite: false
});
const steam = [];
for (let i = 0; i < 3; i++) {
const wisp = curveTube(
scene,
[
[0, 0, 0],
[0.05, 0.11, 0.01],
[-0.025, 0.23, -0.01],
[0.025, 0.35, 0]
],
0.008,
steamMaterial.clone()
);
wisp.position.set(
servingX + (i - 1) * 0.10,
0.88,
servingZ + (i % 2 ? 0.035 : -0.035)
);
wisp.userData.phase = i * 1.7;
steam.push(wisp);
}
// Side table, books, and a small framed photo
mesh(
new THREE.CylinderGeometry(0.48, 0.48, 0.09, 32),
mats.wood,
[-3.45, 0.78, -0.78]
);
for (const dx of [-0.28, 0.28]) {
mesh(
new THREE.CylinderGeometry(0.045, 0.06, 0.73, 10),
mats.darkWood,
[-3.45 + dx, 0.39, -0.78]
);
}
const bookOne = mesh(
roundedBoxGeometry(0.55, 0.08, 0.36, 0.025),
material("#8a5d52"),
[-3.55, 0.86, -0.78],
[1, 1, 1],
scene,
[0, 0.13, 0]
);
const bookTwo = mesh(
roundedBoxGeometry(0.48, 0.07, 0.32, 0.02),
material("#637d78"),
[-3.52, 0.93, -0.77],
[1, 1, 1],
scene,
[0, -0.08, 0]
);
mesh(
roundedBoxGeometry(0.34, 0.40, 0.055, 0.025),
mats.darkWood,
[-3.18, 1.01, -0.83],
[1, 1, 1],
scene,
[0, -0.1, 0]
);
mesh(
new THREE.PlaneGeometry(0.25, 0.31),
material("#d7c6a8"),
[-3.18, 1.01, -0.798],
[1, 1, 1],
scene,
[0, -0.1, 0]
);
// Floor lamp
mesh(
new THREE.CylinderGeometry(0.28, 0.32, 0.08, 28),
mats.brass,
[3.72, 0.08, -2.25]
);
mesh(
new THREE.CylinderGeometry(0.035, 0.045, 2.65, 14),
mats.brass,
[3.72, 1.4, -2.25]
);
mesh(
new THREE.CylinderGeometry(0.32, 0.5, 0.54, 32, 1, true),
mats.lampShade,
[3.72, 2.72, -2.25]
);
const lampLight = new THREE.PointLight("#ffd28d", 24, 5.2, 2);
lampLight.position.set(3.72, 2.55, -2.16);
lampLight.castShadow = true;
lampLight.shadow.mapSize.set(512, 512);
scene.add(lampLight);
// Plant
mesh(
new THREE.CylinderGeometry(0.32, 0.24, 0.48, 24),
mats.terracotta,
[-3.82, 0.27, -2.38]
);
mesh(
new THREE.TorusGeometry(0.31, 0.035, 8, 28),
material("#c98261"),
[-3.82, 0.49, -2.38],
[1, 1, 1],
scene,
[Math.PI / 2, 0, 0]
);
const plantLeaves = [
[-0.23, 1.08, 0.00, -0.55, 0.55],
[0.20, 1.22, 0.02, 0.62, 0.48],
[-0.12, 1.47, -0.03, -0.35, 0.52],
[0.17, 1.62, -0.02, 0.42, 0.48],
[-0.22, 1.78, 0.00, -0.42, 0.47],
[0.02, 1.95, -0.05, 0.08, 0.46]
];
plantLeaves.forEach(([dx, y, dz, rz, length], index) => {
rod(
scene,
[-3.82, 0.45, -2.38],
[-3.82 + dx, y, -2.38 + dz],
0.015,
mats.leaf
);
ellipsoid(
scene,
index % 2 ? mats.leaf : mats.leafLight,
[-3.82 + dx, y, -2.38 + dz],
[0.12, length, 0.055]
);
});
// Small woven basket
mesh(
new THREE.CylinderGeometry(0.31, 0.26, 0.46, 24),
material("#b88c62"),
[3.45, 0.25, 0.12]
);
mesh(
new THREE.TorusGeometry(0.30, 0.035, 8, 26),
material("#d1ab7f"),
[3.45, 0.49, 0.12],
[1, 1, 1],
scene,
[Math.PI / 2, 0, 0]
);
// Direct camera controls
const controls = {
target: new THREE.Vector3(0, 1.25, -0.08),
radius: 10.8,
azimuth: 0.58,
polar: 1.16,
dragging: false,
pointerX: 0,
pointerY: 0
};
function updateCamera() {
const sinPolar = Math.sin(controls.polar);
camera.position.set(
controls.target.x + controls.radius * sinPolar * Math.sin(controls.azimuth),
controls.target.y + controls.radius * Math.cos(controls.polar),
controls.target.z + controls.radius * sinPolar * Math.cos(controls.azimuth)
);
camera.lookAt(controls.target);
}
function resetView() {
controls.target.set(0, 1.25, -0.08);
controls.radius = 10.8;
controls.azimuth = 0.58;
controls.polar = 1.16;
updateCamera();
}
canvas.addEventListener("pointerdown", event => {
controls.dragging = true;
controls.pointerX = event.clientX;
controls.pointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.focus();
});
canvas.addEventListener("pointermove", event => {
if (!controls.dragging) return;
const dx = event.clientX - controls.pointerX;
const dy = event.clientY - controls.pointerY;
controls.pointerX = event.clientX;
controls.pointerY = event.clientY;
controls.azimuth -= dx * 0.005;
controls.polar = THREE.MathUtils.clamp(
controls.polar - dy * 0.004,
0.64,
1.42
);
updateCamera();
});
function endDrag(event) {
controls.dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("wheel", event => {
event.preventDefault();
controls.radius = THREE.MathUtils.clamp(
controls.radius * Math.exp(event.deltaY * 0.001),
6.5,
15.5
);
updateCamera();
}, { passive: false });
canvas.addEventListener("keydown", event => {
if (event.key === "ArrowLeft") controls.azimuth += 0.09;
else if (event.key === "ArrowRight") controls.azimuth -= 0.09;
else if (event.key === "ArrowUp") controls.polar = Math.max(0.64, controls.polar - 0.07);
else if (event.key === "ArrowDown") controls.polar = Math.min(1.42, controls.polar + 0.07);
else if (event.key === "+" || event.key === "=") controls.radius = Math.max(6.5, controls.radius - 0.6);
else if (event.key === "-") controls.radius = Math.min(15.5, controls.radius + 0.6);
else return;
event.preventDefault();
updateCamera();
});
canvas.addEventListener("dblclick", resetView);
resetButton.addEventListener("click", resetView);
window.addEventListener("resize", () => {
const width = window.innerWidth;
const height = window.innerHeight;
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
camera.aspect = width / height;
camera.fov = camera.aspect < 1 ? 52 : 42;
camera.updateProjectionMatrix();
});
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
if (!reduceMotion) {
steam.forEach(wisp => {
const phase = wisp.userData.phase;
wisp.position.y = 0.88 + Math.sin(elapsed * 0.8 + phase) * 0.035;
wisp.rotation.z = Math.sin(elapsed * 0.55 + phase) * 0.035;
wisp.material.opacity = 0.22 + (Math.sin(elapsed * 0.7 + phase) + 1) * 0.045;
});
}
renderer.render(scene, camera);
}
updateCamera();
animate();
</script>
</body>
</html>
```