Xaos and the Generalization of the Fractal Flame Algorithm

April 15, 2009

Why do post transforms, linked transforms and final transforms even exist? They are a way to give more flexibility to the original idea of the fractal flame algorithm, which only contemplated a series of functions (transforms), connected strictly in parallel. That’s the whole point of an IFS.

Post transforms are a way to make this interaction more complex, allowing additional modification to a given function after the variations have already been applied. But looking at it in general terms, a post transform is a full fledged transform, which just happens to represent the identity function in terms of variations (meaning that it is the equivalent of linear=1).

That’s why linked transforms can be considered post transforms on steroids: they can also implement regular post xforms, but are free of any artificial limitations, making them an order of magnitude more powerful, but also much harder to use within a program that was designed without them in mind.

Imagine you’re happily fractalling in Apo, taking advantage of these enhanced post xforms, and then all of a sudden you realize that your entire construct of xaos paths has collapsed on itself because you dared to, um, add a transform (gasp!), so now all your linked xforms will happily assign a xaos value of 1 to this newcomer, because they don’t actually understand the abstraction they’re implementing for you.

In programming, this is known as a leaky abstraction; the program pretends to take care of some annoying low level stuff for you, but in practice you still need to understand exactly what’s going or or you will get randomly screwed up.

Aren’t computers supposed to flip bits for you, and not the other way around?

What if you had a different way of fiddling with the xaos paths of your flames? You could lay out and connect your transforms to each other in a completely freeform way. Instead of painfully working around the limits built into the flame algorithm or being forced to use the mess that is xaos in this regard, you could lay out the structure of your flame according to a graph, in which each transform is a node, joined to and from any other with connections of varying thickness (the xaos value), thus creating arbitrarily complex structures, with multiple post and final xforms, and structures of multiple xforms that can take the place of one.

These structures would then be translated down to a simple, xaotic representation (bad pun, I know), to be rendered by any fractal flame implementation that supports xaos. Currently, this is only Apophysis, but flam3, on which my app is based, is following suit with its 2.8 version (still under development).

This is the kind of thing for which I decided to change course and implement a standard flame editor before indulging in strange experiments that push the limit of current fractal programs. You need a solid base before being at liberty to go crazy with new ideas.

Advertisements

The Power of Simplicity

December 21, 2008

It’s way too easy to lose oneself in complexity, and forget that even the most simple things can be full of beauty, specially if we’re talking about fractals.
These fractal images have only 2 transforms, each with a single variation set at 1. And yet, despite being concentrated and distilled down to a mere 9 dimensions out of the hundreds available in fractal space, they still carry a huge amount of expressive power, displaying intricate patterns emerging from the simplest forms.

crossroads

void

rose

movement

julia

heart

glass

If you thought that was the absolute lower limit at which an aesthetically pleasing image can be achieved, think again. Single transform flames, unable to ever escape monochromatic space, are still able to produce some pretty impressive effects, although they’re dangerously close to the absolute lower limit.

one
Beauty is in the eye of the beholder of course, but for me at least, the technical challenge of these constraints alone has made the achievement worthwhile 😉


Xaos Tutorial

August 23, 2008

This is a tutorial on the new Apophysis 2.08 feature chaos, a.k.a. xaos.

So, what is xaos, exactly?

(If you already know this, feel free to skip past this section towards the more advanced stuff)

In the past, when rendering a flame in Apophysis, the transform used each iteration was entirely defined by a single value: Its weight in relation to the others. Imagine that each transform is a city. There are a certain number of tourists visiting the country, and they randomly travel between cities. The bigger a city, the more tourists it gets. This is how Apophysis has always behaved – until now.

With xaos, you get more information than just the city sizes of this mysterious country (let’s call it Flamia). You see, not all roads in Flamia are equal. Some roads are broader than others, making specific pairs of cities more strongly connected than others. Sometimes the road between two cities is underdeveloped or even nonexistent, forcing the tourists to go through intermediate cities first. With xaos, you control which roads to put more emphasis on, and in which directions.

A practical example

You should consider xaos on the same level as post and final transforms. It’s not the kind of feature that is able to create entirely new stuff, but used correctly, it can finetune your work significantly.

Now, let’s do a little exercise. Copy the flame below and paste it into Apophysis.

<flame name="xaos" size="250 250" brightness="4" gamma="4" >
<xform weight="1" linear="1" coefs="0.9 -0.3 0.3 0.9 0 0" />
<xform weight="1" linear="1" coefs="0.4 0 0 0.4 1 -1" />
<xform weight="1" linear="1" coefs="0.25 0 0 0.25 -1 1" />
<xform weight="1" blur="0.2" coefs="0 0 0 0 0 0" />
<palette count="1" format="RGB"> 6088AA </palette></flame>

As you can see, there are lots of circles, big and small, scattered around the image, created by transform 4. Why does this happen, when blur itself only creates a single central circle? The reason is that each transform interacts with every other one in the flame; it’s a fundamental part of how an IFS works. You can see how transform 4 would look like alone by checking “solo” in its color tab.

Until now, you had no way to control this behaviour. Adding a transform meant accepting all the changes it caused, good and bad. With xaos, that’s not true anymore.

Follow along

