Friday, September 12, 2014

Reaction Diffusion Fractals

Previous work with fractal automata has the disadvantage that it lacks continuous rotational symmetry (it also lacks continuous translational and scale symmetry). An interesting idea is to instead work with reaction-diffusion systems which are already continuous in rotation and translation symmetry, and try to add scale symmetry. The normal formula is as follows (and is explained in the link above):

Scaling Du and Dv scales the size of the patterns formed, it seems that the pattern size is proportional to the square root of this scale. Therefore we choose to scale by t2 where t is our scaling factor.

Next we change all of our variables to be vectors rather than scalars. This represents a list of independent reaction diffusion systems. We then choose vector t to be (1,t,t2,....), in other words the difference between each reaction diffusion system is a geometric increase in scale. If we view the first three components of v in the red,green and blue channels respectively, then the result is simply a superimposed set of three reaction diffusion systems (using Du = 1, Dv = 0.5):
Here the red scale is the smallest, the green is noticeably twice the scale, and blue twice again.
The final ingredient is to have these separate scales interact with eachother, we do that in the reaction part of the formula, which is the uv2...
each u is reacting with two vs, we replace the v vector (v for each scale) with a weighted average of all the vs where the weighting is an exponential dropoff s|x| around each component. Effectively the vector v has been convolved with an exponential dropoff function, or low pass filtered. This gives us an extra parameter s, when s=0 we have no interaction like the image above, s=1 gives equal interaction which prevents any separation of the different components. Values in between are interesting.

Here we choose a small value of s = 0.05. t = 0.5 so we double the scale of each component (red,green,blue). I plot the reaction diffusion system with varying parameters F and k on the horizontal and vertical axes respectively (increasing right and up). 
zoomed out

s=0.05. zoomed in slightly. Varying the parameters in x,y shows the different patterns possible.
Next are with s = 0.1. The three components are more correlated. Notice that the thin bridges are more red (small scale) and the large areas more blue. 

zoom around 0.027, 0.058, range 0.08

zoom around 0.026, 0.057, range 0.04

zoom around 0.023, 0.055, range 0.02

zoom around 0.023, 0.051, range 0. (unvarying in x,y)

similar area, unvarying parameters. Notice the similar worm shapes at each scale.

The system does not require the scales are doubled for each component, here we show a zoomed out image for t=0.7, so green is roughly 1.4 times the width of red.   
In fact the results are an approximation of a continuous scale symmetry as t1 from below. Make sure to change the dropoff to s|x|log2(1/t)


  1. Do you have the source for this posted anywhere?

    1. unfortunately this seems to be code that I no longer have. But the concept is very simple so would be easy to code up, perhaps using a shader this time for speed.

  2. You wrote "The final ingredient is to have these separate scales interact with eachother, we do that in the reaction part of the formula, which is the uv2...". Would it make sense for the interaction between scales to instead be in the diffusion part of the formula, i.e, make the Laplacian include cells from the neighbouring scale levels?

  3. Hi Claude, I think that would make sense, I haven't tried it, but that sounds like something definitely worth a try.