Coral Reef
A living tropical reef in turquoise water: a boids school of 420 fusiliers splits around a passing blacktip shark, clownfish weave through a swaying anemone and a sea turtle glides past, under caustics, god rays and marine snow.
Made in Claude Code (Claude subscription) with claude-opus-5.5. The agent wrote code, looked at the preview and fixed it over several iterations. This is not a single-shot result: comparisons on this site show models in one attempt.
Starting prompt
Build "Coral Reef": a living tropical coral reef in clear turquoise water, rendered live in 3D and filmed like a slow nature-documentary dive. It should look real and beautiful from the very first frame, never toy-like. Single self-contained HTML file; Three.js and its addons from a CDN via an import map are fine; build everything procedurally (canvas textures are fine), no external models or image files. The scene (metres, y up; the water surface is about 13.5 m above the sand): - Sea floor: pale sand with gentle dunes, fine ripples (perturb the normal in the shader) and grain, scattered rubble and a few long-spined black sea urchins. - The reef: a low mound about 25 m wide of lumpy limestone outcrops, crusted with pink-purple coralline algae and green algal turf, plus a fine tiling crust texture (triplanar). Smaller patch reefs on the flanks, and distant outcrops that fade into the blue. - Corals, all procedural and with real proportions: - branching staghorn thickets (recursive, tapering branches with pale, blue or lilac growing tips); - brain corals (domes carved by meandering grooves made from noise); - table corals (wide, flat, wavy-edged plates on a short stalk, with a radial branchlet texture); - giant sea fans (a branching lattice plus a fine net, in magenta, orange and gold); - soft corals (pale stalks ending in clusters of small coloured polyps), leather corals and tube sponges. - Add a dense instanced carpet of smaller colonies so that the reef reads as alive and crowded, not a diorama. Sea fans, soft corals and anemone tentacles sway with the surge in the vertex shader. - Life: - A school of about 420 yellow-and-blueback fusiliers (blue body, yellow back and tail), in one InstancedMesh, swimming with a body wave in the vertex shader. Each fish has its own phase, and the tail beats faster when it swims faster. The school moves as boids: separation, alignment, cohesion, an attractor that drifts ahead of the diver, avoidance of the reef (as ellipsoids), and a soft floor and ceiling. - A blacktip reef shark (about 1.9 m, black fin tips) crosses the view every ~34 s through the school. Fish within ~5.5 m flee away and sideways, so the school splits and then reforms. - A pair of clownfish weaving inside a magnificent sea anemone of about 900 curved, swaying tentacles. - A steephead parrotfish cruising along the front of the reef. - A green sea turtle with a scuted shell gliding on a long loop, banking, with slow front-flipper strokes. - About 150 orange sea goldies hovering over the coral heads. The look: - Animated caustics on every lit surface: modulate the sun's direct light, so caustics respect shadows. - Slanted god rays from the surface (additive, flickering softly). - The rippled surface seen from below, with a bright Snell's window. - Thousands of drifting marine-snow specks. - Exponential depth fog towards turquoise blue, matched exactly by the background gradient so that there is no horizon line. - Soft sun shadows, ACES tone mapping, gentle bloom and a light vignette. - Clear and luminous, never washed out. Camera: a slow, drifting diver's camera with a gentle bob, on a looping ~100 s path: 1. A wide establishing view with the school over the reef. 2. Approach and close-up of the clownfish in the anemone. 3. The brain corals and the parrotfish. 4. The staghorn and table corals. 5. The sea fans while the turtle glides past. 6. A wide, upward view with the god rays, the school and the shark. Drag to orbit and scroll or pinch to zoom; never go below the sea floor. The camera returns to its path a few seconds after the last input. Everything starts automatically and is visibly moving from the first frame, without any interaction, and it loops forever. Interface: - A small, elegant caption at the bottom left: the title, "In view · depth in metres", and the common and scientific name of the most prominent subject in view (scored by screen position and apparent size, with hysteresis and a crossfade). - A tiny hint that fades after a few seconds. - The layout works in a ~1150×700 frame and on a phone (390×844, touch). Engineering rules (the page must work on the first load, with no fixes): - Use Three.js r170 and only methods that exist on each of its classes. Give every custom ShaderMaterial `fog: false`, and declare every uniform, constant and varying its shaders use. - Declare each identifier once. Inside one calculation, never reuse a shared scratch vector for two values that are both still needed; use local vectors. - Guard every animated value against NaN, and clamp shader terms that could reach infinity (an Inf pixel turns the bloomed image black). - It runs in a sandboxed iframe without same-origin: no localStorage, cookies, alerts or fetches. Cap the pixel ratio at 2 and use instancing to stay near 60 fps on a laptop. - Answer with the complete file exactly once, in a single ```html code block: no drafts, partial snippets or notes. Keep planning brief and write the code. Aim for roughly 700 to 1,000 lines, compact and well structured.