mathr / blog / #

Legendary Colour Palette

Legendary Colour Palette

(click the picture to view the video on diode.zone)

The legendary colour palette technique embeds an image in the iteration bands of an escape time fractal by linearizing it by scanlines and synchronizing the scan rate to the iterations in the fractal spirals so they line up to reconstruct the original image. Historically this has been done by preparing palettes for fractal software using external tools, and mostly only for small images (KF for example has a palette limited to 1024 colour slots, which means 32x32 or 64x16 at most).

Kalles Fraktaler 2 has an image texture feature, which historically only allowed you to warp a background through the semi-transparent fractal. I added the ability to create custom colouring algorithms in OpenGL shader language (GLSL), with which it is possible to repurpose this texture and (for example) use it as a legendary palette.

Here I scaled my avatar (originally 256x256) to 128x16 pixels, and fine tuned the iteration count divisor by hand after zooming to a spiral in the Seahorse Valley of the Mandelbrot set. Then the face from the icon is visible in the spirals all the way down to the end of the video. I used a work-in-progress (not yet released) build of KF 2.15.3, which has a new setting not to resize the texture to match the frame size: this allows the legendary technique to work much more straightforwardly.

I rendered exponential map EXR frames from KF and assembled into a zoom video with zoomasm. From KF I exported just the RGB channels with the legendary palette colouring, and the distance estimate channels. I did not colour the RGB with the distance estimate in KF, because with the exponential map transformation they would not be screen-space correct (the details would be smaller in the center of the reprojected video than at the edges). I could not do all the colouring in zoomasm either, because it does not support image textures. I added the boundary of the fractal in zoomasm afterwards, by mixing pink with the RGB from KF according to the length of the screen-space distance estimate channels (which zoomasm scales properly when reprojecting the exponential map).

This post was inspired by Fractal Universe's YouTube videos from 2017:

I hope to release KF 2.15.3 before the end of this month. There are big changes (aside from the texture resize setting) that I'm keen to get out into the world.