S4 is a realtime fullscreen animation of a Schwarzschild black hole and its thin accretion disk.
The disk is computed from Jean-Pierre Luminet's 1979 method: photon trajectories, the primary image and the secondary ghost image, gravitational and Doppler redshift, and the flux an observer would see. Each sample is a 1-pixel 3-by-3 plus that flips between + and X. There is no smoothing.
This is a live picture, not a museum print. We favor a fast, readable animation over matching every pixel of the 1979 plate.
Luminet, J.-P. (1979). Image of a spherical black hole with thin accretion disk. Astronomy and Astrophysics, 75, 228-235. ADS abstract (accessed: 2026-08-17).
The physics reference is Nick Hughes's luminet_blackhole (accessed: 2026-08-17), checked out as a git submodule at ref/luminet_blackhole. S4 ports the equations in src/; it does not depend on that crate at build or runtime.
Related work: Chris Smoak's IOCCC 2025 winning entry cesmoak (accessed: 2026-08-17), the "Retro space award." It restages Luminet's 1978 IBM 7040 workflow as a FORTRAN 66 subset, punch cards, and a black-hole flux image. S4 does not run that program.
just install
s4That puts s4 on your Nix profile PATH and upgrades it when the flake is already added (nix profile add --impure path:., then nix profile upgrade --impure singularity-simulation). It is a fullscreen, screensaver-style viewer. By default it is fullscreen on the current or primary monitor at that output's native resolution, not a rectangle that spans every display. Press Escape or q to quit.
You can also just run without installing, or build from a cargo checkout:
cargo run --releaseTo pick a size, set both S4_WIDTH and S4_HEIGHT (pixels, at least 320 by 240):
S4_WIDTH=1920 S4_HEIGHT=1080 cargo run --releasejust checkThat runs nix flake check: rustfmt, clippy, the library tests, and a package build of s4. GitHub Actions runs the same flake. You need Nix (and just if you want that wrapper). nix flake check alone is the same path.
The library tests do not open a window. winit plus softbuffer is only a proposed window backend.
S4 is released under The Unlicense.