The Wave at Sunset
A 14-second swell meets a reef at sunset, live in 3D: it steepens, pitches into a peeling barrel whose thin lip glows turquoise with the sun behind it, and dissolves into foam beside a headland of pines and palms, a lighthouse and lit beach houses.
Made in Claude Code (Claude subscription) with claude-fable-5.2. 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 "The Wave at Sunset": a real-time 3D film of a long ocean swell that feels a reef, steepens and pitches into a hollow, peeling barrel while the low sun shines through its lip. It should look like golden-hour surf photography and be beautiful from the first frame: no loader, no title card, no fade-in. Single self-contained HTML file; Three.js and its addons from a CDN via an import map are fine; build everything procedurally (data and canvas textures are fine), no external models or image files. The scene (metres, y up; the shore is +z, the open sea −z, waves travel towards +z): - The swell: crests 14 s apart. Offshore they are low, long and fast; near the reef the wavelength shrinks to about 87 m (speed about 6 m/s) and the wave grows from roughly 1 m to a 3 m face. A set of four waves with slightly different heights (2.5 to 3.3 m) repeats. - The reef lies at an angle to the crests, so each wave starts to break near the headland (+x) and the break point runs along the crest towards −x at 8 m/s. Past x ≈ −90 m is a deep channel where the wave never breaks and only a smooth shoulder passes. - The wave is real geometry, not a height field: one ocean grid whose rows live in wave-phase space and bunch up around every crest. The cross-section morphs with the time since breaking: a smooth hump, a steep concave wall, a lip thrown forward along a spiral that falls as a curtain and closes a tube about 20 m long, then a collapsing bore that fades shorewards. The lip edge is ragged. - Water shading: Fresnel reflection of the sky with three or four scales of wind ripples, a glitter path under the sun, and light transmitted through the wave. Estimate the thickness of water between the sun and each point: the thin lip glows pale gold-green, the upper face translucent turquoise and emerald, the base stays dark. Inside the tube the back wall is dim and the ceiling glows. - Foam and spray: a white feathering crest, a foamy lip edge with streaks, a tumbling bore, and laces of foam left behind that stretch up the face of the next wave and thin out with age. Tens of thousands of stateless particles are born on the lip and the bore: fine droplets and soft mist that the offshore wind blows back over the crest, backlit and golden against the sun. - No people anywhere. The human touch comes from things: the lighthouse, the lit houses and a small fishing boat (about 7 m, with a cabin, a mast and a lit lantern) moored at a buoy in the calm lee of the point, rocking gently. - The headland: a point about 250 m away on the right, in a realistic style that must hold up when the camera passes within 150 m. On its tip a white lighthouse with a red band (a glowing lantern and two slowly turning beams) and a keeper's house; along the bay side nine beach houses on stilts with warm lit windows; behind it, layers of distant coast fading into haze. - Its vegetation must read as real coastal plants, not blobs: wind-shaped pines with leaning trunks and flat terraces of foliage swept to leeward on the crest and the point; broadleaf trees with visible trunks, limbs and several lumpy foliage masses in groves on the slopes; coconut palms with curved trunks and crowns of drooping fronds made of leaflets along the shore and by the houses; low shrubs, some dry, scattered between them. Ragged leafy silhouettes (erode the outline with noise), darker undersides, varied greens, the low sun glowing through the edges of the leaves, a slight sway in the wind. Use instancing. The ground has grass, dry tawny patches, rock on steep faces and a sandy shore. - The waterline: dark faceted rocks all along the shore, larger around the point, a few sea stacks off its tip, a band of surf that surges around them and paler shallow water. The headland shelters the bay behind it, so the swell fades there. - The sky: the sun about 7° above the sea horizon, seawards and to the right, so the wave is backlit. Orange at the horizon near the sun, mauve and violet higher up, deep blue at the zenith, with soft bands of cloud lit from below in gold and pink that drift slowly. The look: ACES tone mapping, sRGB output, subtle bloom on the sun, the glitter and the windows, light aerial haze towards the horizon and a soft vignette. A deliberate palette of emerald, turquoise, gold and violet. Dramatic but readable: never muddy, never washed out. The film: a 56-second loop (four waves), one continuous camera move, driven by wall-clock time. 1. Tracking (0–10 s): the camera skims 1.5 m above the water, 12 m in front of the wave, and travels with the break. The barrel, the glowing lip, the blown spray and the sun over the crest fill the frame, with the lighthouse behind. 2. The channel (11–24 s): the camera settles over the shoulder and rises to 5 m, looking up the glitter path as the next wave of the set breaks along the reef in front of the headland. 3. From above (25–38 s): a slow aerial arc up to about 25 m shows the oblique break line, the lace of foam on turquoise water, the bore, and the houses, the boat and the lighthouse in the dusk. 4. Back out (39–54 s): the camera descends seawards over the bore, passes the point with its trees, rocks and lit houses, and meets the next wave exactly where the film began. The loop is seamless. Interface: a small, elegant caption in the lower left corner with the title, one line of physics for the current moment (the swell period and deep-water speed of 22 m/s, the slowing to √(g·d) ≈ 6 m/s over the reef, breaking where depth ≈ 1.3 × wave height, why the lip glows turquoise, the peel, the bore, the offshore wind), a short line of numbers and a thin progress line. Drag to look around; the view eases back to the path a few seconds after the last input. Everything starts by itself and is moving from the first frame. The layout works on a phone, with a wider field of view in portrait. 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. Drive all motion from `performance.now()`, make every period divide the 56 s loop, and allocate nothing per frame. - Keep it at 60 fps on a laptop: one draw call for the ocean, instancing for trees, merged static geometry, pixel ratio capped at 1.5 (step it down if frames run long), shaders warmed up with `renderer.compileAsync` before the first frame. - The page runs in a sandboxed iframe: no storage, no alerts, no navigation. - 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.