Kalles Fraktaler 2 + Manual

Claude Heiland-Allen

Karl Runmo

2021-07-22

Kalles Fraktaler 2 +

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:

Quick Start

Limits

Known Bugs

Differences From Original 2.11.1

Incompatible Changes

Other Changes

Change Log

kf-2.15.4

2021-07-22

kf-2.15.3

2021-05-26

kf-2.15.2.4

2021-05-23

kf-2.15.2.3

2021-05-22

kf-2.15.2.2

2021-04-07

kf-2.15.2.1

2021-03-31

kf-2.15.2

2021-03-31

kf-2.15.1.6

2020-12-08

kf-2.14.10.7

2020-12-08

kf-2.15.1.5

2020-11-24

kf-2.14.10.6

2020-11-24

kf-2.15.1.4

2020-11-18

kf-2.14.10.5

2020-11-18

kf-2.15.1.3

2020-11-12

kf-2.14.10.4

2020-11-10

kf-2.15.1.2

2020-11-08

kf-2.15.1.1

2020-10-28

kf-2.15.1

2020-10-28

kf-2.14.10.3

2020-10-08

kf-2.14.10.2

2020-07-12

kf-2.14.10.1

2020-06-01

kf-2.14.10

2020-05-25

kf-2.14.9

2019-12-31

kf-2.14.8

2019-09-23

kf-2.14.7.1

2019-08-30

kf-2.14.7

2019-08-29

kf-2.14.6.1

2019-07-19

kf-2.14.6

2019-07-18

kf-2.14.5

2019-03-20

kf-2.14.4

2019-01-18

kf-2.14.3

2018-10-29

kf-2.13.11

2018-10-29

kf-2.14.2

2018-10-23

kf-2.13.10

2018-10-23

kf-2.14.1

2018-09-27

kf-2.13.9

2018-09-06

kf-2.13.8

2018-08-28

kf-2.13.7

2018-08-14

kf-2.13.6

2018-08-02

kf-2.13.5

2018-06-26

kf-2.13.4

2018-06-21

kf-2.12.13.1

2018-06-04

kf-2.12.13

2018-05-15

kf-2.13.3

2018-05-08

kf-2.13.2

2018-05-01

kf-2.13.1

2018-03-30

kf-2.12.12

2018-03-30

kf-2.12.11

2018-03-12

kf-2.12.10

2018-02-22

kf-2.12.9.1

2018-01-24

kf-2.12.9

2018-01-24

kf-2.12.8

2017-12-22

kf-2.12.7

2017-12-07

kf-2.12.6

2017-11-24

kf-2.12.5

2017-11-02

kf-2.12.4

2017-10-06

kf-2.12.3

2017-09-25

kf-2.12.2

2017-09-20

kf-2.12.1

2017-09-19

kf-2.11.1+gmp.20170913

kf-2.11.1+gmp.20170822

kf-2.11.1+gmp.20170820

kf-2.11.1+gmp.20170714

kf-2.11.1+gmp.20170713

kf-2.11.1+gmp.20170711

kf-2.11.1+gmp.20170710

kf-2.11.1+gmp.20170703

kf-2.11.1+gmp.20170508

kf-2.11.1+gmp.20170504

kf-2.11.1+gmp.20170406

kf-2.11.1+gmp.20170330.1

kf-2.11.1+gmp.20170330

kf-2.11.1+gmp.20170313

kf-2.11.1+gmp.20170307

kf-2.9.3+gmp.20170307

TODO

User Interface

Calculations

Newton-Raphson Zooming

NanoMB

Preprocessor

Colouring

Getting The Code

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.

Building On Linux

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.

  1. 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
  2. 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).

  3. 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.

  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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.

Building on Windows

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!):

  1. 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.

  2. Download the latest version of MSYS2 from https://www.msys2.org/ (msys2-x86_64-20190524.exe).

  3. 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.

  4. 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.

  5. Close the MSYS2 shell:

     exit
  6. Reopen the MSYS2 shell (from startup menu under the name MSYS2 MSYS).

  7. 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).

  8. Install required tools (this will likely take less time):

     pacman -S --needed git patch make diffutils mingw-w64-x86_64-cmake lzip p7zip unzip
  9. 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)

  10. Install tar. The version of tar that comes installed with MSYS2 has trouble extracting xz files.

     pacman -S tar
  11. Restart MSYS2 again (Close and reopen “MSYS2 MinGW 64-bit”).

  12. 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
  13. 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/.

  14. 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.

  15. 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.

  16. 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.

  17. To build Kalles Fraktaler 2 + release:

    Follow the instructions for Linux, possibly making adaptions to allow them to work with MSYS2

  18. 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.

