Fractal Flame
A fractal flame generator in Python: the Chaos Game (IFS) algorithm, multiprocess rendering that merges the workers' histograms, gamma correction and rotational symmetry.

Stack
- Python
- NumPy
- multiprocessing
Key technical decisions
- Rendering is split across processes, and the workers' histograms are merged into one.
- Gamma correction after the logarithmic density transform: without it the image comes out flat.
- Rotational symmetry as a separate parameter of the composition.
- Parameters come from the CLI and a JSON config, so any frame can be rebuilt from the one it was made with.
- Strict typing checked by mypy, unit and integration tests, linting and CI.
An implementation of the fractal flame algorithm: a large number of points are run through a set of affine and non-linear transforms following the Chaos Game (IFS) scheme and accumulated in a density histogram, which then goes through a logarithmic transform and, after it, gamma correction.
Rendering runs in one process or several, and the parallel results merge into a single histogram. The worker count affects speed. Each worker also follows its own sequence of random points, so frames built with different process counts can differ in small details.
What gamma correction buys
Point density is heavily skewed: without gamma correction almost everything lands in the dark tones and the structure disappears. The correction brings out detail in the low-density regions without blowing out the dense ones. Here is the same frame with it and without:


Every example on this page has a config behind it. They all live in the repository, and the two frames above differ by a single value in them.
Media

Constellation — sparse, star-like structure, 5-fold symmetry 
Aurora — soft gradients, 9-fold symmetry, gamma correction 
Neon Flower — 8-fold radial symmetry, high colour contrast 
Phoenix — 11-fold radial symmetry, four combined transformations 
Ember Ring — ring-like structure, 6-fold symmetry 
Pretty Flame — several transformations, symmetry and gamma correction 
Spiral Core — central spiral structure, no symmetry 
Soft Smoke — smoke-like gradients, no symmetry