Prompt specification
Build or customize the Three.js 3D scene "Yeast cell with bud neck" 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: Yeast cell with bud neck
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/yeast-cell-with-bud-neck-x0877
Scene Description Prompt:
Yeast cell with bud neck. Create one oval yeast cell with a smaller attached bud and visible narrow neck; add schematic bud scars without implying exact species-specific surface anatomy. Please build this with Three.js from cdnjs in one self-contained HTML file, using low-poly forms.
Working Three.js Starter (yeast-cell-with-bud-neck-x0877):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Low-Poly Yeast Cell with Bud</title>
<style>
:root {
color-scheme: light;
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eee3d4;
}
canvas {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
z-index: 0;
}
canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 2;
top: 22px;
left: 22px;
max-width: min(340px, calc(100vw - 44px));
padding: 15px 17px;
border: 1px solid rgba(102, 69, 48, 0.16);
border-radius: 14px;
background: rgba(255, 250, 242, 0.82);
box-shadow: 0 12px 32px rgba(83, 56, 39, 0.12);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
user-select: none;
}
.title {
margin: 0 0 5px;
color: #55382a;
font-size: 15px;
font-weight: 700;
letter-spacing: 0.01em;
}
.description {
margin: 0;
color: #775e50;
font-size: 12px;
line-height: 1.45;
}
.controls {
position: fixed;
z-index: 2;
right: 22px;
bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.hint {
padding: 8px 11px;
border: 1px solid rgba(102, 69, 48, 0.14);
border-radius: 999px;
background: rgba(255, 250, 242, 0.78);
color: #775e50;
font-size: 11px;
white-space: nowrap;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
button {
border: 1px solid rgba(102, 69, 48, 0.18);
border-radius: 999px;
padding: 8px 12px;
background: #fff8ee;
color: #684838;
font: inherit;
font-size: 11px;
cursor: pointer;
box-shadow: 0 5px 16px rgba(83, 56, 39, 0.1);
}
button:hover {
background: #fffdf8;
transform: translateY(-1px);
}
button:active {
transform: translateY(0);
}
@media (max-width: 600px) {
.panel {
top: 14px;
left: 14px;
max-width: calc(100vw - 28px);
}
.controls {
right: 14px;
bottom: 14px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<section class="panel" aria-label="Scene information">
<h1 class="title">Schematic budding yeast cell</h1>
<p class="description">
Low-poly mother cell and smaller attached bud with a narrow neck.
Surface marks are abstract scar glyphs, not species-specific anatomy.
</p>
</section>
<div class="controls">
<span class="hint">Drag to orbit · Scroll or pinch 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";
// ------------------------------------------------------------------
// Renderer, scene, and camera
// ------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee3d4);
scene.fog = new THREE.Fog(0xeee3d4, 9, 17);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
50
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
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 three-dimensional schematic yeast cell"
);
document.body.prepend(renderer.domElement);
const target = new THREE.Vector3(0.03, 0.02, 0);
const orbit = {
theta: 0.28,
phi: 1.25,
radius: 6.35
};
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
target.y + orbit.radius * Math.cos(orbit.phi),
target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(target);
}
updateCamera();
// ------------------------------------------------------------------
// Lighting and ground
// ------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(
0xfff5e5,
0x80675a,
2.0
);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff0d6, 3.1);
keyLight.position.set(4.5, 6.5, 5.2);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -4;
keyLight.shadow.camera.right = 4;
keyLight.shadow.camera.top = 4;
keyLight.shadow.camera.bottom = -4;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 15;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xd9e8ff, 1.15);
fillLight.position.set(-4, 2.5, 3);
scene.add(fillLight);
const rimLight = new THREE.DirectionalLight(0xffb86f, 1.45);
rimLight.position.set(-3, 1.5, -4.5);
scene.add(rimLight);
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
new THREE.MeshStandardMaterial({
color: 0xeee1cf,
roughness: 1,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -1.12;
ground.receiveShadow = true;
scene.add(ground);
// ------------------------------------------------------------------
// Low-poly organic ellipsoid generator
// ------------------------------------------------------------------
function makeFacetedEllipsoid(
radiusX,
radiusY,
radiusZ,
widthSegments,
heightSegments,
baseColor,
seed
) {
const source = new THREE.SphereGeometry(
1,
widthSegments,
heightSegments
);
const geometry = source.index
? source.toNonIndexed()
: source;
source.dispose();
const positions = geometry.attributes.position;
for (let i = 0; i < positions.count; i++) {
const x = positions.getX(i);
const y = positions.getY(i);
const z = positions.getZ(i);
const length = Math.hypot(x, y, z) || 1;
const nx = x / length;
const ny = y / length;
const nz = z / length;
// Small deterministic irregularities avoid a perfect CG appearance.
const variation =
1 +
0.016 * Math.sin(
nx * 5.7 + ny * 3.1 + nz * 4.2 + seed
) +
0.009 * Math.cos(
nx * 9.2 - ny * 7.4 + nz * 5.1 + seed * 2
);
positions.setXYZ(
i,
nx * radiusX * variation,
ny * radiusY * variation,
nz * radiusZ * variation
);
}
positions.needsUpdate = true;
geometry.computeVertexNormals();
geometry.computeBoundingSphere();
// Slightly varied face colors reinforce the faceted construction.
const colors = [];
const base = new THREE.Color(baseColor);
for (let i = 0; i < positions.count; i += 3) {
const randomValue = Math.sin(
(seed * 997 + i * 12.9898) * 0.43758
) * 43758.5453;
const random = randomValue - Math.floor(randomValue);
const tone = 0.91 + random * 0.13;
const faceColor = base.clone().multiplyScalar(tone);
for (let vertex = 0; vertex < 3; vertex++) {
colors.push(faceColor.r, faceColor.g, faceColor.b);
}
}
geometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(colors, 3)
);
const material = new THREE.MeshStandardMaterial({
color: 0xffffff,
vertexColors: true,
roughness: 0.7,
metalness: 0,
flatShading: true,
dithering: true
});
return new THREE.Mesh(geometry, material);
}
// ------------------------------------------------------------------
// Cell, bud, and visible constricted neck
// ------------------------------------------------------------------
const cellModel = new THREE.Group();
scene.add(cellModel);
const motherCenter = new THREE.Vector3(-0.88, 0, 0);
const motherRadii = new THREE.Vector3(1.48, 1.08, 1.0);
const motherCell = makeFacetedEllipsoid(
motherRadii.x,
motherRadii.y,
motherRadii.z,
16,
10,
0xdc845b,
1.4
);
motherCell.position.copy(motherCenter);
motherCell.castShadow = true;
motherCell.receiveShadow = true;
cellModel.add(motherCell);
const budCell = makeFacetedEllipsoid(
0.76,
0.65,
0.68,
12,
8,
0xf1ae6c,
3.7
);
budCell.position.set(1.62, 0.09, 0);
budCell.castShadow = true;
budCell.receiveShadow = true;
cellModel.add(budCell);
// A low-segment lathed form creates an hourglass-like neck.
const neckProfile = [
new THREE.Vector2(0.31, -0.25),
new THREE.Vector2(0.24, -0.16),
new THREE.Vector2(0.21, 0.0),
new THREE.Vector2(0.24, 0.16),
new THREE.Vector2(0.30, 0.25)
];
const neckGeometry = new THREE.LatheGeometry(
neckProfile,
8
);
neckGeometry.computeVertexNormals();
const neck = new THREE.Mesh(
neckGeometry,
new THREE.MeshStandardMaterial({
color: 0xd37b50,
roughness: 0.78,
metalness: 0,
flatShading: true
})
);
neck.rotation.z = Math.PI / 2;
neck.position.set(0.76, 0.08, 0);
neck.castShadow = true;
neck.receiveShadow = true;
cellModel.add(neck);
// ------------------------------------------------------------------
// Abstract bud-scar glyphs
//
// These are deliberately geometric and incomplete rather than modeled
// as anatomically specific scars for any particular yeast species.
// ------------------------------------------------------------------
const scarInsetMaterial = new THREE.MeshBasicMaterial({
color: 0x8f4938,
transparent: true,
opacity: 0.24,
side: THREE.DoubleSide,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -1
});
const scarRimMaterial = new THREE.MeshStandardMaterial({
color: 0xf8c593,
roughness: 0.85,
metalness: 0,
flatShading: true
});
function addSchematicScar(direction, scale, angle) {
const unitDirection = direction.clone().normalize();
const surfacePoint = new THREE.Vector3(
motherCenter.x + unitDirection.x * motherRadii.x,
motherCenter.y + unitDirection.y * motherRadii.y,
motherCenter.z + unitDirection.z * motherRadii.z
);
const surfaceNormal = new THREE.Vector3(
unitDirection.x / motherRadii.x,
unitDirection.y / motherRadii.y,
unitDirection.z / motherRadii.z
).normalize();
const tangent = new THREE.Vector3(0, 1, 0)
.cross(surfaceNormal);
if (tangent.lengthSq() < 0.0001) {
tangent.set(1, 0, 0);
}
tangent.normalize();
const bitangent = new THREE.Vector3()
.crossVectors(surfaceNormal, tangent)
.normalize();
const basis = new THREE.Matrix4().makeBasis(
tangent,
bitangent,
surfaceNormal
);
const scar = new THREE.Group();
scar.position.copy(surfacePoint).addScaledVector(
surfaceNormal,
0.027
);
scar.quaternion.setFromRotationMatrix(basis);
scar.rotateZ(angle);
scar.scale.setScalar(scale);
const inset = new THREE.Mesh(
new THREE.CircleGeometry(0.105, 7),
scarInsetMaterial
);
inset.position.z = 0.006;
scar.add(inset);
const brokenRim = new THREE.Mesh(
new THREE.TorusGeometry(
0.145,
0.022,
4,
12,
Math.PI * 1.52
),
scarRimMaterial
);
brokenRim.position.z = 0.018;
scar.add(brokenRim);
cellModel.add(scar);
}
addSchematicScar(
new THREE.Vector3(-0.48, 0.34, 0.81),
0.92,
0.35
);
addSchematicScar(
new THREE.Vector3(0.42, 0.36, 0.84),
0.76,
-0.75
);
addSchematicScar(
new THREE.Vector3(-0.18, -0.35, 0.92),
0.64,
1.15
);
// A subtle attachment crease helps separate the bud from the neck.
const attachmentCrease = new THREE.Mesh(
new THREE.TorusGeometry(0.222, 0.015, 4, 12),
new THREE.MeshStandardMaterial({
color: 0x99503c,
roughness: 0.9,
transparent: true,
opacity: 0.34,
depthWrite: false
})
);
attachmentCrease.rotation.y = Math.PI / 2;
attachmentCrease.position.set(0.91, 0.08, 0);
cellModel.add(attachmentCrease);
// ------------------------------------------------------------------
// Direct camera controls: orbit, wheel zoom, and pinch zoom
// ------------------------------------------------------------------
const pointers = new Map();
let previousPinchDistance = 0;
function pointerDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 2) {
previousPinchDistance = pointerDistance();
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
if (pointers.size === 1) {
const deltaX = event.clientX - previous.x;
const deltaY = event.clientY - previous.y;
orbit.theta -= deltaX * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi + deltaY * 0.005,
0.55,
2.12
);
}
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size >= 2) {
const distance = pointerDistance();
if (previousPinchDistance > 0 && distance > 0) {
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * (previousPinchDistance / distance),
4.15,
10.0
);
}
previousPinchDistance = distance;
}
updateCamera();
});
function endPointer(event) {
pointers.delete(event.pointerId);
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
previousPinchDistance =
pointers.size >= 2 ? pointerDistance() : 0;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
4.15,
10.0
);
updateCamera();
},
{ passive: false }
);
function resetView() {
orbit.theta = 0.28;
orbit.phi = 1.25;
orbit.radius = 6.35;
updateCamera();
}
document.getElementById("reset").addEventListener("click", resetView);
renderer.domElement.addEventListener("dblclick", resetView);
// ------------------------------------------------------------------
// 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();
const reduceMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
function animate() {
const elapsed = clock.getElapsedTime();
if (!reduceMotion) {
// A restrained sway keeps the low-poly structure readable.
cellModel.rotation.y =
-0.07 + Math.sin(elapsed * 0.22) * 0.12;
cellModel.rotation.z =
Math.sin(elapsed * 0.18) * 0.008;
}
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>
```