Benchmark

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:

Acknowledgements

Thanks to:

Claude also thanks Karl for releasing the source code and assigning a Free Software license.

User Manual

File

Open

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.

Save

Saves the current location in the current parameter file (*.kfr)

Save as

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.

KFR

Saves the current location in a new parameter file (*.kfr)

PNG

Saves the current location in a PNG image file (*.png). The location and settings are saved in the file metadata.

JPEG

Saves the current location in a JPEG image file (*.jpg). The location and settings are saved in the file metadata.

TIFF

Saves the current location in a TIFF image file (*.tif). The location and settings are saved in the file metadata.

EXR

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.

Set EXR save channels

Choose which channels to save in EXR image files. This is stored in the settings, so you can use it with command line rendering.

KFB

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.

Open map

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.

Store zoom-out images

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.

Examine Zoom sequence

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.

Resume Zoom sequence

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.

Open Settings

Opens rendering settings from a settings file (*.kfs) You can also load metadata from images saved by KF.

Save Settings

Saves the current rendering settings to a settings file (*.kfs)

Check for update

Retrieves information from KF’s homepage on the internet, to let you know if a newer version is available.

Exit

Exit this program

Fraktal

Presets

Set groups of settings to suggested preset values.

Fast

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.

Best

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.

Formula…

Adjust fractal type and power etc. See below.

Hybrid Formula…

Design your own hybrid fractal formula. See below.

Bailout…

Adjust iteration limit and escape radius, etc. See below.

Location…

Displays the Location dialog where the coordinates for this location is displayed and can be edited.

Colors…

Adjust colouring. See below.

Information…

Display information about the fractal. See below.

Refresh

Render the current location.

Cancel rendering

Cancel the current rendering.

Reset

Set the location to the start point.

Undo

Go back to previous location(s).

Redo

Go forward in the undo history.

Copy

Save the current location to the system clipboard.

Paste

Set the current location from the system clipboard.

View

Zoom size

Set the level of zoom, CTRL-left mouse click to zoom in, right to zoom out. Scroll wheel zooms by a factor of 2.

Animate soom

Turns animation on or off when zooming.

Set window and image size

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).

Arbitrary size

When disabled, the window aspect ratio is locked to 16:9. When enabled, any aspect ratio is possible.

Transformation

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.

Reset Transformation

Clear any transformation.

Exponential Map

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.

Shrink quality

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.

Newton-Raphson zooming

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 on the top right, 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 in the bottom right corner 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.

Find Minibrot

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.

Non exact find Minibrot

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 cursor

Center the cursor to image’s pattern center.

Find center of glitch (Color)

Centers the mouse pointer over the glitch blob found, if any.

Find highest iteration

Centers the mouse pointer over the pixel with the highest iteration.

Show Inflection

Activate or deactivate display of Inflection.

Show crosshair window

Display a small window that magnifies the area around the mouse cursor. Perfect for precisely picking particular pixels for zooming etc.

Advanced

Auto solve glitches

Turns the Auto solve glitches function on or off.

Reference selection method.

Chooose alternative methods for finding center of glitches. May be faster/slower depending on location.

Solve glitch with near pixel method

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.

Ignore isolated small glitches

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.

Perturbation and Series Approximation Tuning

Glitch tolerance

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 tolerance

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.

Approximation terms

Automatic (default, recommended) is based on number of pixels.

Max references

Sets limit of secondary reference points for automatic glitch correction. There is a hard limit of 10000, which is also the default.

Derivative glitch test

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.

Reference strict zero

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.

Rescaled series approximation

Use rescaling for series approximation calculations. Enabling can be faster, but may lead to inaccurate images. Only for power 2 Mandelbrot set.

Number Type Selection

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.

Set main reference

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 reference (Color)

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.

Reuse reference

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.

No reuse center

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.

