almondbread
A deep-zoom fractal explorer for the Mandelbrot set and a few related fractals, for Macs with Apple silicon. You zoom with the mouse, the trackpad or the keyboard, and the view follows at the display's frame rate, down to a magnification of about 103000. It is free and open source.
Download
The latest release, signed and notarised by Apple.
Needs a Mac with Apple silicon (M1 or later) and macOS 14 Sonoma or newer. Open the .dmg and drag Almondbread to Applications. Or install it with Homebrew:
brew install --cask ractive/tap/almondbread
What it does
Moving around
The zoom goes where the pointer is. Hold Space to zoom in and Shift-Space to zoom out, or scroll and pinch; pan with two fingers or W A S D, change the speed with Q and E. R goes back to the whole set. The control center (⌘I) has every setting and lists all the shortcuts.
Z starts the autopilot, which zooms on by itself: move the pointer to steer it, or let it look for spirals and minibrots on its own. J starts a journey, an endless planned flight from landmark to landmark. Every journey has a number you can share, and there is a journey of the day. The travel journal remembers the places you stopped at: ⌘Z flies back, ⇧⌘Z forward again.
Places and tours
A catalogue of more than a hundred places, with thumbnails, is one click away: landmarks such as seahorse valley and the elephants, embedded Julia sets, minibrots at 101000, views at the depth limit, and places in each of the other fractals. Guided tours explain some of the maths along the way: what the colours mean, bulbs and their periods, period doubling and the Feigenbaum point, Misiurewicz points, Julia sets, why some points are hard to compute, and how the digits of π turn up at the neck of the set.
Fractals
Besides the Mandelbrot set there are the Multibrot sets z3 + c to z8 + c, the Mandelbar set (also called the Tricorn) and the Burning Ship, all with deep zoom. ⌘-click any point to open its Julia set, also with deep zoom; one click takes you back.
At shallow views a Buddhabrot or Nebulabrot look shows where the orbits of escaping points travel, instead of how fast they escape, live while you move.
Colours and overlays
There are dozens of palettes, from classic gradients to scientific colour
maps, and palettes from Ultra Fractal (.ugr) and Fractint
(.map) can be imported. The inside of the set can be one colour or
show its structure: the period of each bulb, the internal angle, bubbles
around each nucleus, or an interior distance estimate.
Overlays show a mini-map of the whole set (M), the orbit of the point under the pointer (O), the Julia set of that point (U), and a size scale (C) that compares the view with real things, from galaxies to the Planck length, and past that with nested imaginary universes. The π tour adds a meter that counts iterations at the neck of the set while the digits of π appear.
Some of the places
Six views from the catalogue. The depth is the magnification against the whole set.
How it works
A point c belongs to the Mandelbrot set if repeating z → z2 + c, starting at 0, never runs off to infinity; points outside are coloured by how quickly they run off. Drawing the set means iterating the rule for every pixel, thousands to millions of times. Deep views need far more digits than any hardware number has: at a magnification of 103000, neighbouring pixels differ only after about 3000 decimal places. almondbread uses the methods of current deep-zoom renderers, adapted to Apple GPUs, which compute in 32-bit floats only.
- Rust and Metal
- Everything except the user interface is written in Rust: the maths, the renderer, the scheduler, navigation and the Metal compute shaders that run on the GPU. The user interface is SwiftUI.
- Perturbation
- One point, the reference, is iterated in arbitrary precision on the CPU, with the app's own big-float arithmetic (at high precision, spread over up to three cores). Every pixel then iterates only its tiny difference from the reference orbit, in float32 on the GPU. The reference sits at the centre of a minibrot in the view when period detection and Newton's method find one, and it is reused while you pan and zoom.
- Rebasing
- When a pixel's orbit comes closer to zero than to the reference orbit, it continues from the start of the reference orbit (Zhuoran's rebasing, 2021). One reference then serves the whole picture, without the glitch detection older renderers needed.
- Skipping iterations
- Bivariate linear approximation (BLA, in Claude Heiland-Allen's binary-tree form) replaces long runs of iterations with one precomputed linear step wherever that stays within float32 accuracy. Near deep minibrots a linear approximation with period-aligned stages, after the Imagina renderer, skips more.
- Extended range
- A float32 cannot hold numbers much smaller than 10−38. Deep views run a kernel with rescaled differences and a separate exponent (floatexp: a float32 mantissa with a 32-bit integer exponent), which reaches the depth limit.
- Frames on time
- The GPU work is cut into resumable chunks of about 8 to 16 ms, sized from the measured throughput, so the window gets a new frame at every display refresh and no computation runs into the macOS GPU watchdog. A coarse preview comes first, then the full resolution, then progressive anti-aliasing.
- Checked against the CPU
- Errors in float32 are silent, so the GPU's results are compared with a CPU implementation of the same maths, in the tests and with a developer tool that is built from the source. At every view tested, down to a magnification of about 101000, the float32 error was smaller than the change from shifting the pixel grid by a fraction of a pixel.
The details, with measurements and sources, are in the project's knowledge base on GitHub. For a start on the maths: Numberphile's videos The Mandelbrot Set with Holly Krieger and What's so special about the Mandelbrot Set? with Ben Sparks, Wikipedia on the Mandelbrot set and on how it is plotted, Robert Munafo's encyclopedia Mu-Ency, and Claude Heiland-Allen's notes on deep zoom.
Source and licence
almondbread is open source under the MIT licence; the source is on GitHub, where bug reports and ideas are welcome. Much of the code was written by AI systems under my supervision (see AI_NOTICE). The repository also contains a version for iPhone and iPad; it is not released.