Prompt specification
Build or customize the Three.js 3D scene "Engulfment and persistence conceptual sequence" 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: Engulfment and persistence conceptual sequence
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/engulfment-and-persistence-conceptual-sequence-x0842
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts a stylized sequence illustrating an endosymbiotic hypothesis. Use three adjacent shallow display panels: a host cell near a small symbiont, membrane enclosure around it, and a later schematic host retaining the symbiont internally. Keep the symbiont recognizable across panels by shape and color. Show a continuous membrane boundary and distinguish an external particle from the retained internal structure. Use a short caption identifying this as a simplified evolutionary illustration, not a recording of a directly observed ancient event. Soft solid forms and restrained transparency should make each stage readable, with no unnecessary organelle crowding.
Working Three.js Starter (engulfment-and-persistence-conceptual-sequence-x0842):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Endosymbiotic Hypothesis — Three-Stage Illustration</title>
<style>
:root {
color-scheme: light;
--ink: #243947;
--muted: #667b89;
--line: #d8e2e8;
--paper: #eef3f6;
}
* { box-sizing: border-box; }
html, body {
width: 100%;
min-height: 100%;
margin: 0;
}
body {
display: grid;
grid-template-rows: auto minmax(0, 1fr) auto;
overflow: hidden;
color: var(--ink);
background:
radial-gradient(circle at 50% 28%, #f9fbfc 0%, var(--paper) 66%, #e6edf1 100%);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
header {
z-index: 2;
padding: 18px 26px 8px;
text-align: center;
pointer-events: none;
}
header h1 {
margin: 0;
font-size: clamp(1.35rem, 2.5vw, 2rem);
font-weight: 650;
letter-spacing: -0.025em;
}
header p {
margin: 5px 0 0;
color: var(--muted);
font-size: 0.72rem;
font-weight: 650;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.viewport {
min-height: 0;
overflow: auto;
scrollbar-color: #bac9d2 transparent;
scrollbar-width: thin;
}
#scene {
position: relative;
width: 100%;
min-width: 960px;
height: 100%;
min-height: 540px;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
}
footer {
z-index: 2;
padding: 12px 24px 17px;
text-align: center;
background: linear-gradient(to top, rgba(238, 243, 246, 0.98), rgba(238, 243, 246, 0));
}
footer p {
display: inline-block;
max-width: 900px;
margin: 0;
color: #536a78;
font-size: clamp(0.76rem, 1.2vw, 0.92rem);
line-height: 1.45;
}
footer strong {
color: #344c5b;
font-weight: 700;
}
@media (max-width: 720px) {
header {
padding: 14px 16px 4px;
}
footer {
padding: 8px 14px 12px;
}
}
</style>
</head>
<body>
<header>
<h1>Endosymbiotic hypothesis</h1>
<p>A simplified three-stage sequence</p>
</header>
<main class="viewport">
<div id="scene" aria-label="Three-panel illustration of a host cell engulfing and retaining a symbiont"></div>
</main>
<footer>
<p><strong>Simplified evolutionary illustration</strong> — not a recording of a directly observed ancient event.</p>
</footer>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneRoot = document.getElementById("scene");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeef3f6);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute("aria-label", "Three-dimensional scientific schematic");
sceneRoot.appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-6, 6, 3.25, -3.25, 0.1, 100);
camera.position.set(0, 1.25, 10);
camera.lookAt(0, 0.15, 0);
const hemisphere = new THREE.HemisphereLight(0xffffff, 0x91a6b3, 2.1);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffffff, 2.6);
keyLight.position.set(-4.5, 6.5, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 6;
keyLight.shadow.camera.bottom = -6;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 24;
keyLight.shadow.bias = -0.00035;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xbdd8e8, 0.65);
fillLight.position.set(5, 1, 5);
scene.add(fillLight);
const panelCenters = [-3.55, 0, 3.55];
const palette = {
panel: 0xf8fbfc,
panelEdge: 0xcbd8df,
host: 0xf1c3a5,
hostSide: 0xdca384,
membrane: 0x547589,
vesicle: 0xa9dce1,
symbiont: 0x2aa7a5,
symbiontSide: 0x187d7d,
particle: 0xe9ad4c,
label: 0x334c5b,
muted: 0x6b7f8b,
arrow: 0x9aafba
};
function roundedRectangleShape(width, height, radius) {
const x = -width / 2;
const y = -height / 2;
const shape = new THREE.Shape();
shape.moveTo(x + radius, y);
shape.lineTo(x + width - radius, y);
shape.quadraticCurveTo(x + width, y, x + width, y + radius);
shape.lineTo(x + width, y + height - radius);
shape.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
shape.lineTo(x + radius, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - radius);
shape.lineTo(x, y + radius);
shape.quadraticCurveTo(x, y, x + radius, y);
return shape;
}
function closedCurveFromPoints(points) {
return new THREE.CatmullRomCurve3(
points.map(([x, y]) => new THREE.Vector3(x, y, 0)),
true,
"catmullrom",
0.48
);
}
function makeTextSprite(text, width, color = palette.label, weight = 650) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 160;
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.textAlign = "center";
context.textBaseline = "middle";
context.fillStyle = color;
let fontSize = 68;
do {
context.font = `${weight} ${fontSize}px Inter, system-ui, sans-serif`;
if (context.measureText(text).width <= 960) break;
fontSize -= 2;
} while (fontSize > 30);
context.fillText(text, canvas.width / 2, canvas.height / 2 + 2);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.generateMipmaps = false;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, width * canvas.height / canvas.width, 1);
sprite.renderOrder = 20;
return sprite;
}
function makeLeader(group, points, color = 0x8296a2) {
const curve = new THREE.CatmullRomCurve3(
points.map(([x, y]) => new THREE.Vector3(x, y, 0.56)),
false,
"catmullrom",
0.25
);
const geometry = new THREE.TubeGeometry(curve, 32, 0.009, 6, false);
const material = new THREE.MeshBasicMaterial({ color });
const line = new THREE.Mesh(geometry, material);
line.renderOrder = 12;
group.add(line);
}
function createPanel(x, number, title, subtitle) {
const group = new THREE.Group();
group.position.x = x;
scene.add(group);
const shape = roundedRectangleShape(3.05, 4.55, 0.23);
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.12,
bevelEnabled: true,
bevelSegments: 3,
bevelSize: 0.035,
bevelThickness: 0.025,
curveSegments: 18
});
const panel = new THREE.Mesh(
geometry,
new THREE.MeshStandardMaterial({
color: palette.panel,
roughness: 0.92,
metalness: 0
})
);
panel.position.set(0, 0.15, -0.52);
panel.receiveShadow = true;
group.add(panel);
const borderPoints = shape.getPoints(120).map(p => [p.x, p.y + 0.15]);
const borderCurve = closedCurveFromPoints(borderPoints);
const border = new THREE.Mesh(
new THREE.TubeGeometry(borderCurve, 180, 0.012, 6, true),
new THREE.MeshBasicMaterial({ color: palette.panelEdge })
);
border.position.z = -0.37;
group.add(border);
const badge = new THREE.Mesh(
new THREE.CircleGeometry(0.145, 40),
new THREE.MeshBasicMaterial({ color: 0xdcecf1 })
);
badge.position.set(-1.19, 2.03, 0.02);
group.add(badge);
const numberSprite = makeTextSprite(String(number), 0.17, palette.membrane, 750);
numberSprite.position.set(-1.19, 2.03, 0.08);
group.add(numberSprite);
const titleSprite = makeTextSprite(title, 2.13, palette.label, 720);
titleSprite.position.set(0.08, 2.03, 0.08);
group.add(titleSprite);
const subtitleSprite = makeTextSprite(subtitle, 2.43, palette.muted, 520);
subtitleSprite.position.set(0, 1.67, 0.08);
group.add(subtitleSprite);
return group;
}
function createHost(group, points) {
const curve = closedCurveFromPoints(points);
const sampled = curve.getPoints(128);
const shape = new THREE.Shape();
shape.moveTo(sampled[0].x, sampled[0].y);
for (let i = 1; i < sampled.length; i++) {
shape.lineTo(sampled[i].x, sampled[i].y);
}
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.25,
bevelEnabled: true,
bevelSegments: 4,
bevelSize: 0.055,
bevelThickness: 0.045,
curveSegments: 24
});
const host = new THREE.Mesh(
geometry,
new THREE.MeshStandardMaterial({
color: palette.host,
roughness: 0.76,
metalness: 0
})
);
host.position.z = -0.16;
host.castShadow = true;
host.receiveShadow = true;
group.add(host);
const membrane = new THREE.Mesh(
new THREE.TubeGeometry(curve, 180, 0.022, 7, true),
new THREE.MeshBasicMaterial({ color: palette.membrane })
);
membrane.position.z = 0.205;
membrane.renderOrder = 8;
group.add(membrane);
return host;
}
function createSymbiont(group, x, y, rotation = 0) {
const capsule = new THREE.Mesh(
new THREE.CapsuleGeometry(0.165, 0.48, 8, 28),
new THREE.MeshPhysicalMaterial({
color: palette.symbiont,
roughness: 0.38,
metalness: 0,
clearcoat: 0.28,
clearcoatRoughness: 0.42
})
);
capsule.rotation.z = Math.PI / 2 + rotation;
capsule.position.set(x, y, 0.43);
capsule.castShadow = true;
group.add(capsule);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(0.166, 0.013, 8, 36),
new THREE.MeshBasicMaterial({ color: palette.symbiontSide })
);
rim.position.set(x - 0.245 * Math.cos(rotation), y - 0.245 * Math.sin(rotation), 0.43);
rim.rotation.y = Math.PI / 2;
rim.rotation.z = rotation;
rim.renderOrder = 9;
group.add(rim);
return capsule;
}
function createVesicle(group, x, y, radiusX, radiusY) {
const fill = new THREE.Mesh(
new THREE.CircleGeometry(1, 72),
new THREE.MeshBasicMaterial({
color: palette.vesicle,
transparent: true,
opacity: 0.28,
depthWrite: false,
side: THREE.DoubleSide
})
);
fill.scale.set(radiusX, radiusY, 1);
fill.position.set(x, y, 0.285);
fill.renderOrder = 6;
group.add(fill);
const points = [];
for (let i = 0; i < 64; i++) {
const angle = (i / 64) * Math.PI * 2;
points.push([
x + Math.cos(angle) * radiusX,
y + Math.sin(angle) * radiusY
]);
}
const curve = closedCurveFromPoints(points);
const membrane = new THREE.Mesh(
new THREE.TubeGeometry(curve, 140, 0.019, 7, true),
new THREE.MeshBasicMaterial({ color: palette.membrane })
);
membrane.position.z = 0.49;
membrane.renderOrder = 10;
group.add(membrane);
}
function createArrow(x) {
const group = new THREE.Group();
group.position.set(x, 0.15, 0.12);
const material = new THREE.MeshBasicMaterial({ color: palette.arrow });
const shaft = new THREE.Mesh(
new THREE.CylinderGeometry(0.022, 0.022, 0.18, 12),
material
);
shaft.rotation.z = Math.PI / 2;
shaft.position.x = -0.07;
group.add(shaft);
const tip = new THREE.Mesh(
new THREE.ConeGeometry(0.073, 0.15, 18),
material
);
tip.rotation.z = -Math.PI / 2;
tip.position.x = 0.13;
group.add(tip);
scene.add(group);
}
const earlyHost = [
[-1.08, 0.05], [-0.96, 0.61], [-0.54, 0.93], [0.01, 1.03],
[0.54, 0.83], [0.79, 0.43], [0.73, 0.02], [0.50, -0.38],
[0.03, -0.63], [-0.48, -0.58], [-0.90, -0.30]
];
const laterHost = [
[-1.18, 0.05], [-1.08, 0.68], [-0.62, 1.10], [0.02, 1.25],
[0.68, 1.03], [1.08, 0.55], [1.18, 0.03], [0.98, -0.50],
[0.48, -0.91], [-0.12, -1.02], [-0.72, -0.78], [-1.12, -0.38]
];
// Stage 1: host and nearby symbiont.
const stage1 = createPanel(
panelCenters[0],
1,
"HOST + SYMBIONT",
"before membrane uptake"
);
createHost(stage1, earlyHost);
createSymbiont(stage1, 1.06, 0.17, -0.10);
const hostLabel1 = makeTextSprite("host cell", 1.03, palette.label, 620);
hostLabel1.position.set(-0.57, -0.91, 0.60);
stage1.add(hostLabel1);
makeLeader(stage1, [[-0.57, -0.75], [-0.53, -0.57], [-0.39, -0.43]]);
const symLabel1 = makeTextSprite("symbiont", 0.92, palette.label, 620);
symLabel1.position.set(1.05, -0.43, 0.60);
stage1.add(symLabel1);
makeLeader(stage1, [[1.05, -0.29], [1.05, -0.09]]);
// Stage 2: a closed host-derived membrane surrounds the same symbiont.
const stage2 = createPanel(
panelCenters[1],
2,
"MEMBRANE ENCLOSURE",
"symbiont surrounded by host membrane"
);
createHost(stage2, earlyHost);
createVesicle(stage2, 0.57, 0.08, 0.51, 0.33);
createSymbiont(stage2, 0.57, 0.08, -0.08);
const enclosureLabel = makeTextSprite("engulfing membrane", 1.55, palette.label, 620);
enclosureLabel.position.set(0.37, -0.68, 0.60);
stage2.add(enclosureLabel);
makeLeader(stage2, [[0.37, -0.53], [0.42, -0.39], [0.47, -0.29]]);
// Stage 3: the host retains the recognizable symbiont internally.
const stage3 = createPanel(
panelCenters[2],
3,
"RETAINED SYMBIONT",
"later schematic host cell"
);
createHost(stage3, laterHost);
createVesicle(stage3, 0.07, 0.08, 0.56, 0.35);
createSymbiont(stage3, 0.07, 0.08, 0.07);
const internalLabel = makeTextSprite("internal symbiont", 1.43, palette.label, 620);
internalLabel.position.set(-0.57, -0.89, 0.60);
stage3.add(internalLabel);
makeLeader(stage3, [[-0.38, -0.75], [-0.22, -0.43], [-0.08, -0.18]]);
const particle = new THREE.Mesh(
new THREE.SphereGeometry(0.135, 28, 20),
new THREE.MeshStandardMaterial({
color: palette.particle,
roughness: 0.48,
metalness: 0
})
);
particle.position.set(1.10, -1.24, 0.36);
particle.castShadow = true;
stage3.add(particle);
const particleLabel = makeTextSprite("external particle", 1.45, palette.label, 620);
particleLabel.position.set(0.98, -1.62, 0.60);
stage3.add(particleLabel);
makeLeader(stage3, [[1.08, -1.47], [1.10, -1.34]]);
createArrow(-1.775);
createArrow(1.775);
function resize() {
const width = Math.max(1, sceneRoot.clientWidth);
const height = Math.max(1, sceneRoot.clientHeight);
const aspect = width / height;
const viewHeight = Math.max(6.2, 11.0 / aspect);
camera.left = -viewHeight * aspect / 2;
camera.right = viewHeight * aspect / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(sceneRoot);
resize();
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
</script>
</body>
</html>
```