Show iterations

Displays the image black-and-white with the pixels with the highest iteration as white and the pixels with the lowest iteration as black.

Show smooth transition colors

Displays the image black-and-white representing the smoothing coefficient.

Show glitches

When activated, glitches are displayed with a solid color.

Mirror

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…

No series approximation

Turns the series approximation function on or off. May fix (or cause) different bugs.

Use NanoMB1 (experimental)

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.

Use NanoMB2 (experimental)

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.

Interior checking (NanoMB only)

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.

Use auto iterations

Turns automatic iteration control on or off. This is on per default.

Use guessing

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.

‘Open’ resets default parameters

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.

‘Save’ overwrites existing file

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.

SIMD vector size

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.

SIMD chunk size

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.

Half-float image buffer

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.

Multi-threaded EXR input/output

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.

Multi-threaded reference calcs

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.

Threads per CPU

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.

OpenCL

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).

About

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.

Status bar

Left

Middle

Formula dialog

From Hybrid

Convert hybrid formula to built-in formula (when possible).

To Hybrid

Convert built-in formula to hybrid formula (when possible).

Ignore Hybrids

Don’t display built-in formulas that have hybrid equivalents in the fractal type drop-down below.

Fractal type

Mandelbrot, Burning Ship, etc

Power

Some forumulas have power setting.

Seed

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).

Factor A

Set the complex number a (denoted f = d + e i in the formula list below) for TheRedshiftRider formulas.

Derivatives

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).

Jitter seed

Non-zero enables jitter with a pseudo-random-number generator seed value.

Jitter scale

In units of a pixel (1 pixel is sensible in most cases).

Gaussian jitter

Probably best left disabled (uniform jitter looks better).

Hybrid Formula dialog

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.

Groups

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.

Lines

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 *.

Operators

Each operator has controls (from left to right):

Setting all of them gives (-|x| + -|y| i)^p * (a_r + a_i i).

OK / Cancel

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…

Bailout dialog

Number of iterations

Increase this if the interior is “blobby”.

Smooth method

(new in 2.14.10, was previously linked to escape radius)

Escape radius

Bailout Re+Im

Modify these for special effects (default 1, 1).

Norm power

(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).

Colors dialog

The Colors dialog is accessed via the Fraktal menu, or via the keyboard shortcut Ctrl+C in the main window.

Number of key colors

Set the number of key colors between 1 and 1024.

Divide iteration

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.

Color offset

Offset the colors in the palette

Random

Fill the palette with random colors made from the Seed value. The Seed button select a seed value randomly.

More contrast

Move RGB values closer to max or min

Less contrast

Move RGB values closer to the middle

Show slopes

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 palette

Save the current palette in KFP (*.kfp) file

Open palette

Load palette from a KFP (*.kfp) file

Palettes can also be loaded via drag and drop.

Expand double

Double the number of key colors without changing the palette. This allows finer control of individual colors without changing the palette for other colors

Expand all

Increase the number of key color to maximum 1024 without changing the palette

Double

Double the key colors by repeating them

Merge Colors

Allows a selected color to be merged to every specied key color

Show index

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

Smooth color transition

Makes the transitions of colors smooth

Inverse smooth color transition

Inverse the smooth color transition which makes edges more visible

Unnamed dropdown box

Specifies handling of the iteration count values prior to coloring

Palette waves

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

Infinite waves

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.

Texture

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).

OpenGL

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).

OpenGL dialog

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.

GLSL

Enter OpenGL shader language source code for colouring snippet. See below for API.

Default

Reset colouring GLSL to default (emulating the regular CPU-based colouring algorithm).

Import

Load GLSL fragment from a text file (*.glsl).

GLSL fragments can also be imported via drag and drop.

Export

Export GLSL fragment to a text file (*.glsl).

Use sRGB

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.

Enable

Use OpenGL shader colouring instead of CPU colouring.

Apply

Apply changes, recompiling the shader.

Close

Cancel any unapplied changes and close the window.

OpenGL Version

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 API

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 numbers

To 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]).

Accessing pixel data

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.

Distance estimation

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 #defined 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.

Accessing colouring parameters

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 #defined 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.

Slopes

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);

Infinite waves

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.

Image texture

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);
}

Information dialog

