Kalles Fraktaler 2 +

As the orginal upstream 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!

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 upstream version:

This version:

Feedback:

Known Bugs

Differences From Upstream 2.11.1

Incompatible Changes

Other Changes

Change Log

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 upstream
git checkout claude       # for MINGW build system and bug fixes
git checkout kf-2.12      # for old stable bugfixes
git checkout kf-2.13      # for current stable development
git checkout kf-2.14      # for current experimental 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

Build instructions for cross-compiling from GNU/Linux require about 4.2GB of disk space and good internet download speed (or patience). About 600MB of downloads including the chroot debootstrap step. To build the PDF manual needs some more packages, adding another 600MB of downloads and 1GB of space, so I left that optional. If you have recent Debian you can skip the chroot step and install natively.

  1. Setup Debian Stretch chroot:

     mkdir ./vm
     sudo debootstrap stretch ./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
     apt-get update
     apt-get install \
       build-essential \
       cabal-install \
       ghc \
       git \
       libghc-parsec3-dev \
       libtool \
       lzip \
       m4 \
       mingw-w64 \
       p7zip \
       wine32 \
       wine64 \
       wine-binfmt \
       xsltproc \
       zip
     apt-get install \
       pandoc \
       texlive-latex-recommended   # optional, for PDF manual

    For Ubuntu replace “wine32 wine64 wine-binfmt” with “wine” (but see note about build failures with some versions).

  3. Prepare non-root build user:

     adduser build
     # enter and confirm password
     su - build
     mkdir -p ~/win64/src
     mkdir -p ~/win32/src
  4. Download Kalles Fraktaler 2 sources:

     cd ~/win64/src
     git clone https://code.mathr.co.uk/kalles-fraktaler-2.git
     cd kalles-fraktaler-2
     git checkout kf-2.14
     cd ..
     cp -avit ~/win32/src kalles-fraktaler-2/
  5. 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 builds both 64bit and 32bit variants:

     bash ~/win64/src/kalles-fraktaler-2/prepare.sh
  6. Finally, build Kalles Fraktaler 2 + GMP (64bit and 32bit):

     cd ~/win64/src
     cd kalles-fraktaler-2
     make -j 8 SYSTEM=64
     make README.pdf   # optional, for PDF manual
    
     cd ~/win32/src
     cd kalles-fraktaler-2
     make -j 8 SYSTEM=32
  7. To cut a release bundle, use the script

     export VERSION=2.whatever
     git tag -s kf-${VERSION}
     ./release.sh ${VERSION}

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 Stretch has:

$ x86_64-w64-mingw32-g++ --version
x86_64-w64-mingw32-g++ (GCC) 6.3.0 20170516
Copyright (C) 2016 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

(note: these instructions are out of date)

Build instructions for compiling on Windows (thanks to knighty!):

  1. Remove any old msys2.

  2. Downloaded latest version of msys2 (msys2-x86_64-20161025.exe). This is the 64 bit version. msys2-i686-20161025.exe is the 32 bit version.

  3. After running it, it installs msys2. At the end the msys2 shell is launched.

  4. In the msys2 shell, invoke pacman:

     pacman -Syuu

    This have to be done until is says there is nothing to do anymore.

  5. Close the msys2 shell:

     exit
  6. Reopen msys2 shell (from startup menu).

  7. Install mingw/gcc 64 bit:

     pacman -S mingw-w64-x86_64-toolchain

    one can also install 32 bit version by:

     pacman -S mingw-w64-i686-toolchain
  8. Install Boost

     pacman -S mingw-w64-x86_64-boost

    from msys shell

  9. Close msys2 shell then open “msys2 mingw 64 bit” shell (in order to have all the environment variables properly set)

  10. Change directory to the kalles fraktaler sources (where Makefile resides).

  11. Compile

    mingw32-make WINDRES=windres

    (if this doesn’t work edit the Makefile to replace the line

    WINDRES ?= x86_64-w64-mingw32-windres

    to

    WINDRES ?= windres

    and run mingw32-make without arguments)

  12. Execute it this way from (msys2 mingw 64 bit) command line:

    ./fraktal_sft64    # for the claude branch
    ./kf.exe           # for the claude-gmp branch

    because it is linked dynamically to some libraries. In order to execute it from the explorer one needs to copy libgmp-10.dll and libwinpthread-1.dll from msys64/mingw64/bin next to the generated executable.

Kalles Fraktaler 2 Copyright (C) 2013-2017 Karl Runmo Copyright (C) 2017-2018 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).

Acknowledgements

Thanks to:

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

User Manual

File

Fraktal

View

Advanced

About

At the very top right:

Iterations 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:

A machine-readable version of this formula list is found in the ‘et’ repository: https://code.mathr.co.uk/et/blob/kf:/kf/formulas.et This is used by ‘et’ when generating formula code (for Newton-Raphson zooming, etc).

Number of colors dialog

Command Line Usage

kf.exe [options]
    -l, --load-location [FILE.kfr]  load location file
    -s, --load-settings [FILE.kfs]  load settings file
    -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
    -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 -m out.kfb

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 PNG, JPEG, and KFB 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.