2022-06-07
As the orginal author Karl Runmo says:
Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler!
It works by using perturbation techniques and series approximation, to allow faster lower precision number types to be used for pixel iterations, based on a high precision reference.
I (Claude Heiland-Allen) forked the code and swapped out the custom arbitrary precision floating point code for highly optimized libraries, making it even faster. Cross-compiled to Windows from Linux MINGW64. Now with many other enhancements.
Original version:
This version:
Feedback:
Download the latest archive from the website: https://mathr.co.uk/kf/kf.html#download
Unzip it wherever you want, no installation required. You need 7-zip
to unzip .7z
archives, available from https://www.7-zip.org/.
Launch kf.x86_64.exe
for 64-bit (recommended), kf.i686.exe
for 32-bit.
Start exploring!
Use the mouse scroll wheel to zoom.
Choose different fractal formulas in the formula dialog (Ctrl-F).
Choose different bailout conditions in the bailout dialog (Ctrl-B).
Choose different colours in the colouring dialog (Ctrl-C).
Zoom deeper more quickly with Newton-Raphson zooming (Ctrl-D).
Design your own hybrid fractal formula (Ctrl-H).
Design your own colouring algorithm using GLSL (Ctrl-G).
Windows limits bitmap images to 2 giga-bytes (~715 M-pixel)
Windows limits longest bitmap dimension to 64 kilo-pixels
KF limits iteration count to 9 exa-iterations
KF limits periods to 2 giga-iterations
MPFR limits precision to 2 giga-bits (~646 million base-10 digits)
KF needs up to ~50 bytes per pixel (typically half that for common uses)
KF needs up to ~40 bytes per reference iteration (depending on number type)
KF cannot currently make use of more than 64 CPU threads
last.kfb
, recovery.kfb
, *_*.kfb
) (workaround: set image size before resuming sequence, for example by loading the last saved image file with both Open Settings and Open)kmag
, magnus
, vmg
, xmag
, xzoom
; I had best results with kmag
.In versions 2.15.5
and above, there are many new formulas which are not available in earlier versions
In versions 2.15.4
and above, there are three new formulas which are not available in earlier versions; imaginary axis reflection option is new
In versions 2.15.2
and above, OpenGL-based colouring is new.
In versions 2.15.1
and above, slope colouring is different; output is different with smooth method log (iteration count is offset by -log(log(BailoutRadius))/log(Power)
); Buffalo power 2 is different; rotation and skew are different; hybrid formulas are new; exponential map is new.
In versions 2.14.10
and above, new controls for custom bailout escape radius; bailout norm power can be customized; bailout real/imag factors can be fractional and/or negative; the smoothing method is decoupled from escape radius; there is a new phase channel (T
in EXR), with “phase strength” colour control; the texture information is saved and loaded from parameters; new fourth root transfer function (color method 11)
In versions 2.14.9
and above, the new formula z^2 exp(2 a / z) + c
is not available in earlier versions.
In versions 2.14.8
and above, the iteration count limit is raised above 2 giga-iterations. Parameters with such high iterations counts will load incorrectly in earlier versions.
In versions 2.14.8
and above, directional DE is saved in EXR files using DEX
and DEY
channels, instead of distance using DE
channel. Old EXR files’ DE
can not be re-loaded in newer versions, and new EXR files’ DEX
and DEY
can not be re-loaded in older versions.
In versions 2.14.7
and above, the new “LogLog” and “ATan” iteration count transfer functions (ColorMethod 9 and 10) are not available in earlier versions.
In versions 2.14.5
and above, the new “Low bailout” (SmoothMethod: 2) is not available in earlier versions.
In versions 2.14.5
and above, the two new General Abs Quadratic formulas are not available in earlier versions.
In versions 2.14.4
and above, the new “Mothbrot” formulas are not available in earlier versions.
In versions 2.14.3
and above, colouring of zoomed out views is fixed, and may be different from earlier versions.
In versions 2.14.1
and above, there are two new formulas which are not available in earlier versions.
In versions 2.13.1
through 2.13.9
, derivatives are calculated by default. In versions 2.14.1
and above, you need to enable the derivatives calculations (in the Iterations dialog, or via a settings file) if you want to use analytic distance estimation colouring. Derivatives are not available in earlier versions.
In versions 2.13.1
through 2.13.4
inclusive the interior is white. In 2.13.5
and above it is user-settable, defaulting to black, Parameter files made with earlier 2.13
versions should be modified to explicitly set a white interior colour. In earlier versions (including original 2.11.1
) the interior is black with no way of changing it.
In version kf-2.12.10
only the jitter is “Gaussian” with no way of changing the shape. In 2.12.11
and above, the shape can be changed, and the default is now “uniform”. Earlier versions (including original 2.11.1
) do not support jitter at all. To get the same results as 2.12.10
you must enable the Gaussian jitter checkbox and set the jitter scale box to 1.
In version kf-2.12.1
and above, DE colouring method #5 is once again backwards compatible with original 2.11.1
. Parameter files made with 2.11.1+gmp.DATE
versions should be modified to use Distance (Square Root) colouring method #8.
In version kf-2.11.1+gmp.20170822
only, DE colouring method #5 used log instead of sqrt for a more perceptually linear effect. In later versions, this log scaling is achieved with a new colouring method #7, while the DE colouring method #5 reverts to sqrt as before. The new colouring method ID allows old 2.11.1+gmp.DATE
parameter files to be loaded into current versions and display as intended. Any parameter files saved with the new Distance (Logarithm) colouring method will not display as intended in older versions. Parameter files using Distance colouring method saved with this particular version should be modified to use Distance (Logarithm) in the latest version.
multiple finite difference methods for distance colouring (only the default Traditional
is available in 2.11.1
).
analytic DE colouring with derivatives (not available in 2.12.x
or earlier).
2022-06-07
~/win/win32/$arch
2022-04-21
2021-12-05
2021-07-22
2021-05-26
2021-05-23
2021-05-22
2021-04-07
2021-03-31
2021-03-31
*.glsl
filesdelete[]
instead of delete
in some placesstatic inline
to prevent redefinition errors in llvm2020-12-08
2020-12-08
2020-11-24
2020-11-24
2020-11-18
2020-11-18
2020-11-12
2020-11-10
OpenEXR
to use mingw-std-threads
(the latter is no longer needed at all)_wsopen_s
which does not exist in ReactOS’ msvcrt.dll
stdc++
and pthread
libraries are statically linked2020-11-08
2020-10-28
2020-10-28
kf-tile.exe
tool supports the new rotation and skew transformations2020-10-08
fixes
library upgrades
2020-07-12
fixes
library upgrades
library non-upgrades
2020-06-01
fixes
2020-05-25
speed boosts
enhancements
kf.exe
-> kf.kfs
)--save-kfr
command line flag (suggested by Fluoroantimonic_Acid) (note that metadata is already saved in all formats apart from KFB)T
in EXR) based on argument angle of final iteratefixes
StretchBlt()
)library upgrades
2019-12-31
z^2 exp(2 a / z) + c
(suggested by gerrit); set seed to 0
(default) for singular orbit; set seed to a
for critical orbit (large |a|
bugs at zooms <= 1e3); no Newton zooming yet; thread: https://fractalforums.org/f/28/t/3234|z|
pixels for new references (suggested by quaz0r) (option disabled by default as it is not always faster)make clean && make OPENCL=1
)2019-09-23
DEX
and DEY
channels, and used for slopes colouring with Analytic
differences (requires derivatives, fixes noisy texture when jitter is enabled)2019-08-30
2019-08-29
stratify("tile",4)
) (bug reported by Chronicler1701, fix suggested by gerrit).2019-07-19
2019-07-18
2019-03-20
-z NFRAMES
flag2019-01-18
2018-10-29
2018-10-29
2018-10-23
2018-10-23
2018-09-27
2018-09-06
2018-08-28
2018-08-14
2018-08-02
2018-06-26
2018-06-21
2018-06-04
2018-05-15
2018-05-08
2018-05-01
2018-03-30
2018-03-30
2018-03-12
2018-02-22
2018-01-24
2018-01-24
2017-12-22
2017-12-07
2017-11-24
2017-11-02
2017-10-06
2017-09-25
2017-09-20
formula.cpp
included in source zip so GHC is not needed unless changing formula code;diffabs()
code: one test Burning Ship location is 7.5% faster;2017-09-19
(|x|+i|y|)exp(2a/z)+c
(suggested by Microfractal)I distribute EXEs bundled together with the corresponding source code.
The latest source code is available from my git repository:
git clone https://code.mathr.co.uk/kalles-fraktaler-2.git
cd kalles-fraktaler-2
git checkout master # for Karl's original
git checkout claude # for MINGW build system and bug fixes
git checkout kf-2.14 # old stable (bugfixes only)
git checkout kf-2.15 # for current development
git tag -l # list available release tags
You also need et
to generate the formula code for Newton-Raphson zooming:
git clone https://code.mathr.co.uk/et.git
This is outside the scope of this document at the moment, easiest is to download the release bundle and copy the formula/generated
folder from the included src zip. Get in touch for help if you want to regenerate these sources yourself.
Compiling KF for your own CPU is recommended for optimal performance. The performance boost can be significant, as the release EXEs are compiled for generic i686 and x86_64 but newer CPUs have additional instructions available. This is less important now that OpenCL is available, as this optimizes for your hardware at runtime.
Note: there is an upstream bug in the GCC compiler. On Debian the compiler is patched in recent versions. Patching it yourself is not hard, but it does take a long time and need about 30GB of disk space. Without a patched compiler, KF may crash in SIMD code due to 32-byte aligned moves with a 16-byte aligned stack. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=939559. Contact me if you need help to patch your compiler.
Build instructions for cross-compiling from GNU/Linux require about 10GB of disk space and good internet download speed (or patience). About 750MB of downloads including the chroot debootstrap step. If you have recent Debian you can skip the chroot step and install natively.
Setup Debian Bullseye chroot:
sudo mkdir ./vm
sudo debootstrap bullseye ./vm/
sudo mount proc ./vm/proc -t proc
sudo mount sysfs ./vm/sys -t sysfs
sudo cp /etc/hosts ./vm/etc/hosts
sudo chroot ./vm /bin/bash
cd
Install dependencies (inside the chroot if you made one):
dpkg --add-architecture i386
echo >> /etc/apt/apt.conf.d/30bullseye 'APT::Default-Release "bullseye";'
apt update
apt install \
build-essential \
cabal-install \
cmake \
ghc \
git \
libghc-parsec3-dev \
libtool \
lzip \
m4 \
mingw-w64 \
p7zip \
pkg-config \
wget \
wine32 \
wine64 \
wine-binfmt \
xsltproc \
zip
apt install \
pandoc \
libpandoc-elements-perl \
texlive-fonts-recommended \
texlive-latex-recommended # for manual
mount binfmt_misc /proc/sys/fs/binfmt_misc -t binfmt_misc
update-binfmts --import /usr/share/binfmts/wine
For Ubuntu replace “wine32 wine64 wine-binfmt” with “wine” (but see note about build failures with some versions).
Compiling is possible with GCC (well-tested) and LLVM (experimental, supports ARM).
For GCC, configure the system MinGW compilers to use win32 threading model (instead of posix). If you don’t do this then you’ll get mysterious weird behaviour (like zooming out resetting zoom to infinity or 0).
Choose the win32 alternative for all of these, you can ignore failures for gfortran and gnat if they are not installed:
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-win32
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
update-alternatives --set x86_64-w64-mingw32-gfortran /usr/bin/x86_64-w64-mingw32-gfortran-win32
update-alternatives --set x86_64-w64-mingw32-gnat /usr/bin/x86_64-w64-mingw32-gnat-win32
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-win32
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-win32
update-alternatives --set i686-w64-mingw32-gfortran /usr/bin/i686-w64-mingw32-gfortran-win32
update-alternatives --set i686-w64-mingw32-gnat /usr/bin/i686-w64-mingw32-gnat-win32
If you have existing builds built with posix threading model, you should delete them or move them out of the way, as mixing win32 with posix leads to a world of pain and misery (as does mixing LLVM with GCC).
When compiling with LLVM, you need to set the WINDRES2 make variable to the full path of GCC windres because LLVM windres is incomplete.
Prepare non-root build user:
adduser build
# enter and confirm password
su - build
mkdir -p ~/win/src
If compiling with LLVM, install the MinGW toolchain (needs ~15GB space):
mkdir -p ~/opt/src
cd ~/opt/src/
git clone https://github.com/mstorsjo/llvm-mingw.git
cd llvm-mingw/
./build-all.sh ~/opt
export PATH=${HOME}/opt/bin:$PATH
Download Kalles Fraktaler 2 + sources:
cd ~/win/src
git clone https://code.mathr.co.uk/kalles-fraktaler-2.git
cd kalles-fraktaler-2
git checkout kf-2.15
Download and build and install 3rd party library sources (inspect the script if you want to be sure it isn’t doing anything dodgy, or to copy/paste parts if necessary), the script can build both 64bit and 32bit variants if necessary:
cd ~/win/src/kalles-fraktaler-2
bash ./prepare.sh dl
bash ./prepare.sh x86_64
bash ./prepare.sh i686
bash ./prepare.sh aarch64
bash ./prepare.sh armv7
Download the latest version of Kalles Fraktaler 2 + and copy the et
-generated formulas from it:
cd ~/win/src/kalles-fraktaler-2
wget -c "https://mathr.co.uk/kf/kf-$(wget -q -O- https://mathr.co.uk/kf/VERSION.txt).7z"
7zr x kf-*.7z
cd kf-*/
unzip kf-*src.zip
cd kf-*-src/
cp -avit ../../formula/generated formula/generated/*.c
To build Kalles Fraktaler 2 + optimized for your own Intel/AMD 64bit CPU:
cd ~/win/src/kalles-fraktaler-2
make clean
make SYSTEM=x86_64+native -j $(nproc)
./kf.exe
To build Kalles Fraktaler 2 + for generic 32bit Intel CPU:
cd ~/win/src/kalles-fraktaler-2
make clean
make SYSTEM=i686 -j $(nproc)
./kf.exe
To build Kalles Fraktaler 2 + for generic 64bit CPU:
cd ~/win/src/kalles-fraktaler-2
make clean
make SYSTEM=x86_64 -j $(nproc)
./kf.exe
To build Kalles Fraktaler 2 + for generic 32bit ARM CPU (might not work due to a bug in GMP):
cd ~/win/src/kalles-fraktaler-2
make clean
make WINDRES2=/usr/bin/x86_64-w64-mingw32-windres SYSTEM=armv7 -j $(nproc)
./kf.exe
To build Kalles Fraktaler 2 + for generic 64bit ARM CPU:
cd ~/win/src/kalles-fraktaler-2
make clean
make WINDRES2=/usr/bin/x86_64-w64-mingw32-windres SYSTEM=aarch64 -j $(nproc)
./kf.exe
To build Kalles Fraktaler 2 + release (all architectures + documentation + source zip + everything 7z + signing):
cd ~/win/src/kalles-fraktaler-2
./release.sh $(git describe)
Note: build fails on Ubuntu 16.04.3 LTS (xenial):
$ make
x86_64-w64-mingw32-g++ -mfpmath=sse -xc++ -Wno-write-strings -pipe -MMD -g -O3 -ffast-math -I/home/claude/win64/include -DKF_THREADED_REFERENCE_BARRIER -o fraktal_sft/CDecNumber.o -c fraktal_sft/CDecNumber.cpp
In file included from fraktal_sft/CDecNumber.cpp:1:0:
fraktal_sft/CDecNumber.h:5:76: error: 'decNumber' was not declared in this scope
typedef boost::multiprecision::number<boost::multiprecision::gmp_float<0>> decNumber;
^
fraktal_sft/CDecNumber.h:5:76: error: template argument 1 is invalid
fraktal_sft/CDecNumber.h:5:62: error: template argument 1 is invalid
typedef boost::multiprecision::number<boost::multiprecision::gmp_float<0>> decNumber;
^
fraktal_sft/CDecNumber.h:5:62: error: template argument 2 is invalid
fraktal_sft/CDecNumber.h:5:32: warning: 'typedef' was ignored in this declaration
typedef boost::multiprecision::number<boost::multiprecision::gmp_float<0>> decNumber;
^
...
$ x86_64-w64-mingw32-g++ --version
x86_64-w64-mingw32-g++ (GCC) 5.3.1 20160211
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The working Debian Buster with compiler from Bullseye (needed for the SIMD alignment fix mentioned above) has:
$ x86_64-w64-mingw32-g++ --version
x86_64-w64-mingw32-g++ (GCC) 10-posix 20200525
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
64-bit (may be adaptable to 32-bit)
Note these instructions are out of date.
Build instructions for compiling on Windows (thanks to knighty and Patrick Owen!):
Remove any old version of MSYS2.
These instructions assume you are using a fresh version of MSYS2. Depending on how confident you are, you may be fine skipping this step.
Download the latest version of MSYS2 from https://www.msys2.org/ (msys2-x86_64-20190524.exe).
Run it to install MSYS2. When the installation finishes, the MSYS2 shell should open.
Note: Many files you interact with in future steps are in the installation directory of MSYS2. It is recommended that you install MSYS2 on a drive with plenty of space, as there will be about 10 gigabytes of files in there at the end of the installation process.
In the MSYS2 shell, invoke pacman:
pacman -Syuu
You will need to keep running this command until is says “there is nothing to do”. While it’s running, it may ask you to close the terminal. Follow these instructions. When you open the terminal again (see step 5), keep running the command.
Close the MSYS2 shell:
exit
Reopen the MSYS2 shell (from startup menu under the name MSYS2 MSYS).
Install mingw/gcc 64 bit (this will take a fair bit of time):
pacman -S mingw-w64-x86_64-toolchain
When it asks you to enter a selection, just hit enter (all).
Install required tools (this will likely take less time):
pacman -S --needed git patch make diffutils mingw-w64-x86_64-cmake lzip p7zip unzip
Close the MSYS2 shell then open “MSYS2 MinGW 64-bit” shell (instead of MSYS2 MSYS, in order to have all the environment variables properly set)
Install tar. The version of tar that comes installed with MSYS2 has trouble extracting xz files.
pacman -S tar
Restart MSYS2 again (Close and reopen “MSYS2 MinGW 64-bit”).
Install ghc (Haskell)
# See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation/windows
curl -L https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-unknown-mingw32.tar.xz | tar -xJ -C /mingw64 --strip-components=1
Change directory to the kalles fraktaler sources (where Makefile
resides).
If this directory is outside of the msys64 directory, include the full Windows path, replacing backslashes with forward slashes and drive letters like C:\
to paths like /c/
.
Download and build and install 3rd party library sources (inspect the script if you want to be sure it isn’t doing anything dodgy, or to copy/paste parts if necessary), the script will need to be modified to build the 32bit version:
bash ./prepare-msys.sh dl
bash ./prepare-msys.sh 64
The first script is relatively fast depending on your internet speed, as it downloads dependencies. Depending on the speed of your machines, the second script takes about an hour to run.
The script has several places where it pauses for a while with no output. You will know that it has finished successfully when it shows a bunch of lines starting with “– Installing:” and then exits, giving you back control of the command line.
Download the latest version of Kalles Fraktaler 2 + and copy the et
-generated formulas from it:
cd "/path/to/Kalles Fraktaler 2 +"
wget -c "https://mathr.co.uk/kf/kf-$(wget -q -O- https://mathr.co.uk/kf/VERSION.txt).7z"
7zr x kf-*.7z
cd kf-*/
unzip kf-*src.zip
cd kf-*-src/
cp -avit ../../formula/generated formula/generated/*.c
Feel free to delete kf-*/
and kf-*.7z
inside your git repository afterwards.
To build Kalles Fraktaler 2 + optimized for your own CPU:
cd "/path/to/Kalles Fraktaler 2 +"
make clean
WINDRES=windres make SYSTEM=x86_64+native -j $(nproc)
Note that mingw32-make
does not properly detect that files are already up-to-date, making building slow each time. Use make
instead.
To build Kalles Fraktaler 2 + release:
Follow the instructions for Linux, possibly making adaptions to allow them to work with MSYS2
Execute it this way from (MSYS2 MinGW 64-bit) command line:
./kf.exe
because it is linked dynamically to some libraries. In order to execute it from the explorer one needs to copy libwinpthread-1.dll
from msys64/mingw64/bin
next to the generated executable.
The benchmark suite is maintained in the code repository:
git clone https://code.mathr.co.uk/kalles-fraktaler-2.git
cd kalles-fraktaler-2
git checkout kf-2.15
cd benchmarks
To benchmark regular CPU:
./benchmark.sh /path/to/kf.exe -1
For OpenCL platform N, starting from 0:
./benchmark.sh /path/to/kf.exe $N
It will create a directory $HOSTNAME/$VERSION/$PLATFORM
with ~1.5GB of images, and benchmark logs builtin.dat
hybrid.dat
mandelbrot.dat
.
To generate graphs builtin.png
hybrid.png
mandelbrot.png
:
cd $HOSTNAME/$VERSION
gnuplot < ../../plot.gnuplot
Note: the benchmark suite is currently designed for the latest KF. Earlier versions of KF may miss some formulas or have bugs that prevent successful completion of the benchmark suite, or give misleading output (e.g. unknown formula silently resets to power 2 Mandelbrot). Work in progress.
Rough guideline of how long it takes on different machines:
eiskaffee
latte
Kalles Fraktaler 2 +
Copyright (C) 2013-2017 Karl Runmo
Copyright (C) 2017-2021 Claude Heiland-Allen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
NOTE: If you redistribute the binaries or provide access to the binaries as a service, you must also be prepared to distribute the source corresponding to those binaries. To make this easier for you, the more recent zips include the source too (though you’ll also need to get the third party library sources).
Library sources can be obtained via:
Thanks to:
Claude also thanks Karl for releasing the source code and assigning a Free Software license.
Opens the current location from a parameter file (*.kfr
) You can also load metadata from images saved by KF. You can also drag-and-drop files from the file manager on to the main window to open them as parameters.
Saves the current location in the current parameter file (*.kfr
)
Saved image dimensions can be smaller than the calculated image size set in the settings. The image will be downscaled according to the shrink quality setting. If the saved image dimensions are larger, the image will be recalculated at the new size.
Note that for EXR, the saved image dimensions are only for the “preview image”, the full calculated image size is used for the main image and the iteration data.
Saves the current location in a new parameter file (*.kfr
)
Saves the current location in a PNG image file (*.png
). The location and settings are saved in the file metadata.
Saves the current location in a JPEG image file (*.jpg
). The location and settings are saved in the file metadata.
Saves the current location in a TIFF image file (*.tif
). The location and settings are saved in the file metadata.
Saves the current location in a EXR image file (*.exr
). The iteration data is also saved in the file by default. The location and settings are saved in the file metadata. This is the recommended format for saving iteration data.
Choose which channels to save in EXR image files. This is stored in the settings, so you can use it with command line rendering.
Saves the iteration data in a map file (*.kfb
). These files can be used by some third party programs. This file format is no longer recommended: use EXR instead. The location and settings are not saved.
Load the iteration data from map file (*.kfb
, *.exr
).
Note: you must set the aspect ratio of the window to match the KFB data before opening the map file. If you have also saved images, you can do that by loading the image as a settings file.
Note: if you want to continue zooming from the location, you must load the KFR file before opening the map file. You can also load a saved image as a location file. Location information is not stored in KFB files.
Note: there is a historical accident whereby the iteration divider is saved in the KFB as an integer, losing any fractional part and sometimes resetting to 1 on load. A workaround is to load the palette from a KFP file (which is just a .kfr renamed to .kfp) after opening the map file.
Zoom out automatically with the selected Zoom size and store JPEG/PNG/TIFF images and map file (*.kfb
, *.exr
) for each zoom out. The zoom out stops when the depth is lower than 1. The resulting files can be used by third-party software to create a zoom animation.
Make sure you store the end location as a kfr file in the same directory as you store the zoom sequence frames. This function allows you to examine the frames one by one and add references to remove eventual visible glitch blobs, or choose another pixel as the main reference.
This feature is probably broken (see Known Bugs above) and may be removed soon.
Make sure you store the end location as a kfr file in the same directory as you store the zoom sequence frames. This function allows you to resume and continue the zoom out sequnce, if it got interrupted. You must set the zoom size factor to the correct value for the sequence before invoking this command.
Opens rendering settings from a settings file (*.kfs
) You can also load metadata from images saved by KF.
Saves the current rendering settings to a settings file (*.kfs
)
Retrieves information from KF’s homepage on the internet, to let you know if a newer version is available.
Exit this program
Set groups of settings to suggested preset values.
Accuracy may be compromised but it’s fast for browsing. Sets ignore isolated glitch neighbourhood to 4, enables guessing, disables low tolerance for glitches and approximation, and disables derivatives computation unless analytic DE colouring is currently in use.
Highest quality settings for important images, but slow. Sets ignore isolated glitch neighbourhood to 0 (disabled), disables guessing, enables low tolerance for glitches and approximation, and enables jitter with a default seed of 1.
Adjust fractal type and power etc. See below.
Design your own hybrid fractal formula. See below.
Adjust iteration limit and escape radius, etc. See below.
Displays the Location dialog where the coordinates for this location is displayed and can be edited.
Adjust colouring. See below.
Display information about the fractal. See below.
Render the current location.
Cancel the current rendering.
Set the location to the start point.
Go back to previous location(s).
Go forward in the undo history.
Save the current location to the system clipboard.
Set the current location from the system clipboard.
Set the level of zoom, CTRL-left mouse click to zoom in, right to zoom out. Scroll wheel zooms by a factor of 2.
Turns animation on or off when zooming.
Open the output size dialog.
Top left is the aspect ratio control. Common aspect ratios are options, with a custom entry for arbitrary ratios. Next from left is the target vertical size. Third is supersampling amount, this is multiplied by the target size to give a bigger bitmap size. Finally on the right is a window scaling control, relative to the target size.
Bottom left are computed dimensions. Bottom right are OK and Cancel buttons. The OK button is disabled if the bitmap is too large (see the Limits section at the start of this document).
If the computed bitmaps size is larger than the window size, an anti-alias effect is achieved (some systems may need to increase the Shrink Quality for this to work properly).
When disabled, the window aspect ratio is locked to 16:9. When enabled, any aspect ratio is possible.
Activate transformation dialog. Left mouse drag to rotate and zoom the image. Right mouse drag to skew the image. Automatic skew works on the center pixel using derivatives. The derivative with respect to C is always used, the derivative with respect to Z is optional. Automatic skew for minibrots is available via the Newton-Raphson zooming dialog.
Clear any transformation.
Apply exponential map coordinate transform. For best (more conformal) results use a wide aspect ratio (9:1 works well, window size 1152x128 or 1536x170).
You can store exponential map zoom out sequences (set zoom size to 2) and combine them into a movie with the zoomasm zoom video assembler. This is much more efficient than storing flat keyframes.
Set quality of image scaling. “Fast” and “Default” are better suited for exploring, but “Good” looks much better at the cost of slower colouring (it does properly filtered anti-aliasing). “sRGB” is even better, doing gamma-correct scaling.
You shouldn’t need to adjust this unless you set the image size larger than the window size, or intend saving image files at smaller resolutions than the image size.
Activates the Newton-Raphson zooming dialog, which allows you to zoom directly centered on a minibrot (or other miniset, for other formulas).
There are 4 Actions possible, each applies the previous ones. Period calculates the period of the minibrot (useful for NanoMB1/NanoMB2). The Ball Method is used by default, otherwise the Box Method is used. Center calculates the period and also centers the view on the minibrot. Save Progress saves snapshots to KFR files, but resuming is not possible yet. Size calculates the size of the minibrot and zooms the view according to the remaining controls. Skew automatically skews the view to make features near the minibrot look round.
Progress is displayed at the bottom, where there is a button to stop the processes (for example if the ETA for Center gets very high, which indicates that it might not be converging).
Minibrot (Relative) is familiar from KF version 2.15.2 and earlier. The Relative Folding controls allow you to zoom to a factor between the start zoom level (which can be captured explicitly or left blank to use the current value) and the minibrot zoom level. For power 2 formulas, 0.5 makes the current pattern doubled, 0.75 quadrupled, and so on. For power 3, 0.666 makes the current pattern tripled, and in general power P needs factors like 1-(1/P)^M for folding.
Minibrot (Absolute) zooms relative to the size of the minibrot only. The Absolute Power controls allow you to control this, 0.75 is typically near an embedded Julia set, 1 is at the minibrot. Larger than 1 is not useful here.
Atom Domain (Absolute) zooms relative to the size of the atom domain of the minibrot, which is typically around the size of an embedded Julia set. Absolute Power 1 is at the atom domain, 1.125 is sometimes near a Julia morphing.
The Size Factor is applied after zooming in all modes, for fine tuning of the zoomed view.
Click on the fractal to specify the start point of the search of the minibrot. The current zoom size is used to set the boundaries of search around the selected point. It is recommended to set the zoom size to 128 and use the crosshair window for pixel-accurate selection.
Notice that it can take a long time to calculate the position of deep minibrots. However, that should be still much faster than zooming to the minibrot manually by selecting the center of the pattern in the view, or with the automatic search of minibrot that is also using the pattern center.
“Auto skew escape” has been moved to the Transformation dialog in KF version 2.15.3.
Starts an automatic zoom-in in the image’s pattern center, until a Minibrot is found or if it fails to find the center.
It’s probably better to use Newton-Raphson zooming if possible.
Makes the Find Minibrot function fail every 20 zoom-in, in order to gain depth automatically without ending up in a Minibrot
Newton-Raphson zooming may be a more useful option.
Center the cursor to image’s pattern center.
Centers the mouse pointer over the glitch blob found, if any.
Centers the mouse pointer over the pixel with the highest iteration.
Activate or deactivate display of Inflection.
Display a small window that magnifies the area around the mouse cursor. Perfect for precisely picking particular pixels for zooming etc.
Turns the Auto solve glitches function on or off.
Chooose alternative methods for finding center of glitches. May be faster/slower depending on location.
Instead of re-render all pixels with the same iteration count value (color) only the connected pixels are re-rendered. On some locations other areas in the same view have the exact same iteration count values. These pixels may be correctly rendered and may be incorrect if re-rendered with another reference.
When enabled, ignores single-pixel glitches by interpolating their value from neighbouring pixels. If the image size is very large, there may be a very large number of these tiny glitches, whose incorrect rendering may be invisible to the eye, and whose correct rendering may take forever.
Glitches are more likely to be detected the higher this value is. Setting to 1 should lead to good images, but is very slow. Setting to 0 can lead to bad images, but is faster. Fractional values can be used since KF version 2.15.3.
Series approximation is stricter the higher this value is. Setting to 1 should lead to good images, but is slow. Setting to 0 can lead to bad images, but is faster. Fractional values can be used since KF version 2.15.3.
Automatic (default, recommended) is based on number of pixels.
Sets limit of secondary reference points for automatic glitch correction. There is a hard limit of 10000, which is also the default.
Uses derivatives for a more accurate glitch test which can speed up rendering. Only for power 2 Mandelbrot, not yet implemented in OpenCL. Can be disabled for the rare cases where it fails.
Use strict zero test for reference dynamic range. May be necessary for some locations (e.g. Burning Ship near the needle). Enabling can be slower, but disabling can give inaccurate images. Default disabled for Mandelbrot set, enabled for other formulas.
Use rescaling for series approximation calculations. Enabling can be faster, but may lead to inaccurate images. Only for power 2 Mandelbrot set.
Configure which number types KF is allowed to choose from. Number types near the top are typically faster than number types near the bottom.
Single precision may be faster, especially on GPUs with OpenCL. Single precision is disabled by default because of undetected glitches at some locations: if you enable it, inspect your images carefully.
Rescaled iterations are only available for Mandelbrot set power 2, Mandelbrot power 3, Burning Ship power 2, and hybrid formulas.
Let you click the image and select the main reference for the whole image. This can be useful when glitches appears on top of minibrots when the reference is outside this minibrot. The glitch pattern disappears from the minibrot if the main reference is selected inside the minibrot.
Add a reference and re-calculates the pixels with the same iteration count as the reference. This is useful if the Auto solve glitches function fails to find and solve glitches in the image.
Do not re-calculate the reference for further zooming. This can be useful when during automatic zoom-out and to test different reference points. A new reference is calculated automatically after each Newton zooming whatever the setting of Reuse Reference.
Since KF version 2.15.3 it can be used with the “auto solve glitches” function active: the primary reference is stored separately to the secondary references. This uses more memory.
Don’t paste the previous image in the middle when zooming out. Disabling this (ie, do reuse center) can be faster but can also lead to bad images.
Displays the image black-and-white with the pixels with the highest iteration as white and the pixels with the lowest iteration as black.
Displays the image black-and-white representing the smoothing coefficient.
When activated, glitches are displayed with a solid color.
Mirrors the image around the x-axis. Can be used on the deeper half of a zoom sequence to a minibrot - but not too close to the minibrot and too close to the half…
Turns the series approximation function on or off. May fix (or cause) different bugs.
For power 2 Mandelbrot only.
Use knighty’s experimental NanoMB1 algorithm for bivariate super- series-approximation. Calculations are done with floatexp always. A regular series approximation plus perturbation pass follows for glitch correction.
It is required to set the period in the Location dialog before enabling NanoMB1. Using Newton zoom sets the period automatically.
It is recommended to enable Reuse Reference after recalculating with NanoMB1. A new reference is calculated automatically after each Newton zooming, whatever the setting of Reuse Reference.
Whether NanoMB1 is faster or not depends heavily on the location: views close to minis should be significantly faster than the regular ‘fast’ preset.
For power 2 Mandelbrot only.
Use knighty’s experimental NanoMB2 algorithm for bivariate super- series-approximation. Calculations are done with floatexp always, glitch detection and correction is disabled (and may be unnecessary?).
It is recommended to set the period limit in the Location dialog before enabling NanoMB2, otherwise it uses the maximum iteration count which may take significantly longer. Using Newton zoom sets the period limit automatically.
It is recommended to enable Reuse Reference after recalculating with NanoMB2. A new reference is calculated automatically after each Newton zooming, whatever the setting of Reuse Reference.
Whether NanoMB2 is faster or not depends heavily on the location: views close to minis should be significantly faster than the regular ‘fast’ preset.
The RadiusScale field in the .kfs settings file controls the scaling of the escape radius calculated for each minibrot in the chain. Increasing it may be faster but lead to visible distortion, decreasing it may help the distortion but slow things down. No GUI for this control yet.
For power 2 Mandelbrot rendered with NanoMB1 or NanoMB2 only.
Use an interior checking algorithm, which may or may not speed up per-pixel calculations in locations with large interior regions visible.
Experimental. Correctness is to be evaluated. Subject to change.
Turns automatic iteration control on or off. This is on per default.
Enable interpolation of neighbouring pixel data when the iteration count is the same. This speeds up rendering of interior regions and glitches. However, it is recommended to disable guessing when using OpenCL in exterior regions for speed reasons.
When this is checked, Open resets parameters to default before loading, for compatibility with older KFR files. When this is unchecked, Open only affects the parameters that are specified in the file, allowing more minimal KFR files to be created outside KF. The default is enabled, for compatibility.
When this is checked, Save (Ctrl-S) overwrites the current file without asking. When this is unchecked, Save will add a timestamp to file names to prevent accidental data loss.
Number of pixels to calculate simultaneously per core. Setting it too small or too large will lead to slower performance. The sweet spot will depend on your particular CPU model, cache sizes, how KF is compiled (e.g. 64 vs native), etc.
Setting it to 1 disables the explicitly vectorized code path; some SIMD instructions may still be used depending on the compiler.
Number of iterations to calculate between escape/glitch checkes. Setting it too small or too large will lead to slower performance, because checks will be done too often (small chunk size) or too many extra iterations will be done per pixel (large chunk size). The sweet spot will depend on your CPU and the location (if the number of iterations is high, probably a higher chunk size would be beneficial).
How it works: the last chunk (when any of the SIMD vector escape to infinity or glitch detected) is repeated for each pixel in the vector individually, after rolling back to before the last chunk. This means some iterations are repeated, but the speedup from doing escape checks less frequently may overcome this issue.
Pre-allocate 16bit image buffer for EXR export. Otherwise it is only allocated when needed. May speed up EXR export if this is checked. If not using EXR, leave this unchecked.
Use multiple threads in EXR input/output. Speed and CPU efficiency (as well as memory usage) may differ when toggling this flag; evaluate the optimal choice for your image size and system.
Use multiple threads when calculating reference orbits (available for long double and floatexp only). Speed and CPU efficiency may differ when toggling this flag; evaluate the optimal choice for your location and system.
The default of 1 is sensible if KF is the only thing you’re running. Increase the count if you want KF to peg your system, decrease it if you want to do other things at the same time.
The last menu item reduces the calculated number of threads by 1, which can help improve system responsiveness in some configurations.
There will always be at least one thread.
These options only affect perturbation rendering and image colouring, not Newton-Raphson zooming or reference calculations.
Note: changing this during rendering could lead to crashes, so the menu is disabled during rendering to prevent that.
Select which device to use for OpenCL, or “(none)” to use the regular old implementation on CPU. Currently OpenCL is used for perturbation iterations only. Support for double precision (fp64) is detected automatically, though many devices (especially GPUs) will be much faster with single precision (fp32, float).
On some operating systems you might need to adjust GPU timeout behaviour if the calculations take too long and are interrupted.
OpenCL may or may not be faster, depending on device, location, etc. For zooms between ~1e300 and ~1e4900, the regular old CPU implementation is likely to be significantly faster for most built in formulas because OpenCL does not support x87 long double (which has more range compared to double), and thus OpenCL has to use the much slower floatexp number type.
For hybrid formulas, OpenCL is much faster becasue it can handle all the branching once at compile time, instead of checking what to do on every iteration. Hybrid formulas support rescaled iterations, so zooms past the range of float and/or double can still be fast.
With the “threaded” option enabled, OpenCL runs in a background thread so the user interface is more responsive. With it disabled, it runs on the main thread blocking interactions (but this might work around some bugs).
At the very top right:
Open about dialog, with version information and credits.
This also functions as a lock mechanism, preventing accidental zooming while a long render is taking place.
Convert hybrid formula to built-in formula (when possible).
Convert built-in formula to hybrid formula (when possible).
Don’t display built-in formulas that have hybrid equivalents in the fractal type drop-down below.
Mandelbrot, Burning Ship, etc
Some forumulas have power setting.
Where to start iterating from (default 0 + 0 i
, for best semantics it should be a critical point of the iteration formula, where its d/dz
derivative is zero).
Set the complex number a
(denoted f = d + e i
in the formula list below) for TheRedshiftRider formulas.
Compute derivatives (required for Analytic distance estimation, and Analytic is recommended for slopes when jitter is enabled). Also can enable a different glitch detection criterion (for power 2 Mandelbrot only).
Compute Triangle Inequality Average colouring. Requires OpenCL to be enabled. Replaces the final angle in the phase (T) output channel. Also calculated for non-escaping points, use OpenGL colouring to visualize it. Enabling this disables series approximation because otherwise the results may be unpredictable.
Non-zero enables jitter with a pseudo-random-number generator seed value.
In units of a pixel (1 pixel is sensible in most cases).
Probably best left disabled (uniform jitter looks better).
Hybrid formulas are significantly slower than the builtin formulas for the same formula, so use the built in ones if you can. However using OpenCL can vastly reduce the slowdown, and support for rescaled number types means they can sometimes be faster at deeper zooms.
There are up to 4 formula groups you can enable. Enable them with a positive number of Repeats at the top right.
Groups are executed in a loop, apart from a prefix which is executed only once. The Start Loop radio buttons on the right let you choose where the loop starts.
Each group has up to 2 lines. Don’t forget to enable with the checkbox at the right. Enabled groups must have their first line enabled.
Lines are executed in sequence, with the + C
part of the formula happening at the end of all the lines.
Each line has two operators which can be combined with +
, -
, or *
.
Each operator has controls (from left to right):
Setting all of them gives (-|x| + -|y| i)^p * (a_r + a_i i)
.
The OK button first validates the dialog, if it doesn’t pass validation it has the same effect as the Cancel button. This is not ideal…
Increase this if the interior is “blobby”.
(new in 2.14.10, was previously linked to escape radius)
Modify these for special effects (default 1, 1).
(new in 2.14.10)
The value compared to the escape radius when testing for escape is pow(abs(b_x * pow(abs(z_x), p) + b_y * pow(abs(z_y), p)), 1/p)
.
The Colors dialog is accessed via the Fraktal menu, or via the keyboard shortcut Ctrl+C
in the main window.
Set the number of key colors between 1 and 1024.
Divide each iteration number with this value, for dense images this value can be greater than 1. For DE, values less than 1 can be useful.
Offset the colors in the palette
Fill the palette with random colors made from the Seed value. The Seed button select a seed value randomly.
Move RGB values closer to max or min
Move RGB values closer to the middle
Enable slope encoding for 3D effect.
First value is the magnification of the slopes. The start value of 100 is suitable for the unzoomed view. Deep views requires a couple of magnitudes higher value.
The second value is the percentage with which the slope encoding is applied on the coloring. 100 is max, however flat areas will still have the palette color visible.
Save the current palette in KFP (*.kfp
) file
Load palette from a KFP (*.kfp
) file
Palettes can also be loaded via drag and drop.
Double the number of key colors without changing the palette. This allows finer control of individual colors without changing the palette for other colors
Increase the number of key color to maximum 1024 without changing the palette
Double the key colors by repeating them
Allows a selected color to be merged to every specied key color
Capture the mouse, hover the mouse over the fractal image and the corresponding color in the list will be highlighted. Click and the color selection dialog will be displayed for the active color
Makes the transitions of colors smooth
Inverse the smooth color transition which makes edges more visible
Specifies handling of the iteration count values prior to coloring
Linear.
Stretches the palette linearly between minimum and maximum iterations achieved in the image.
Distance estimation with linear transfer function.
Combines DE with linear.
Choose which algorithm to use when calculating distance estimates via numerical differencing of smooth iteration count.
aka Roberts Cross
Use derivatives to calculate distance estimation; derivative calculation must be enabled in the Formula dialog.
The palette can be filled from sine waves applied on Red, Green, Blue and Black-and-white. Each input box specifies the number of periods applied on the number of key colors in the palette. If the input box is left empty, no wave of this color is applied. At right of each input box the “P”-button makes the number you entered prime, since different prime numbers probably give more variation. The last input box specifies the waves offset.
The button “Generate” applies the waves on the palette, the “Seed” button fills the fields with random values
Waves can be applied on Hue, Saturation and Brightness rather than RGB values. The Period value specifies the length of the period (not the number of periods as for the Palette waves). Periods with prime numbers should be able to produce an infinite number unique colors
A negative value on Hue, Saturation or Brightness makes a flat percentage value to be applied on all iterations.
A background image can be loaded, which is distorted by a slope effect. Only BMP, JPEG, PNG files can be loaded so far. By default the texture is resized to match the image size, this can be disabled so you can access the actual image pixels in OpenGL GLSL shaders.
Privacy note: the full file system path to the texture file is saved in the parameter files (including saved image metadata).
Use an OpenGL Shader Language (GLSL) snippet for colouring the image. See below. The shader source code is saved inside the palette and parameter files (including saved image metadata).
The OpenGL dialog is accessed via the OpenGL button in the bottom left of the Colors dialog, or via the keyboard shortcut Ctrl+G
in the main window.
Enter OpenGL shader language source code for colouring snippet. See below for API.
Reset colouring GLSL to default (emulating the regular CPU-based colouring algorithm).
Load GLSL fragment from a text file (*.glsl
).
GLSL fragments can also be imported via drag and drop.
Export GLSL fragment to a text file (*.glsl
).
Convert input and output from/to the sRGB colour space (which is non-linear, to get better perceptual accuracy). In this mode the shader operates in linear light.
Use OpenGL shader colouring instead of CPU colouring.
Apply changes, recompiling the shader.
Cancel any unapplied changes and close the window.
The version of OpenGL in use is shown here, typically the highest supported version on your hardware and operating system + drivers. Shaders should use __VERSION__
to adapt to the environment.
OpenGL Shader Language basic syntax is similar to C or C++ (braces and semicolons). KF provides a number of preset uniform variables and a small library of functions which you can use to access the raw iteration data in the neighbourhood of a pixel (random access is not possible due to the tiled rendering used for larger images). KF’s default colouring algorithm (and modularized subparts) are also available for use in custom code.
The GLSL fragment should implement a function with this name and type signature:
vec3 colour(void);
The default colouring can be emulated by using KF_Colour
:
vec3 colour() { return KF_Colour(); }
There should be no #version
line in the GLSL fragment, instead __VERSION__
should be used to adapt to the environment.
float49
numbersTo avoid precision loss when representing iteration counts, a float49
type is available which has 49 bits, compared to only 24 bits for regular float. GLSL does not have operator overloading (only function overloading) so you can manipulate them with these functions:
add neg sub mul inv div sqr ldexp
is_zero is_one is_positive is_negative
gt lt ge le eq ne abs max
fmod divrem drem nint aint floor ceil
exp log log10 pow sqrt nroot
sin cos tan sincos asin acos atan
sinh cosh tanh sincosh asinh acosh atanh
Some constants are also available:
f49_nan f49_inf f49_0 f49_1 f49_e f49_log2 f49_log10
f49_2pi f49_pi f49_3pi4 f49_pi2 f49_pi4 f49_pi16
f49_eps f49_min_normalized f49_max
You can convert a float49
to float
by f.x[0]
, and to double
by double(f.x[0]) + double(f.x[1])
.
The following functions get data for the current pixel, or for a nearby one if an ivec2
offset is passed. The maximum absolute useable pixel offset is in uniform ivec2 KFP_TilePadding
. See the documentation of the exported EXR channels for semantics.
getGlitch
Returns true
when the current (or offset) pixel is glitched.
getInterior
Returns true
when the current (or offset) pixel is interior.
getN1
Returns the uint
most significant 32bits of the iteration count of the current (or offset) pixel.
getN0
Returns the uint
least significant 32bits of the iteration count of the current (or offset) pixel.
getNF
Returns the float
smooth part of the iteration count of the current (or offset) pixel.
getN
Returns a float49
of the current (or offset) pixel’s smooth iteration count, calculated by (N1 << 32) + N0 + (1.0 - NF)
in 49 bits of precision.
getT
Returns a float
of the current (or offset) pixel’s phase of final iterate (normalized to [0..1)).
getDEX
Returns a float
of the current (or offset) pixel’s horizontal analytic distance estimate (normalized to 1.0 being a neighbouring pixel’s boundary).
Requires derivatives to be enabled in the Formula dialog.
getDEY
Returns a float
of the current (or offset) pixel’s vertical analytic distance estimate (normalized to 1.0 being a neighbouring pixel’s boundary).
Requires derivatives to be enabled in the Formula dialog.
getDE
Returns a vec2
combining the current (or offset) pixel’s analytic DEX
and DEY
.
Requires derivatives to be enabled in the Formula dialog.
getZoomLog2()
The base-2 logarithm of the current (or offset) pixel’s zoom level. Unzoomed is 0.0, deeper zooms are larger.
See palettes/claude/text-overlay.glsl
for an example using this to display text.
inImage
Returns true
when the provided offset relative to the current pixel (not absolute coordinates!) lies inside the image bounds. The bounds can be found in uniform ivec2 ImageSize
.
getCoord
Get output coordinates, relative to the uniform variable ImageSize
. Origin is bottom left per OpenGL conventions.
getJitter
Return the vec2
jitter delta of the current (or offset) pixel. Uses the uniform variables uint KFP_JitterSeed
, int KFP_JitterShape
and float KFP_JitterScale
.
Not available in zoomasm. Numerical (non-analytic) distance estimation also cannot use jitter compensation there. Analytic DE with derivatives is recommended.
getN3x3
Fills three mat3
with the relative iteration counts and pixel positions (offset plus jitter) of a 3x3 stencil centered on the current pixel. Used for numerical distance estimation. Returns the center pixel’s float49 N
.
A 3x3 stencil of relative iteration counts can be used for numerical distance estimation.
KF_DE(int method)
Returns numerical distance via a differencing method, one of the following #define
d constants:
Differences_Traditional
Differences_Forward3x3
Differences_Central3x3
Differences_Diagonal2x2
Differences_LeastSquares2x2
Differences_LeastSquares3x3
Differences_Laplacian3x3
Differences_Analytic
Note: Differences_LeastSquares2x2
and Differences_LeastSquares3x3
are not implemented in GLSL, and Differences_Analytic
uses the DEX
and DEY
channels which require derivatives to be enabled in the Formula dialog.
KF_Traditional()
Return DE via KF’s original implementation.
KF_Forward3x3()
Return DE via 3x3 forward differences.
KF_Central3x3()
Return DE via 3x3 central differences.
KF_Diagonal2x2()
Return DE via 2x2 diagonals, aka Robert’s Cross.
KF_Laplacian3x3()
Return DE via 3x3 Laplacian.
KF_Analytic()
Return DE via derivatives.
The following uniform
variables are set from the Colors dialog:
ivec2 ImageSize
The size of the final image.
sampler1D KFP_Palette
The key colours of the palette. The function KF_Palette
interpolates the palette emulating KF’s regular implementation, input is in [0..1).
vec3 KFP_InteriorColor
The interior colour.
bool KFP_ShowGlitches
Whether the menu option Advanced -> Show Glitches is selected.
uvec2 KFP_Iterations
The iteration count. [0]
contains the least significant word, [1]
the most significant word.
uvec2 KFP_IterationsMin
The minimum iteration count achieved in the image.
uvec2 KFP_IterationsMax
The maximum escaped iteration count achieved in the image.
float KFP_IterDiv
Divide iterations.
float KFP_ColorOffset
Color offset.
bool KFP_Smooth
Smooth colouring.
bool KFP_Flat
Flat colouring
bool KFP_InverseTransition
Invert colour transition. Can be applied to float49
iteration counts with the function KF_InverseTransition()
.
int KFP_Differences
Numerical differencing method. See above.
int KFP_ColorMethod
Color method, one of the following #define
d constants:
ColorMethod_Standard
ColorMethod_SquareRoot
ColorMethod_CubicRoot
ColorMethod_Logarithm
ColorMethod_Stretched
ColorMethod_DistanceLinear
ColorMethod_DEPlusStandard
ColorMethod_DistanceLog
ColorMethod_DistanceSqrt
ColorMethod_LogLog
ColorMethod_ATan
ColorMethod_FourthRoot
The float49
iteration counts can be transformed by the ColorMethod (including distance estimation, IterDiv, ColorOffset, InverseTransition) can be applied with the function KF_IterTransform()
float KFP_PhaseColorStrength
Phase color strength.
bool KFP_Slopes
Whether slopes are enabled.
float KFP_SlopePower
Slope power.
float KFP_SlopeRatio
Slope ratio.
vec2 KFP_SlopeDir
The cosine and sine of the slope angle, suitable for dot products.
vec4 KF_Slopes(bool Analytic, vec2 SlopeDir, float Power, float Ratio)
This API function implements slope colouring emulating KF’s default colouring. The return value s
can be combined with the background colour bg
with mix(bg, s.rgb, s.a)
;
There are up to KFP_MultiWavesCountMax
waves (a constant, currently 32):
bool KFP_MultiWavesEnabled
Whether waves are enabled.
bool KFP_MultiWavesBlend
Whether waves should be blended.
int KFP_MultiWavesCount
How many waves are added.
ivec3 KFP_MultiWaves[KFP_MultiWavesCountMax]
The wave data. The ivec3
contains period .x
and type .z
, the .y
coordinate is currently not used. Only the first KFP_MultiWavesCount
slots are filled.
vec3 KF_InfiniteWaves(bool Smooth, float49 N)
This API function implements infinite waves emulating KF’s default colouring.
bool KFP_TextureEnabled
Whether image texture is enabled.
sampler2D KFP_Texture
The texture.
float KFP_TextureMerge
Image texture merge.
float KFP_TexturePower
Image texture distortion power.
float KFP_TextureRatio
Image texture distortion ratio.
vec2 KF_TextureWarp(float TexturePower, float TextureRatio, vec2 SlopeDir)
This API function implements image texture distortion emulating KF’s default colouring. Example usage:
if (KFP_TextureEnabled)
{
vec2 tc = getCoord() +
KF_TextureWarp(KFP_TexturePower, KFP_TextureRatio, KFP_SlopeDir);
tc /= vec2(ImageSize.xy);
s = mix(s, texture(KFP_Texture, tc).rgb, KFP_TextureMerge);
}
Minimum iteration count achieved in the image (display only).
Maximum iteration count achieved in the image (display only).
Series approximation iteration count (display only).
Series approximation terms in use (display only).
Calculations per second (display only).
Notation:
i -- imaginary unit (square root of -1)
p -- integer power between 2 and 5 (10 for Mandelbrot)
c = a + i b -- pixel coordinates (parameter plane)
z = x + i y -- iteration variable
w = u + i v -- temporary variable for two-stage formulas
f = d + i e -- constant 'a' for TheRedshiftRider formulas
l m ... -- juxtaposition is multiplication
^ -- raise an expression to a positive integer power
|.| -- surrounding a real-valued expression: absolute value
A machine-readable version of this formula list is found in the ‘et’ repository: https://code.mathr.co.uk/et/blob/kf-2.15:/kf/formulas.et This is used by ‘et’ when generating formula code (for Newton-Raphson zooming, etc).
Formulas:
z := z^p + c
z := (|x| + i |y|)^p + c
w := z^p
z := (|u| + i |v|) + c
w := z^p
z := (|u| + i v) + c
z := (x - i y)^p + c
w := (x - i y)^2
z := (|u| + i v) + c
z := (|x| - i y)^2 + c
z := (x - i |y|)^2 + c
w := (|x| - i y)^2
z := (|u| + i v) + c
w := (x - i |y|)^2
z := (|u| + i v) + c
w := (|x| + i y)^3
z := (u - i |v|) + c
z := (|x| + i y)^3
z := (x + i |y|)^3
w := (x + i y)^3
z := (u + i |v|) + c
z := (|x| (x^2 - 3 y^2) - i y |3 x^2 - y^2|) + c
z := (x + i |y|)^4 + c
z := (|x| + i y)^4 + c
z := (|x| - i y)^4 + c
w := (x + i |y|)^4
z := (|u| + i v) + c
w := (|x| + i y)^4
z := (|u| + i v) + c
w := (|x| - i y)^4
z := (|u| + i v) + c
w := z^4
z := (u + i |v|) + c
w := (x - i y)^4
z := (|u| + i v) + c
z := ((x^4 + y^4 - 6 x^2 y^2) - i 4 x y |x^2 - y^2|) + c
z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 x y |x^2 - y^2|) + c
z := (|x^4 + y^4 - 6 x^2 y^2| - i 4 x y |x^2 - y^2|) + c
z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 x y |x^2 - y^2|) + c
z := (|x| + i y)^5 + c
z := (|x| - i y)^5 + c
w := (x - i y)^5
z := (|u| + i v) + c
w := (|x| + i y)^5
z := (u - i |v|) + c
z := (|x| (x^4 + 5 y^4 - 10 x^2 y^2) - i y (|5 x^4 + y^4 - 10 x^2 y^2|)) + c
z := (|x| (x^4 + 5 y^4 - 10 x^2 y^2) + i y (|5 x^4 + y^4 - 10 x^2 y^2|)) + c
z := z^2 (|x| + i |y|)^2 + c
z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 x |y (x^2 - y^2)|) + c
z := ((x^4 + y^4 - 6 x^2 y^2) - i 4 y |x (x^2 - y^2)|) + c
z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 y |x (x^2 - y^2)|) + c
z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 x |y (x^2 - y^2)|) + c
z := (|x^4 + y^4 - 6 x^2 y^2| - i 4 y |x (x^2 - y^2)|) + c
z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 y |x (x^2 - y^2)|) + c
z := z^3 (|x| + i |y|)^3 + c
z := (((x^2 - y^2) - |x|) + i (|2xy| - |y|)) + c
a*z^2+z^3+c
z := (f z^2 + z^3) + c
a*z^2-z^3+c
z := (f z^2 - z^3) + c
2*z^2-z^3+c
z := (2 z^2 - z^3) + c
a*z^2+z^4+c
z := (f z^2 + z^4) + c
a*z^2-z^4+c
z := (f z^2 - z^4) + c
a*z^2+z^5+c
z := (f z^2 + z^5) + c
a*z^2-z^5+c
z := (f z^2 - z^5) + c
a*z^2+z^6+c
z := (f z^2 + z^6) + c
a*z^2-z^6+c
z := (f z^2 - z^6) + c
w := z^2
z := w (|u| + i |v|) + c
z := ((x^2 - y^2) + i (2 d x y + e x^2)) + c
z := ((x^2 + y^2) + i (2 d x y + e x^2)) + c
z := z^1 (|x| + i |y|)^1 + c
z := z^1 (|x| + i |y|)^2 + c
z := z^2 (|x| + i |y|)^1 + c
z := z^1 (|x| + i |y|)^3 + c
z := z^2 (|x| + i |y|)^2 + c
z := z^3 (|x| + i |y|)^1 + c
z := z^1 (|x| + i |y|)^4 + c
z := z^2 (|x| + i |y|)^3 + c
z := z^3 (|x| + i |y|)^2 + c
z := z^4 (|x| + i |y|)^1 + c
z := z^1 (|x| + i |y|)^5 + c
z := z^2 (|x| + i |y|)^4 + c
z := z^3 (|x| + i |y|)^3 + c
z := z^4 (|x| + i |y|)^2 + c
z := z^5 (|x| + i |y|)^1 + c
z := ((x^2 - y^2) + i (2 d |x y| + e x^2)) + c
z := ((x^2 + y^2) + i (2 d |x y| + e x^2)) + c
z := z^2 exp(2 f / z) + c
z := ((x^2 - y^2) + i (2 x y (1 - sin(2 x y)))) + c
z := ((x^2 - y^2) + i (d x y (e + cos(d x y)))) + c
z := z^p (exp((d/2) log(x^2 + y^2))) + c
The following are new in version 2.15.5:
z := ((x^2 - y |y|) + i (2 x y)) + c
z := ((-(x^2 - 3 y^2) x) + i (- |3 x^2 - y^2| y)) + c
z := ((x^2 - y^2 (3 + 4 y)) + i (2 x y)) + c
z := ((x^2 - y |y|) + i (2 x |y|)) + c
z := (z + f / x)^2 + c
w := (x |x| - y |y| - x) + i (y |x| + x |y| - y)
z := w^2 + c
w := |(x |x| - y |y| - x)| + i |(y |x| + x |y| - y)|
z := w^2 + c
w := (x |x| - y |y| - x) + i (y |x| + x |y| - y)
z := (|u^2 - v^2| + i (2 u v)) + c
w := (x |x| - y |y| - x) + i (y |x| + x |y| - y)
z := (|u^2 - v^2| + i |2 u v|) + c
z := (|x (x^2 - 3 y^2)| - i (y |3x^2 - y^2|)) + c
z := (3 x^2 - y^2) |y| - i |x^2 - 3 y^2| x + c
z := |3 x^2 - y^2| |y| - i |x^2 - 3 y^2| x + c
z := |y| (5 x^4 + y^4 - 10 x^2 y^2) - i x |x^4 + 5 y^4 - 10 x^2 y^2| + c
z := |y| |5 x^4 + y^4 - 10 x^2 y^2| - i |x| |x^4 + 5 y^4 - 10 x^2 y^2| + c
z := |x| |x^4 + 5 y^4 - 10 x^2 y^2| - i y |5 x^4 + y^4 - 10 x^2 y^2| + c
z := |x| |x^4 + 5 y^4 - 10 x^2 y^2| + i y |5 x^4 + y^4 - 10 x^2 y^2| + c
z := ((|x + 7/4| - 7/4)^2 - y^2 - 77/16) + i (2 (7/4 - |x + 7/4|) y) + c
z := exp(z) + c
z := cos(z) + c
z := sin(z) + c
z := z^p / (1 + z^(p-1)) + c
z := z^4 / (4 (z + 1)^2) + z^2 / (z + 1) + c;
z := (2 z^3 / 3 - 2 z - 1) / (z + 1)^2 + c + 1
Nova is affine-conjugated from the usual form to move critical point from 1 to 0.
z := z - (z^p - 1) / (p z^(p-1)) + c
z := z - (2 (z^p - 1) (p z^(p-1))) / (2 (p z^(p-1))^2 - (z^p - 1) ((p (p-1)) z^(p-2))) + c
z := z - ((z^p - 1) (p z^(p-1))) / ((p z^(p-1))^2 - (z^p - 1) ((p (p-1)) z^(p-2))) + c
z := z - (6 (z^p - 1) (p z^(p-1))^2 - 3 (z^p - 1)^2 ((p (p-1)) z^(p-2))) / (6 (p z^(p-1))^3 - (z^p - 1) (p z^(p-1)) ((p (p-1)) z^(p-2))) + (z^p - 1)^2 (p (p-1) (p-2) z^(p-3)) + c
z := z - ((z^p - 1) (2(p z^(p-1))^2 + (z^p - 1) (p (p-1) z^(p-2))))/(2 (p z^(p - 1))^3) + c
kf.exe [options]
-o, --load-map [FILE.kfb] load map file
-c, --load-palette [FILE.kfp] load palette file
-l, --load-location [FILE.kfr] load location file
-s, --load-settings [FILE.kfs] load settings file
-x, --save-exr [FILE.exr] save EXR
-t, --save-tif [FILE.tif] save TIFF
-p, --save-png [FILE.png] save PNG
-j, --save-jpg [FILE.jpg] save JPEG
-m, --save-map [FILE.kfb] save KFB
--save-kfr [FILE.kfr] save KFR
-z, --zoom-out [NFRAMES] zoom sequence
--log (debug|status|info|warn|error)
logging verbosity
-v, -V, --version show version
-h, -H, -?, --help show this help
Locations and settings can also be image files with embedded comments.
If any of the save options are give, KF switches to a non-interactive mode - it will render the image and save to all specified types before quitting. No GUI.
A typical workflow would be to start KF without arguments, set up the window size (eg 640x360), image size (eg 3840x2160), glitch low tolerance flag, etc, then save the settings to a .kfs file, before quitting.
Then launch KF from the command line telling it to load the settings file you just saved, plus the location file you want to render, and where to save the output images to. Then wait patiently. You can write a script that renders multiple locations in succession, either in batch .BAT on Windows, or in Shell .sh on *nix with WINE.
Note that you might have to double up backslashes within quoted paths (if they contain spaces). Maybe forward slashes work instead, but you do need quotes (either single ''
or double ""
, in a matching pair around the whole argument) if there are spaces. Your shell might also do funky stuff with slashes and quotes, so you might need to double up or quadruple up the backslashes and quotes. Easiest to avoid spaces and keep your files in the current working directory… Example:
kf.exe -s settings.kfs -l location.kfr -p out.png -j out.jpg -x out.exr
Use --log info
to disable the status updates, use --log warn
to output only important messages. The default is --log status
.
With -z
you can specify how many frames to render, or -1
to zoom all the way out. In zoom out mode the output save filenames should contain a printf flag for an integer, for example image-%08d.png
will have 8 decimal digits padded with leading 0. This is filled by the frame number, which always starts from 0. Zooming is by the zoom size in the settings file.
New in 2.14.6 is standalone KFB map colouring support with the -o
/--load-map
flag:
kf.exe -o map.kfb -c palette.kfp -p out.png
The -o
/--load-map
flag can also load raw iteration data from EXR.
New in 2.14.10 is KFR writing, if no image files need to be rendered it is very fast to output a zoom sequence (note: no auto-iterations support in this mode).
Tiled rendering is useful for large images, including images larger than the 2GB pixel data limit of Windows bitmaps. The currently supported way of rendering tiled images is via EXR files, though there are some Octave/Matlab scripts still available that can work with more common image files.
Example: target final size 64000x36000, tile factor 10x10. Configure image size to 6400x3600, adjust other settings, save input.kfs
and input.kfr
. Then run (syntax for Bash shell):
kf-tile.exe input.kfs input.kfr 10
for tile in input-*.kfs
do
kf.exe -s ${tile} -l ${tile%.kfs}.kfr --save-exr ${tile%.kfs}.exr
done
exrtactile.exe input 10 0 output.exr # for side-by-side tiles
exrtactile.exe input 10 1 output.exr # for stratified tiles
You can append one argument at the end of the kf-tile.exe
command:
--auto
: use stratified tiling if sensible, otherwise adjacent--adjacent
: force using side-by-side tiles (may have seams between tiles)--stratify
: force using stratified tiles (may have artifacts if numerical differencing is used for DE and/or slopes)The EXR tile assembler is available at https://mathr.co.uk/exrtact including Windows program binary.
exrtact is a suite of small command-line programs for manipulating EXR files. Of particular note is exrtactile
for tile assembly (see above).
zoomasm is a zoom video assembler for turning exponential map EXR keyframe sequences into movies. It has a timeline system in which you can set zoom depth at specific times, for example to synchronize with a soundtrack.
https://code.mathr.co.uk/kf-extras/blob/HEAD:/README
git clone https://code.mathr.co.uk/kf-extras.git
kf-extras is a suite of small command-line programs for manipulating KFB files. Programs include colouring algorithms (curvature, histogram, pseudo-de, rainbow, stretch) and other tools (de-histogram, expmap, resize, statistics, to-exr, to-mmit) as well as a bash script to generate a zoom video (which needs the mightymandel zoom assembler below). The programs use a small library to abstract the KFB and PPM reading and writing, which can be used as a basis for your own programs.
https://fractalforums.org/f/15/t/2965
saka on fractalforums.org is working on a plugin for Adobe After Effects:
I’m working on a plug-in for Adobe After Effects. It renders from the .kfb file data generated by Kalles Fraktaler. I will release the plug-in as open-source, but of course Adobe products are not free.
It’s still very much a work in progress, but I thought I’d share in case anyone is interested in trying it out at this early stage. It might have some bugs.
Why After Effects? It provides a pretty solid animation, layering and rendering engine. All the settings can be animated, and it is easy to build layered compositions using KF data. Plus having 4k and 8k export in various codecs is appealing.
Requirements: After Effects 2019, Windows only.
See fractalforums.org for downloads and tutorials.
http://www.chillheimer.de/kallesfraktaler
The original Movie Maker by Karl Runmo. Has controls for changing speed, rotation, colour cycling, and more, at specific frames. Also has an option for zoom depth text overlay. Works from KFB files and generates multiple video file segments.
http://www.chillheimer.de/kallesfraktaler/mmy/
Works from KFB files and generates video segments with a 3D effect:
This Manual is formed as a tutorial describing the steps to make a movie with 3D effect, which includes all settings.
Mandel Machine is a fast Mandelbrot renderer for Windows written in Java and assembly.
Dinkydau on fractalforums.org has written:
something to convert the MMI file format to KFB
so that Mandel Machine glitches can be corrected in KF or KF renders can be coloured in Mandel Machine. But Dinkydau has not released it. Maybe if you ask nicely you will be granted access. More information at:
https://fractalforums.org/f/66/t/769/msg3960#msg3960
Dinkydau on fractalforums.org has written:
My favorite zoom video maker (it only creates PNG sequences) is SeryZone’s kfb map visualiser. It’s hard to use because of the very not-intuitive interface though.
http://www.fractalforums.com/announcements-and-news/sft-map-visualizer
With this tool you can create PNG images from KFB maps and use them as keyframes with the other tool fractal video maker. Use fractal video maker to interpolate extra png files, for example 60 between each keyframe for a 60 fps zoom video at a speed of 1 zoom per second. (where by “zoom” I mean an increase in magnification by a factor 2, which is the recommended zoom size in kalles fraktaler)
https://fractalforums.org/f/15/t/1364/msg7023#msg7023
Later in that thread are download links for the tools.
mightymandel is a Mandelbrot set renderer using OpenGL.
https://mightymandel.mathr.co.uk/
It has a zoom assembler in its extra
subfolder.
https://mightymandel.mathr.co.uk/current/usage.html#usagezoom
usage: zoom iwidth iheight iframes olength [ofps [oshutter]] \
< stream.ppm > stream.y4m
It is a bit picky about the format of the input PPM stream, and input frames must be 2x zoomed at each frame from zoomed out to zoomed in. Arguments:
iwidth: input frame width
iheight: input frame height
iframes: input frame count
olength: output video length in seconds
ofps: output frame rate (25fps default)
oshutter: motion blur (0 no blur, 1 full blur, 0.5 default)
You might need to downscale the input PPM stream to something your GPU can manage, noting that the internal code needs a texture 2x bigger than the input/output frames. Up to 4096x4096 input should be ok on most modern cards. The output dimensions are the same as the input. For best quality downscale after zoom interpolation, not before, if possible.
et is an escape time fractal project implemented in Haskell.
It has a forked version of the mightymandel zoom interpolator optimized for distance estimation rendering. Usage is the same as the mightymandel zoom interpolator except that the input is raw headerless floating point data (single channel containing distance estimate, normalized to 1 for the neighbouring pixel).
The difference to the mightymandel zoom interpolator is that it interpolates the DE data before colouring instead of after, which gives a much smoother image (no strobing filaments). Output size is hardcoded to 1920x1080, you can edit this near the top of the main()
function in zoom.c
before compiling. Input frame size should be as large as possible for best quality.
The program has two more arguments compared to the mightymandel zoom interpolator: whether to output a header (set to 1 unless you know what you are doing) and an “inverse video” flag that makes it white on black instead of black on white. The output Y4M stream is mono, you might have to tell ffmpeg to encode -pix_fmt yuv420p
for some codecs.
usage: zoom iwidth iheight iframes olength \
[ofps [oshutter [header [inverse]]]] < stream.raw > stream.y4m
zoom-tools is a suite of small command-line programs for turning EXR zoom sequences into zoom videos. It has filters for input keyframes and output video frames, allowing video files to be encoded without needing so much temporary disk space.
zoom-tools has been obsoleted by zoomasm.
The mightymandel zoom interpolator is better in every way (it is based on the same code, just enhanced). And the book repository is 60MB because it has images. But if you want to study it for historical reference:
wget -O Makefile https://code.mathr.co.uk/book/blob_plain/HEAD:/code/Makefile
wget -O zoom.c https://code.mathr.co.uk/book/blob_plain/HEAD:/code/zoom.c
make zoom
Or using git (note: the repository is large):
git clone https://code.mathr.co.uk/book.git
cd book/code
make zoom
Usage:
./zoom iwidth iheight iframes olength < stream.ppm > stream.y4m
Discussion about a common format for escape time fractal data is taking place here:
https://fractalforums.org/f/11/t/3017
Here are the channels and metadata that KF currently supports:
half R
, half G
, half B
in linear light
uint32 N
integer iteration count
0xFFFFFFFF
is non-escaped before header metadata field int Iterations
(or string Iterations
, as it can exceed the range of int
)
0x00000000 is uncalculated/glitch/no-data-available.
If actual iteration values can be zero or negative, add a bias constant to each count and store it in the header metadata field int IterationsBias
(or string IterationsBias
, it can exceed the range of int
). The bias could be negative, this might allow you to store high iteration counts without necessarily needing two channels if the actual min/max range is small enough)
For images with biased iteration counts above 0xFFFFFFFE
, split into two channels:
uint32 N0
least significant 32 bits
uint32 N1
most significant 32 bits
(0xFFFFFFFF, 0xFFFFFFFF)
is interpreted as non-escaped
For future supercomputers, this can be extended with N2
etc…
float NF
fractional iteration count, expected to be in [0.0 .. 1.0)
The continuous iteration count (when escaped) is N+NF-IterationsBias
. This is stored separately to avoid losing precision at high iteration counts
phase of first escaped Z value, measured in turns
float T
in [0.0 .. 1.0)
It is desirable that this aligns with NF
to give 2D exterior grid cell coordinates, KF versions before 2.15 align only with Linear
smoothing.
(when derivatives have been calculated)
float DEX
, float DEY
directional distance estimate in cartesian form, normalized such that distance to a neighbouring boundary pixel sqrt(DEX^2 + DEY^2)
is approximately 1.0
.
If some pixels have no directional DE the missing data can be written as (0.0, 0.0)
, but readers should also handle NaN
s in this case. The vector points away from the fractal boundary.