Formulas

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

Formulas:

Mandelbrot

z := z^p + c

Burning Ship

z := (|x| + i |y|)^p + c

Buffalo

w := z^p
z := (|u| + i |v|) + c

Celtic

w := z^p
z := (|u| + i v) + c

Mandelbar

z := (x - i y)^p + c

Mandelbar Celtic

w := (x - i y)^2
z := (|u| + i v) + c

Perpendicular Mandelbrot

z := (|x| - i y)^2 + c

Perpendicular Burning Ship

z := (x - i |y|)^2 + c

Perpendicular Celtic

w := (|x| - i y)^2
z := (|u| + i v) + c

Perpendicular Buffalo

w := (x - i |y|)^2
z := (|u| + i v) + c

Cubic Quasi Burning Ship

w := (|x| + i y)^3
z := (u - i |v|) + c

Cubic Partial BS Real

z := (|x| + i y)^3

Cubic Partial BS Imag

z := (x + i |y|)^3

Cubic Flying Squirrel (Buffalo Imag)

w := (x + i y)^3
z := (u + i |v|) + c

Cubic Quasi Perpendicular

z := (|x| (x^2 - 3 y^2) - i y |3 x^2 - y^2|) + c

4th Burning Ship Partial Imag

z := (x + i |y|)^4 + c

4th Burning Ship Partial Real

z := (|x| + i y)^4 + c

4th Burning Ship Partial Real Mbar

z := (|x| - i y)^4 + c

4th Celtic Burning Ship Partial Imag

w := (x + i |y|)^4
z := (|u| + i v) + c

4th Celtic Burning Ship Partial Real

w := (|x| + i y)^4
z := (|u| + i v) + c

4th Celtic Burning Ship Partial Real Mbar

w := (|x| - i y)^4
z := (|u| + i v) + c

4th Buffalo Partial Imag

w := z^4
z := (u + i |v|) + c

4th Celtic Mbar

w := (x - i y)^4
z := (|u| + i v) + c

4th False Quasi Perpendicular

z := ((x^4 + y^4 - 6 x^2 y^2) - i 4 x y |x^2 - y^2|) + c

4th False Quasi Heart

z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 x y |x^2 - y^2|) + c

4th Celtic False Quasi Perpendicular

z := (|x^4 + y^4 - 6 x^2 y^2| - i 4 x y |x^2 - y^2|) + c

4th Celtic False Quasi Heart

z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 x y |x^2 - y^2|) + c

5th Burning Ship Partial

z := (|x| + i y)^5 + c

5th Burning Ship Partial Mbar

z := (|x| - i y)^5 + c

5th Celtic Mbar

w := (x - i y)^5
z := (|u| + i v) + c

5th Quasi Burning Ship (BS/Buffalo Hybrid)

w := (|x| + i y)^5
z := (u - i |v|) + c

5th Quasi Perpendicular

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

5th Quasi Heart

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

SimonBrot 4th

z := z^2 (|x| + i |y|)^2 + c

4th Imag Quasi Perpendicular / Heart

z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 x |y (x^2 - y^2)|) + c

4th Real Quasi Perpendicular

z := ((x^4 + y^4 - 6 x^2 y^2) - i 4 y |x (x^2 - y^2)|) + c

4th Real Quasi Heart

z := ((x^4 + y^4 - 6 x^2 y^2) + i 4 y |x (x^2 - y^2)|) + c

4th Celtic Imag Quasi Perpendicular / Heart

z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 x |y (x^2 - y^2)|) + c

4th Celtic Real Quasi Perpendicular

z := (|x^4 + y^4 - 6 x^2 y^2| - i 4 y |x (x^2 - y^2)|) + c

4th Celtic Real Quasi Heart

z := (|x^4 + y^4 - 6 x^2 y^2| + i 4 y |x (x^2 - y^2)|) + c

SimonBrot 6th

z := z^3 (|x| + i |y|)^3 + c

HPDZ Buffalo

z := (((x^2 - y^2) - |x|) + i (|2xy| - |y|)) + c

TheRedshiftRider 1: a*z^2+z^3+c

z := (f z^2 + z^3) + c

TheRedshiftRider 2: a*z^2-z^3+c

z := (f z^2 - z^3) + c

