KF Movie Maker is an After Effects plug-in that allows you to create fractal zoom movies. Kalles Fraktaler is capable of exporting images and iteration data. This plug-in combines that data into a continuous movie. After Effects has the power to allow you to animate many aspects of this movie.
About KF Movie Maker
I have written this software primarily for my own use on the Maths Town YouTube channel, and there are many examples of fractal zooms there. I release this plug-in in the hope that it will be useful, I am sure that you will find creative ways to use it in your own projects. If you find this software useful then please consider supporting me on Patreon. Patreon support is optional, but it will show your support and encourage further development of the software. If the Patreon model works well, I intend to develop more After Effects plug-ins and release them for free.
Both Kalles Fraktaler and the KFMovieMaker plug-in are released under the open-source GNU Affero General Public License which allows you to download and use the software for free (if you wish to distribute the software to others, you should read the license. If course, Adobe After Effects is not free, you will need to buy it, or setup a subscription with Adobe.
You can find the main page for the KF Movie Maker plugin here: https://www.maths.town/after-effects-plugins/kfmoviemaker
Exporting From Kalles Fraktaler
The KFMovieMaker plug-in requires that you have an image sequence exported from Kalles Fraktaler. The plug-in reads a sequence of .kfb data files which contain the iteration data for the fractal. The plug-in reads colour information from a .kfr file.
To save a sequence from Kalles Fraktaler, first navigate to the final point of your zoom. The images are saved in zoom-out order. Secondly set the “Zoom Size” to 2. (View->Zoom Size->2). It is essential for this plug-in that the zoom size be 2, no other value will work. Set the image size to the desired output size (View->Set Image Size). The plugin will render up to 8k resolution, however at 4k and 8k resolution it can get very slow. I suggest that while you are learning you don’t go above 1080p (1920x1080). Other useful sizes for YouTube are 720p (1280x720) and 4k (3840x2160).
When you are ready, select “Store Zoom Out Images” (File->Store Zoom Out Image). You will be prompted for a location to save a .kfr file. This file contains the colour and location information, from this file alone you can regenerate the sequence. You will also be prompted for a folder to save the sequence; KFMovieMaker assumes that the .kfr and .kfb files are in the same folder. You must export the .kfb files. I also recommend that you export .jpg files, so that you can see the contents of each file. You will need a lot of disk space for bigger zooms.
The process will take a long time to complete. Possibly hours, days, weeks or months, depending on the depth and iteration count of the location at which you started. Once complete, in your folder you should now have a sequence of .kfb files, and a single .kfr file (plus any jpg images).
If the process is interrupted, then Kalles Fraktaller has an option to resume the export. If you are having trouble resuming try deleting recovery.kfb and the last couple of frames (jpg and kfb), and then resuming from that location.
Beginning with After Effects
In After Effects, begin by creating a composition exactly the same size as the data you exported. It can be any frame rate (60fps recommended). The plug-in does not scale. If you need to operate at a different resolution, I suggest that you pre-compose your fractal zoom into one composition (at the fractal’s resolution), then drop that composition into another composition at the resolution of your choice and scale as you need. It is often best to pre-compose (and perhaps pre-render) a fractal zoom if you are trying to do fancy effects.
The KFMovieMaker plug-in is designed to be added to a “solid” layer. From the menu choose “Layer->New->Solid”. Name the solid something like “KF”. Click “Make Comp Size” to ensure that the solid is the same size as your composition. Any colour is fine (it will be ignored).
Now it is time to add an effect to the solid. With the solid selected, from the menu choose “Effect->Maths Town->KF Movie Maker”. Next you should find “Effect Controls” page (double click the effect name “KF Movie Maker” in the timeline to bring it up).
Click “Browse” and navigate to the .kfr file that you saved earlier. The plug-in will now scan that same folder for .kfb data files. You should now see the first frame, which probably includes a small Mandelbrot.
Animating the Zoom
By default, the plug-in will only show the first frame. You need to do some animating to get things zooming. This is done with the “Key Frame” parameter. On the “Effect Controls” page you can open the “Key Frame” value by clicking the “>”. This will reveal a slider. The maximum value of the slider will be set to the total number of key frames found. (You can set higher values, but they will just show the last keyframe).
Now is a good time to calculate the length of your video. You can go into the “Composition Settings” to adjust the length of the composition. A good speed to start with is 1.5 seconds per keyframe, or perhaps 2.0 seconds per keyframe for busy zooms. You will need to do this calculation manually, use your calculator (1.5 * number of keyframes). For example if I have rendered 500 keyframes, I get 750 seconds (500 * 1.5), which is 12 and a half minutes. I’d probably round that up to 13 minutes to allow for some still frames at the start and the end of the zoom.
Now we need to add AE keyframes. (I will use the term “AE keyframe” when I mean keyframes in the After Effects timeline, rather than the keyframe files we rendered earlier). Move the slider to “3 seconds” and click the stopwatch next to the “Key Frame” parameter. This sets an AE keyframe. Set the value at this point to where you wish to start (I often start on frame 4). Next move to timeline slider to near the end of the composition, to the location you wish to finish. Slide the “Key Frame” slider all the way to the right (to the last keyframe). This will automatically add an AE keyframe to your timeline. Your zoom is now animated. And if you are happy with the default settings you can render your composition.
Rendering in After Effects
From the menu choose “Composition->Add to Adobe Media Encoder Queue”. This will bring up the media encoder and allow you to choose some suitable export settings. These settings are beyond the scope of this user guide, but there is plenty of information available from Adobe and online.
Keep in mind that fractal zooms need a higher bitrate than most videos. If you are getting compression artefacts on YouTube the only thing you can do is slow the zoom down.
Click browse to select a .kfr file. The plug-in will read the .kfr file’s colour information, and load all of the .kfb frames from the same folder. The maximum value of the “Key Frame” slider will be updated to reflect the number of frames found.
You may change the .kfr file mid project to replace the colour data. Just put a new .kfr file in the same folder and open it. In this way you can design a new colour scheme in Kalles Fraktaler. The .kfr file can point to any location, the location data is ignored. Only the colour and the “Iteration division” is read from the file.
Note: If you change .kfr files mid-project, After Effect may add an “AE keyframe” to your timeline. You may wish to delete it.
The value of this parameter refers to the .kfb files found in your folder. For whole numbers the plugin-in should display the contents of a single .kfb file. For decimal numbers the plug-in will interpolate between two frames.
Normally you will animate this parameter. The simplest animation is to have only two “AE keyframes” on your timeline, at the start and end of your composition. To do this you will need to calculate an ideal length for your composition (1.5 seconds per .kfb file is a good starting point).
Of course, you can use the more advanced features of After Effects to animate this parameter. The “Graph Editor” provides a good visual representation. If you wish to visualise and edit speeds, from the graph editor you can right-click and select “Edit Speed Graph”. (If this is new to you, try watching a tutorial online)
Remember: You must use “zoom size” 2 when exporting from Kalles Fraktaler, if you see two images overlaid that clearly don’t match, this may be your problem.
One challenge of rendering fractals videos is that the underlying data can change dramatically with just the slightest movement. This is especially true close to the Mandelbrot Set. For still images this is not a problem, but for video, rendering frame by frame can create a flickering effect. Besides performance, this is a second reason why we use keyframes to make fractal videos.
The problem occurs because the iteration count changes exponentially near the Mandelbrot Set. You may be using a palette of 1024 colours, but one frame could easily cause a pixel to change iteration count by 20 or 2000. This creates an unavoidable colour flicker in dense areas. To resolve this issue the plug-in can render an image only once per keyframe, and then cache and scale the image for later frames. The disadvantage is that you can sometimes see where the frames are joined.
“Use Cached Frame”: An image is rendered at the native size of the .kfb file, it is then scaled and blended with the following keyframe, to create the final image. This is the best option for most videos, unless you can visibly see where the frames join. “Distance Estimation” methods sometimes don’t work well with this mode.
“Frame by Frame”: Each frame is coloured individually. The iteration data is sampled and interpolated for each frame, then coloured. This creates a more “accurate frame” at the expense of a flicker in the video. Often best for the “Distance Estimation” method.
Here is where the creativity begins. The colour method controls how colour is applied to the outside of the fractal.
“Standard”: This is the normal method for rendering the Mandelbrot Set, and it should achieve the same results as Kalles Fraktaler. The method is known as “escape time colouring”. It uses the iteration count at each point to select a colour from a table. The values in that table are smoothly interpolated. The colour table is loaded from the .kfr file.
“Distance Estimation”: The distance to the interior of Mandelbrot Set is estimated, and this value is used to select a colour from the colour table (in .kfr file). It is calculated from the gradient of the iteration count (aka the derivative). This plug-in uses the older “pixel based” method, not the newer analytical method in from Kalles Fraktaller. The plug-in compares neighbouring pixels calculate the gradient. (Analytic colouring will be added in a future version).
Kalles Fraktaler’s “traditional” method will give the most similar results to the plug-in, but it will be different. The plug-in exponentially weights the pixel distances over the frame so that they blend better with the following keyframes. As a result, you may get better looking videos that with movie makers that simply blend images. However, it is not perfect, particularly when you use certain “modifiers”. If you get frame “boxes” where the frames join, you will need to use the “frame-by-frame” colour method.
Frame-by-frame colouring has an interesting side effect (which you may, or may not like). The colours appear to move and warp. This is because of the way the pixels are sampled. (Analytic DE should fix this)
“Sin Wave Greyscale”: The colours simply fade from black to white in a cycle. This wave is generated with the sin function. This method is useful when blending layers to create light to dark contrasts.
“Sin Wave Colour”: Creates a sin wave for each colour in the colour table (.kfr file). Fading the colour in from black, then out to black again. Use the “special” slider to create more than one wave for each colour.
“Log Steps Greyscale”: The log function is applied to each iteration band to give the appearance of steps. This method is useful for blending layers.
“Log Steps Colour”: The log function is applied to each colour to give the appearance of steps. By default, 1 step per colour. To add more steps, adjust the “special” parameter.
“Panels Greyscale”: This method is designed to give the appearance of light grey panels. The edges are softened. This method is useful for blending layers. Use “special” to change the amount of black between panels.
“Panels Colour”: This method is designed to give the appearance of coloured panels. One panel for each colour in the colour table. The edges are softened. Use “special” to change the amount of black between panels.
“Angle Greyscale”: Choose a colour based on the angle to the nearest part of the set. Calculated by comparing the nearby pixels in the x and y direction then taking the arctan. Set “iteration division” to 1 for a full cycle through black-white-black. Increasing the iteration division will increase the number of colour cycles. This method is useful for blending. Use the “Colour Cycle” parameter to adjust the angle.
Note: The “angle only” slopes method is the same as “Angle Greyscale” with the iteration division set to 1. It is more efficient to use the slopes, rather than blending two layers.
“Angle Colour”: The same as “Angle Greyscale” but the colour is chosen from the colour table. The entire table is spread over 360 degrees. Create a .kfr file with less colours if this is too dense. Use the “Colour Cycle” parameter to adjust the angle.
“DE & Angle”: This method only works when layer sampling is enabled. It is a combination of distance estimation and the angle colouring methods. The angle is used to select the x-coordinate of the sample. The distance is used to select the y-coordinate. Use “iteration division” and “special” to control the density. This colouring method is quite wild, the results are hard to control.
Note: When not sampling a layer, this method returns middle grey only. This can be used to obtain a slopes only image.
The modifier applies a function to the iteration count before it is used for colouring. “Linear” is no change. “Square Root”, “Cubic Root” and “Logarithm” all reduce the iteration count. These modifiers can be used to reduce the density of colours. You may need to reduce the “Iteration division” to get a desirable result.
The iteration count is divided by this number before colouring is applied. Use this value to control the density of the colouring.
For certain colouring methods & modifiers you may to use very small values for this parameter. To make this easier you can change the range of the slider. Right-click then “Edit Value” to adjust the range of the slider.
Generally you don’t want to animate this parameter. Animating this value may have unintended consequences. If you slowly change the value over a whole video the colour-cycling speed of that video will increase exponentially throughout the video. Use “colour cycling” for this purpose. You could use this control to animate a quick change in density.
Note: When using the “Angle” colouring methods you may wish to set this to 1. These parameters use this parameter to add more cycles of the palette, so in this sense it also controls the colour density.
Normally you will want this enabled, unchecking it can create unexpected results. This parameter controls which data is used to render the fractal. Kalles Fraktaller calculates decimal iteration counts to enable smooth colouring (by measuring how far the count overshoots the maximum). If you uncheck this parameter the decimals are ignored, and your colouring won’t be smooth.
Choose the colour which will act as the first colour in the palette. You could animate this, but it is usually easier to animate “Colour Cycle” (see below). (Internally the offset and cycle values are just added together).
Allows you to animate the colours in a cycling manner. One full rotation is usually one full cycle of the palette. This is presented as an angle control, because it is easier to animate in a cycle than a slider.
Animating colour will greatly increase the render time because changing the colours invalidates the plug-in’s cached images. (“Use Cached Frames” mode usually create the nicest output).
This parameter has a special meaning for each colouring method (see above). Not all methods use this parameter. Experiment with it.
Use Layer Sampling
!!Bug warning: The plug-in is crashing with this enabled, it is still usable, but save your work often!
Enable this to replace the colour table. Another layer is sampled to obtain the colour instead. Rendering performance is slower with this option enabled.
Select another layer to sample, such as an image. The image is sampled left to right, then top to bottom. Usually it is best to sample a smaller image (or video) created elsewhere. For example, you can create a 1024x1 image in photoshop with a colour gradient on it.
You can also create an animated layer and sample from that to get dynamic colouring. If that layer has effects applied you will need to choose “Effects and Masks” with the “Layer to Sample” parameter.
Set the colour of the actual Mandelbrot. At the moment it can only be a solid colour.
Adds a pseudo-3D lighting to the image. This can useful to make certain fractal features easier to see. This is calculated from via pixel-based distance estimation.
“Standard”: Similar to Kalles Fraktaller, but pixel distances are interpolated over the frame to avoid most gaps between frames. (Results are better than merging KF’s jpeg images).
“Angle Only”: This distance is ignored. This create a more dramatic lighting effects.
Use the “Depth”, “Strength” and “Angle” parameters to tune the lighting to your taste.