Aldyparen (Algebraic Dynamic Parametric Renderer) is a program for rendering certain types of fractals as high-resolution images or videos.
- "Work frame" (right-hand side):
- Allows to explore a fractal (mouse to pan, wheel to zoom, Ctrl+wheel to rotate).
- Optimized to be interactive (with threads).
- Can be exported (rendered) to high-precision image (in BMP format).
- If frame rendering is expensive, increase "downsampling" factor.
- Then picture will be first rendered at low precision, and then "refined". This allows real-time interaction (pan/zoom/rotation) even if the picture is expensive to render.
- "Movie" (left-hand side):
- Can append frames from work frame.
- Can add smooth animation, where frames are continuously transformed
between key frames.
Animation is added between currently selected movie frame (on the left)
and work frame (on the right), if they are compatible.
- For example, it can transform function
z^2
toz^3
throughz^2.5
.
- For example, it can transform function
- Can be exported (rendered) to a video file in MP4 format.
- "Painters" - abstract framework allowing exploring and rendering different things:
MandelbroidPainter
- generalization of Mandelbrot set for arbitrary function.- Basically replaced
z^2+c
with arbitraryf(z,c)
. - It has parameters:
gen_function
(a function of two argumentsz
andc
, for example"z**2+c""
),radius
andmax_iter
. - To paint point
c
, we start wez=0
and repeatz := gen_function(z,c)
until either|z| > radius
or we didmax_iter
iterations. Number of iterations made determines the color of the pointc
. - I call such generalized Mandlbrot fractal a "Mandelbroid fractal".
- Basically replaced
MadnelbroidHighPrecisionPainter
- paints Mandelbroid fractal, but with high-precision.- Will render Mandelbroid set correctly at very high zoom, where standard 64-bit floating point arithmetic fails because of insufficient precision. To illustrate why we need high-precision, compare these two pictures: 1, 2. They both show the same region of the Burning Ship fractal, but the first one uses standard 64-bit floating arithmetic, while the second uses high-precision arithmetic.
- Parameters:
gen_function
,radius
andmax_iter
- same as forMandelbroidPainter
.precision
- size of long number. Number of decimal digits after dot is8*precision
.
- Currently
gen_function
supports addition, subtraction, multiplication andthe following functions:sqr
- square,sqr(z) = z * z
.abscw
- component-wise modulus,abscw(z) = |Re(z)| + i*|Im(z)|
.
- Panning with mouse will not work at very high zoom, but you can specify center with arbitrary precision in a text edit in the "Transform" tab, and it will work correctly.
- It's not well optimized. Long arithmetic implemented from scratch in Python and sped up with Numba.
- I originally intended this for rendering video of deep zooms, but there is much better specialized software for that.
MadnelbrotHighPrecisionPainter
- specialized version ofMadnelbroidHighPrecisionPainter
.- Renders only Mandelbrot set with fixed
radius=2
, but does it more efficiently. - Parameters:
max_iter
.
- Renders only Mandelbrot set with fixed
JuliaPainter
- displays Julia set.- Can be used to show Newton fractal
(pass
func = z - P(z)/P'(z)
). - Parameters:
func
,iters
,tolerance
,max_colors
.
- Can be used to show Newton fractal
(pass
SierpinskiCarpetPainter
- renders Sierpinski carpet, as an example of non-algebraic fractal.- Parameters:
depth
.
- Parameters:
- Configurable color palette.
- Painters are supposed to return numbers of colors (0,1,2...). Then they are mapped to RGB colors using palette. If palette is smaller than number of colors, it's repeated from beginning.
- There are some preset palettes (grayscale, gradient, etc.).
- You can change individual colors by clicking on them in the "Palette" tab.
- Example of using this as Python library - link.
- Example project - link (rendered video - link).
- Example high-resolution renders - link.
Requirements:
- OS: Windows/Linux/MacOS.
- Python 3.10 or higher.
- Git.
Run from command line:
git clone https://github.com/fedimser/aldyparen-py.git
cd aldyparen-py
pip3 install -r requirements.txt
python3 run_gui.py
This application is written in Python using PyQt5. UI layout designed using Qt Designer. I used Numba for optimizing numerical calculations.
This is a Python clone (rewritten from scratch) of Aldyparen, which I have written in C# back in 2017. This app has all the functionality of the old Aldyparen, plus some extra features (e.g. new "painters").
To start development, create virtualenv and install dependencies:
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
To run tests and validate style before commit, run:
pycodestyle --max-line-length=120 ./aldyparen && python3 -m pytest .