Let’s go back to our flame. Go to the xaos tab in transform 4, and make sure it’s in the “to” view. Set the path towards red to 0. Huh? Nothing happened. The reasons for this are a bit too complex to discuss right now, but bear with me for a second. Now, also set the path towards yellow to 0. There’s a clear change in the image now. What happened? The upper part of the fractal is created by transform 2 and copied into a semi circle by transform 1. You just eliminated all possible paths on which the blur could have reached that area. Note that this change propagates everywhere, making the upper lines of pearls dissapear in all little copies of the fractal, even the ones in the bottom half.

Ok, now reset the image (or just paste it in again). Let’s try to make transform 2 completely invisible. The first obvious step is to go to the color tab and check invisibility. But, this only removes transform 2 directly, not all the copies spawned by the rotated red one. Let’s see if we can fix that. Back in the xaos tab, set the path to itself to 0, ditto with the path to red. If you try deleting transform 2 entirely, you can see that what we did looks completely different. Any image you get with xaos and invisibility will always be a subset of the whole flame. It will also keep its self-similar fractal properties.

What now?

I could go on and on giving examples, but instead I suggest you play around a bit yourself. I chose this flame because of its simplicity, so that the effects created and their origins are clearly visible. Go and try this kind of effect on your own flames, and see what you can achieve. Only experience will let you navigate all these new possibilities in any coherent way, and knowing the advanced stuff is definitely worth it!

If you have any questions, feel free to ask. This tutorial doesn’t even come close to covering everything, it’s nothing more than a starting point for your own experiments. If you want to know more, you can also check out my explanation of linked transforms, which has some related info.


Linked Transform Tutorial

August 23, 2008

This is a quick tutorial on Apophysis 2.08 linked transforms.

Adding linked transform is an option you get when right clicking inside the xaos tab. The curious thing is that it doesn’t actually do anything. What I mean is that it just saves you a lot of clicks to build a common use case of xaos, nothing more.

Creating a linked transform basically splits your existing transform in two: the original turns invisible and is routed 100% towards the new one, which in turn is routed to the rest of the flame the same way the old one was (with a 0 towards itself). The new transform is only accessible through the old one, not from anywhere else in the flame. It also has a symmetry of 1, so that color is not affected.

This means that any point that lands on the old transform will be funneled through the linked one before being sent back to the flame. In that sense it acts just like a post transform, only that it has all the attributes of a “real” transform, such as adding post and linked ones of its own, changing colors, variations, xaos; the whole deal.

That’s it! there’s nothing more to this mysterious feature. Do keep in mind that adding new transforms breaks the entire linking structure previously created.

This is a bug in Apophysis, as the linked status isn’t recorded anywhere in the flame, but inferred by how the xaos paths relate to each other. Adding a new transform just steamrolls over this like it didn’t exist, while the linking itself is surprisingly self-aware. If you add a linked transform to an already linked one (doesn’t matter if it’s the linker or linkee), they will nicely build a single stack of transforms through which the random sample moves.

If you actually want to create a linked tranform on top of an already linked one independently of the original, you’ll have to build it manually. I’m not crazy enough to try that one yet… or am I?


It’s all about the filter radius

August 23, 2008

I’ve just realized that I’ve been using this very basic option all wrong. The filter radius setting in Apophysis applies a small blur to each individual pixel, helping smooth out jaggy edges and noisy areas (in some cases). But one fundamental thing I had failed to understand until now is that this setting needs to be directly proportional to your render size, regardless of how much you think the particular fractal you’re working on needs it.

The reasoning is simple: In a large image, typically used for a print, there are just too many levels of self similarity, too many little distractions everywhere, taking away from the whole rather than adding to it. These details reside at the sub-pixel level in normal render sizes, and so don’t get proper attention. But they do distract from the lines, texture and sense of direction in your piece. The opposite happens for thumbnails and smaller images, which tend to lose focus and crispness. Supersampling helps there, but it can’t work properly if you’re just blurring over it.

The rounding errors introduced by small buffer sizes tend to naturally blur the image. Counteract this effect (or lack thereof) according to your render dimensions.


What’s an Apophysis Power User (and how to become one)

August 21, 2008

A power user is one who, generally speaking, knows each and every feature a program has to offer. But Apophysis doesn’t even have that many, so what’s up with the term? Well, I have to give it a slightly different meaning in the context of fractals. An Apophysis power user is one who doesn’t only know what everything does, but also how it’s done. He’s not a victim of the chaos game, barely hoping to get something useful out of its depths. Knowing all the rules, riding the chaos wave, she bends fractals to her will – not the other way around.

If you’re the kind of person who’s never baffled by the program’s behaviour, who fundamentally gets how to build a grand julian without the need to look up a tutorial; if you make your images look exactly how you picture them in your mind – then, my friend, you may be on your way to become a true master of chaos. Have I reached that level? Hell no, but I’m well on my way. How to get there? It takes curiosity, persistence and curiosity. Did I mention curiosity? Never be satisfied with having things just work. Ask why. Ask how. Don’t be afraid of the math, everything’s much simpler than it appears at first glance.

If you’re there already, congratulations! Feel free to hang out, drop a comment once in a while, and be open towards discussing and learning new things. On the other hand, if you don’t believe you can reach that level, think again. I don’t have a perfect recipe, but if you stick around I’ll show you everything I know, little by little. That should give you a headstart.

To keep up wth this blog just grab a subscription. It’s free, of course, and comes in RSS and e-mail flavor.