Inspirations

Event Horizon

A black hole ray-traced live through curved spacetime: its hot accretion disk arches over and under the shadow, Doppler beaming lights one side, and the stars wrap into an Einstein ring. Drag to orbit.

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 "Event Horizon": a real-time render of a Schwarzschild black hole with a thin, hot accretion disk, in the look of the film Interstellar. Light paths are actually ray-traced through curved spacetime in a full-screen fragment shader, so every lensing effect comes from the physics and none of it is painted on. It should look like a cinematic space shot and be beautiful from the first frame. Single self-contained HTML file; Three.js r170 from a CDN via an import map is fine (or raw WebGL); build everything procedurally, no external images, textures or other files.

The physics (Schwarzschild radius r_s = 1, the hole at the origin, the disk in the plane y = 0):
- Trace one ray per pixel backwards from the camera. Integrate the photon orbit equation d²u/dφ² = −u + 1.5 r_s u² in its 3D Cartesian form, acceleration = −1.5 h² x / |x|⁵ with h = x × v fixed at the ray's start, using velocity Verlet with a step proportional to the distance from the hole.
- A ray that falls inside r = r_s is black. A ray that leaves past about 60 r_s moving outward samples the sky, after adding the weak-field bending still to come, (r_s / b)(1 − s / r), so the sky shows no seams.
- Each time the ray crosses y = 0 between the ISCO at 3 r_s and about 14 r_s, interpolate the crossing point, composite the disk front to back with its opacity, and keep tracing. This gives the direct image, the far side of the disk lensed over and under the shadow, and the thin photon ring at the shadow's edge (shadow radius about 2.6 r_s).
- Disk emission: a Novikov–Thorne-like flux F ∝ r⁻³(1 − √(3/r)), temperature ∝ F^¼ (peak about 4,700 K), Planck colour. Shift it by g = 1 / (u^t (1 − Ω ℓ)), with the Keplerian Ω = √(r_s / 2r³), u^t = 1 / √(1 − 1.5 r_s / r) and ℓ the photon's angular momentum about the disk axis. The observed temperature is g·T and the brightness scales with g³. The result is relativistic Doppler beaming (the approaching side brighter, whiter and bluer; the receding side dim orange-red) and a gravitational redshift towards the inner edge.
- Disk texture: turbulent fbm in log-polar coordinates, stretched along the orbit, with fine orbital streaks. Every radius turns at its own Keplerian speed (differential rotation). Use a three-layer flow map so the shear stays bounded and the pattern never winds up into noise. For the third and later disk images of a ray (the photon ring), use the disk's average emission, because neighbouring pixels land on unrelated parts of the disk.

The sky:
- A procedural starfield in three layers with blackbody tints, a faint galactic band with dust lanes and a warm core, and soft violet and teal nebula clouds. All of it is fixed in the world, so the camera's motion makes it stream past.
- The same ray tracer lenses it: a large Einstein ring of stretched star arcs, and a dark lensed nebula ring around the shadow. Widen each star to the pixel's lensed footprint on the sky (fwidth of the final ray direction) so that the arcs do not alias. Where one pixel covers too much sky, show the stars' mean glow instead of random sparks.

The look:
- Render the ray tracer in HDR to a half-float target, at an internal resolution that adapts to the device. Then add a mip-chain bloom, ACES tone mapping, a soft vignette and fine film grain.
- Warm and luminous, but the shadow stays pure black and the highlights are never washed out.

The camera, endless and smooth:
- A slow cinematic orbit at 24–31 r_s. It starts almost edge-on, about 5° above the disk, rises to about 30°, passes exactly edge-on and dips about 10° below the disk. Meanwhile the azimuth turns slowly and the camera rolls by a few degrees.
- Drag to orbit, and scroll or pinch to change the distance. The camera returns to its path a few seconds after the last input.

Interface:
- A minimal caption at the bottom left with the title and a few real numbers: photon sphere 1.5 r_s, shadow 2.60 r_s, ISCO 3 r_s at 0.5 c, and clocks at the ISCO running at 71%.
- Below them, the light equation and the current view: orbit or your view, above or below the disk, the inclination and the distance in r_s. Add a small interaction hint.
- Everything starts automatically and is visibly moving from the first frame, without any interaction. The layout works on a phone, with the hole a little above centre and the disk allowed to run off the sides.

Performance: keep it smooth on a laptop and on a phone. Measure the frame time and lower the ray tracer's pixel count, and then its step count, when frames slow down; raise them again when there is headroom. Cap the pixel ratio at 2.

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.
- 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 450 to 700 lines, compact and well structured.