Totality: A Total Solar Eclipse
A total solar eclipse over a desert ridge, live in 3D: watchers lower their eclipse glasses as the Moon's shadow sweeps in, the diamond ring flares, the pearly corona and pink prominences hang over a 360° sunset, and town lights blink on in the valley.
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 "Totality: A Total Solar Eclipse": a cinematic, real-time 3D film of a total solar eclipse watched by a small group of people on a high desert ridge. It cuts between the watchers, telephoto views of the Sun and wide views of the land as the Moon's shadow sweeps in and out. It should feel like being there with them: awe, strange light, a black hole in the sky and a sunset all around the horizon. The Sun and the corona are the hero; the people make it a shared human moment in a real place. Single self-contained HTML file; Three.js r170 and its addons from a CDN via an import map are fine; build everything procedurally, with no external models, images or other files.
The sky objects (real angular sizes):
- The Sun: 0.533° across, 11° above the horizon towards the west-south-west (azimuth 250°). Draw the Sun, Moon, chromosphere, prominences and corona together on one camera-facing billboard (out to 9 solar radii) in a custom shader. The telephoto shots use the true size; the landscape shots draw this group about 3× larger, like a long-lens composite, so the corona still reads.
- The photosphere: limb darkening that reddens at the limb, granulation, faculae near the limb and a few sunspot groups (dark umbra, filamented penumbra). It is about 50,000× brighter than the inner corona.
- Compute the visible photosphere in each pixel exactly, along the radial line from the Sun's centre: find where that line enters and leaves the Moon's rim and measure the overlap with the pixel. Never blur the Moon's edge; at landscape scale a blurred edge leaks a ring of sunlight round the Moon that blooms into a white blob.
- The Moon: 0.555° across. It crosses the Sun from lower right to upper left on a path tilted 25° from vertical, 0.0018° off centre at mid-totality, so totality lasts 2 min 38 s.
- Its rim has a 1-D profile of mountains and valleys a few arcseconds deep (exaggerated about 3×), so Baily's beads appear at second and third contact.
- Near the contacts, sample the rim at 720 angles on the CPU to get the visible area of the beads and the brightest bead's position. Elsewhere use the analytic overlap of the two circles for the uncovered fraction.
- The chromosphere: a thin pink-red Hα shell just above the limb. It shows only where the Moon's rim is closest to the Sun's limb, so it flashes at the contacts by geometry.
- Prominences: six pink-magenta arches and hedgerow plumes made from noise-warped arcs with fine threads, up to 0.13 solar radii tall. Put the biggest arch on the side uncovered at second contact and a tall plume on the side uncovered at third. Let them partly hide the corona behind them so they stay pink.
- The corona near solar maximum:
- a pearly inner ring falling off steeply from the limb, then a gentle r^-1.9 fall-off;
- ten helmet streamers that narrow from broad petals into thin stalks and curve slightly; darker coronal-hole sectors, fine radial striations, faint loops low down and polar plumes;
- a very slow shimmer that never looks like fire;
- a fixed brightness. It appears by itself when the sky round the Sun goes dark and the exposure rises.
- Venus (about 45° from the Sun), Jupiter and about 400 stars, which appear only as the sky darkens and twinkle softly.
The place and the people (metres, y up):
- The camp sits on a broad, gently domed ridge top. The camera's ground is at 0 and a crest lies about 30 m towards the Sun, beyond which the ground rolls away into the valley.
- Six watchers stand along the crest 24–29 m from the camera, facing the Sun:
- a man in a cap, a woman with a ponytail, a child and a woman in a wide-brimmed sun hat: all four hold eclipse glasses to their eyes during the partial phases and lower them at totality; the man throws both arms up at the diamond ring, and the child and the woman in the sun hat point at the corona;
- a person in a beanie at a white refractor on a tripod, bent to it before totality and looking up during it;
- a hooded photographer at a long lens on a tripod.
- Two more people stand far off at the ridge's east edge to watch the shadow leave, one pointing after it. They are only ever seen small and distant: no close, lit people anywhere in the film.
- Build them from smooth lathe and capsule shapes: sloped shoulders, jackets longer than the hips, a relaxed stance with one knee bent, hair, caps and hats. Their silhouettes must read as real people. Pose the arms (shoulder and elbow) and the head with pivots, and give them a slow breathing sway.
- A two-tone camper van (sage body, cream pop-top) with windows, two folding chairs and a lantern, and an orange dome tent. As totality falls, the van's windows, the tent and the lantern glow warm and light the ground around them.
- Sandstone boulders built as rounded boxes with bedding grooves and cracks, smooth and high-resolution (never faceted), and about 170 sage bushes that sway slightly.
- The ground is desert pavement: dark varnished pebbles over pale sand, pale rock slabs, cracks and dry grass, with a fine bump only near the camera.
- The camp casts sharp shadows from the low Sun via a shadow map over the camp only, sampled with a 3×3 filter.
- The valley lies 190 m below. A small town 8–11 km away has about 200 street and window lights. Each light switches on at its own light level as the shadow arrives (computed in the vertex shader from the local uncovered fraction) and off again after.
- Layered mesas with cliffs and talus begin 5–15 km out (furthest out towards the Sun, so the valley and the town stay open), and blue mountain ranges rise beyond 40 km. Bend the far land down with the Earth's curvature (with refraction).
- Build the land as one polar grid centred on the camp, from 0.3 m to 350 km. Give it finer angular steps towards the Sun and in the other shot directions, and rings that grow geometrically, finer across the mesa belt. Split it into 16 sectors and into near (under 2 km) and far parts so it can be culled.
The light:
- The umbra is a cylinder 110 km wide whose axis follows the eclipse: the camera's offset from the axis mirrors the Moon's offset from the Sun. So "inside the shadow" means exactly zero uncovered fraction, everywhere at once.
- Rays near the horizon see a broad umbra whose axis is tilted 50° up towards the Sun, so its footprint is an oval and the twilight glows all round the horizon.
- Rays above about 9° see the true line to the Sun, so the sky round the eclipsed Sun stays dark. Blend the two between 1° and 9°.
- Any point's sunlight is the uncovered fraction at its distance from the axis, read from a lookup table of the circle overlap.
- Sky: single scattering (Rayleigh plus aerosol, in km, with an exponential atmosphere and the Earth's curvature) with the analytic umbra.
- Integrate it per vertex (24 samples) on a dome whose rows crowd towards the horizon, and apply the Rayleigh and aerosol phase functions per pixel.
- The far in-scattered light from more than about 20 km away, where the uncovered fraction is tiny, turns orange in totality. This gives a narrow orange-to-peach band all round the horizon under a deep navy sky.
- Before totality the umbra arrives as a dark band climbing the sky, and the valley darkens.
- Land: per-vertex aerial perspective with the same model (12 samples far, 6 near) and per-vertex uncovered fraction, so the land outside the shadow stays lit.
- Light it with sunlight × uncovered fraction × N·L, a sky hemisphere that turns dim blue in totality, a warm horizon glow on vertical faces, and the camp lamps.
- Shadow bands: faint, fast, wavy light-and-dark ripples over the ground in the seconds around the contacts.
The look:
- Render HDR (half-float, 4× MSAA) and build bloom from a 6-level mip pyramid (13-tap down, tent up).
- Clamp the bloom input to 40 ÷ exposure, so a single bead of photosphere cannot flood the frame.
- Add the diamond-ring and crescent glare after exposure, in display units, at the projected bead: a tight core, a soft halo and six faint spikes. Shrink it to about a third while the crescent is still more than about 0.3% of the Sun, so the partial phase is not a big starburst.
- Exposure follows the uncovered fraction u, but never all the way (no washed-out wide shots):
- landscape shots: 50 / (1 + 400u)^1.08;
- telephoto: 22 / (1 + 2500u)^0.85;
- filtered: 1.
- Totality stays dark and rich. The deep partial phase is steely: desaturate towards a cool violet, add an S-curve of contrast after tone mapping, and before totality also darken the frame by half. That makes the approach eerie, deep and never washed out. After totality only a trace of the darkening remains, because the light floods back.
- ACES filmic tone mapping (the Hill fit, as in three.js) and sRGB output in your own final pass, then a soft vignette and fine grain.
The film: 72 seconds, then it loops. Eclipse time τ (seconds from mid-totality) follows a monotone cubic through keyframes in each shot, so it races through the approach and slows at the contacts. Each cut is a 0.8 s cross-dissolve from a frozen frame of the outgoing shot, captured in its last 0.14 s; the loop point is just another dissolve, never black.
1. Second contact (0–9.8 s; τ −128 → −64): a medium shot (23° → 20.4° field, slow push) from behind the watchers at eye height 1.36 m.
- It opens 99.5% covered, with the umbra 40 km away: a deep violet-steel sky, a small sharp crescent star and crisp black watchers holding up their glasses and casting long shadows towards the camera.
- The umbra climbs the sky as a dark band, the town lights come on and the glasses come down.
- Baily's beads and the diamond ring come at about 7.3 s; by 8 s the corona, the pink rim and the orange band all round the horizon are out.
2. Totality · the corona (9.8–22.5 s; τ −64 → −16): telephoto (2.55° → 2.2° field), drifting slowly across the corona. Prominences show on the upper-left limb.
3. Totality · a sunset all around (22.5–36.5 s; τ −16 → +52): wide (56° → 52°), panning from the south to the Sun across the camp. The van's windows glow under the eclipse, with the tent, the watchers, Venus, Jupiter and stars.
4. Third contact (36.5–46 s; τ +52 → +106): telephoto. The chromosphere and prominences return on the lower-right limb, then the beads and the second diamond ring at about 40 s, while the sky round the Sun brightens.
5. The shadow departs (46–59 s; τ +90 → +260): from the middle of the camp, looking east (36° field, tilted up so the sky fills most of the frame). The couple are two tiny figures about 50 m away at the ridge's edge. The orange twilight sinks over the dark eastern ranges, then the light floods back from behind the camera and the mesas reappear; the land and sky carry the shot.
6. Partial phase · the Sun returns (59–72 s; τ +1500 → +2350): telephoto through a solar filter: a deep-orange crescent with sunspots on black, growing.
- In portrait, widen the field (more for telephoto) and tilt the landscape shots up, so the eclipse, the band and the people all fit a phone.
Interface:
- A small, elegant caption at the bottom left:
- the title "Totality" in an italic serif;
- the current stage in small caps, for example "Second contact · the diamond ring", "Totality · a sunset all around" or "The shadow departs";
- a live readout of the percentage covered (99.99% at the beads, 100% in totality), eclipse time as T−mm:ss / T+mm:ss and the ground distance to the umbra's edge ("umbra 41 km", or "inside the umbra");
- a thin six-segment progress bar for the shots.
- Drag to look around; the view eases back to the film about 2.5 s after the last input.
- Everything starts automatically and moves from the first frame, with no fade-in, loader or title card. It works in a ~1380×620 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.
- Drive the film by the wall clock (`performance.now()`), never by an accumulated, frame-capped dt.
- Split the depth range: render the sky, the Sun, the stars, the town and the land beyond 2 km with a far camera (900 m to 480 km), clear depth, then render the near land and the camp with a near camera (0.2 m to 2.6 km). Nothing may z-fight.
- Before the first frame, compile every shader (both scenes, the shadow pass with its override material, and the post materials) with `compileAsync`, and upload the lookup tables.
- Cap the pixel ratio at 2. Skip the near pass and the shadow map in the telephoto shots. Allocate nothing per frame (reuse vectors, arrays and pose tables).
- Guard every animated value and the HDR image against NaN and Infinity.
- It runs in a sandboxed iframe without same-origin: no localStorage, cookies, alerts or fetches. Keep a steady 60 fps on a laptop at device pixel ratio 2.
- Declare each identifier once. Inside one calculation, never reuse a shared scratch vector for two values that are both still needed.
- 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 850 to 1,000 lines, compact and well structured.