TheRedshiftRider 3: 2*z^2-z^3+c

z := (2 z^2 - z^3) + c

TheRedshiftRider 4: a*z^2+z^4+c

z := (f z^2 + z^4) + c

TheRedshiftRider 5: a*z^2-z^4+c

z := (f z^2 - z^4) + c

TheRedshiftRider 6: a*z^2+z^5+c

z := (f z^2 + z^5) + c

TheRedshiftRider 7: a*z^2-z^5+c

z := (f z^2 - z^5) + c

TheRedshiftRider 8: a*z^2+z^6+c

z := (f z^2 + z^6) + c

TheRedshiftRider 9: a*z^2-z^6+c

z := (f z^2 - z^6) + c

SimonBrot2 4th

w := z^2
z := w (|u| + i |v|) + c

General Quadratic Minus

z := ((x^2 - y^2) + i (2 d x y + e x^2)) + c

General Quadratic Plus

z := ((x^2 + y^2) + i (2 d x y + e x^2)) + c

Mothbrot 2nd 1x1

z := z^1 (|x| + i |y|)^1 + c

Mothbrot 3rd 1x2

z := z^1 (|x| + i |y|)^2 + c

Mothbrot 3rd 2x1

z := z^2 (|x| + i |y|)^1 + c

Mothbrot 4th 1x3

z := z^1 (|x| + i |y|)^3 + c

Mothbrot 4th 2x2 (aka SimonBrot 4th)

z := z^2 (|x| + i |y|)^2 + c

Mothbrot 4th 3x1

z := z^3 (|x| + i |y|)^1 + c

Mothbrot 5th 1x4

z := z^1 (|x| + i |y|)^4 + c

Mothbrot 5th 2x3

z := z^2 (|x| + i |y|)^3 + c

Mothbrot 5th 3x2

z := z^3 (|x| + i |y|)^2 + c

Mothbrot 5th 4x1

z := z^4 (|x| + i |y|)^1 + c

Mothbrot 6th 1x5

z := z^1 (|x| + i |y|)^5 + c

Mothbrot 6th 2x4 (Simon’s Mothbrot)

z := z^2 (|x| + i |y|)^4 + c

Mothbrot 6th 3x3 (aka SimonBrot 6th)

z := z^3 (|x| + i |y|)^3 + c

Mothbrot 6th 4x2

z := z^4 (|x| + i |y|)^2 + c

Mothbrot 6th 5x1

z := z^5 (|x| + i |y|)^1 + c

Abs General Quadratic Minus

z := ((x^2 - y^2) + i (2 d |x y| + e x^2)) + c

Abs General Quadratic Plus

z := ((x^2 + y^2) + i (2 d |x y| + e x^2)) + c

Omnibrot

z := z^2 exp(2 f / z) + c

Hidden Mandelbrot

z := ((x^2 - y^2) + i (2 x y (1 - sin(2 x y)))) + c

Hidden Mandelbrot a la Cos

z := ((x^2 - y^2) + i (d x y (e + cos(d x y)))) + c

Polarbrot

z := z^p (exp((d/2) log(x^2 + y^2))) + c

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).

Command Line Usage

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

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:

The EXR tile assembler is available at https://mathr.co.uk/exrtact including Windows program binary.

Third-party Software

exrtact

https://mathr.co.uk/exrtact

exrtact is a suite of small command-line programs for manipulating EXR files. Of particular note is exrtactile for tile assembly (see above).

zoomasm

https://mathr.co.uk/zoomasm

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.

kf-extras

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.

After Effects zoom tools

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.

Key Frames Movie Maker

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.

Yann Le Bihan’s Movie Maker 3D

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.

Dinkydau’s Mandel Machine Convertor

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

SeryZone’s Map Visualizer and Fractal Video Maker

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 zoom interpolator

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 zoom interpolator

et is an escape time fractal project implemented in Haskell.

https://mathr.co.uk/et

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 zoom-interpolator

https://mathr.co.uk/zoom

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.

“book” zoom interpolator

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

File Formats

EXR Channels and Metadata

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:

RGB colours

half R, half G, half B in linear light

smooth iteration count

uint32 N integer iteration count

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

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.

directional DE

(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 NaNs in this case. The vector points away from the fractal boundary.