This video is a result from trying to adapt the idea of an Orbits-based fractal formula to the processing context of Reaction-Diffusion. I wrote this formula from scratch relying only on Ready's built-in Laplacian (ie formula-mode) code. Thankfully the complex logarithm function is built-in and I didn't even have to reimplement that to make this work. Later, I adapted the idea to the Nova Fractal formula too, which has also led to some interesting results.
Here is the description of the formula from the Orbits rule-file:
This is a Reaction-Diffusion formula that uses an iteration step implemented to treat reagents a and b as a complex number (a+bi) and raise it to a power. Inspired by what a normal orbits-fractal (for example: Julia, Mandelbrot) step does.In this formula the 'a' and 'b' reagents in the simulation are treated as the real and imaginary components of a complex vector, which is both diffused (~blurred) and anti-diffused (in other words, sharpened) by various amounts - and then raised to a complex power, akin to the Generalised Mandelbrot/Julia Fractal formula.
I added quite a few parameters that can be used to adjust the various parts/stages of the usual Orbits-fractal formula. Some of these controls might not make much mathematical sense, but they are what ended up helping the most while tweaking to make interesting patterns. There is certainly much more to explore in this area!
The following are the parameter names for the formula, and their interpretations:
- Clamp Min : The minimum value that Real (a) or Imaginary (b) will be clamped to.
- Clamp Max : The maximum value that Real (a) or Imaginary (b) will be clamped to.
- Const Real : The Real part of the complex constant offset in the Mandel/Julia formula.
- Const Imag : The Imaginary part of the complex constant offset in the Mandel/Julia formula.
- Const Real Inner : Real offset for the intermediate mag+phase reagents.
- Const Imag Inner : Imaginary offset for the intermediate mag+phase reagents.
- Real Power : The Real part of the complex power in the Mandel/Julia formula.
- Imag Power : The Imaginary part of the complex power in the Mandel/Julia formula.
- D a : Real (a) diffusion amount.
- D b : Imaginary (b) diffusion amount.
- UnDa b : Sharpen Imaginary (b) using diffused Real (Da).
- UnDb a : Sharpen Real (a) using diffused Imaginary (Db).
- Mag Amp : Multiplier for complex vector length intermediate reagent Mag (c).
- Mag Power : Power for complex vector length intermediate reagent Mag (c).
- Mag Zero Pt : Value offset (add) for complex vector length intermediate reagent Mag (c).
- Phase Offset : Value offset (add) for complex vector angle intermediate reagent Phase (d).
- Phase Amp : Multiplier for the complex vector angle intermediate reagent Phase (d).
- E Const : The value to use for the mathematical constant e, when computing complex-power (default is close to e's actual value).
- C Display Offset : Post-add value to Mag (c), for display/recording purposes (does not affect the simulation).
- C Display Mult : Post-mult Mag (c) by value, for display/recording purposes (does not affect the simulation).
- D Display Offset : Post-add value to Phase (d), for display/recording purposes (does not affect the simulation).
- D Display Mult : Post-mult Phase (d) by value, for display/recording purposes (does not affect the simulation).
c = pow((a+constRealInner)*(a+constRealInner) + (b+constImagInner)*(b+constImagInner), mag_power) * mag_amp + mag_zeroPt;
d = atan2( b+constRealInner, a+constRealInner ) * phaseAmp + phaseOffset;
delta_a = clamp( timestep * pow( c, realPower) * pow( eConst, -imagPower*d ) * cos( imagPower * log( c ) + realPower * d ) + D_a * laplacian_a - unDa_b * laplacian_b + constReal, clampMin, clampMax );
delta_b = clamp( timestep * pow( c, realPower) * pow( eConst, -imagPower*d ) * sin( imagPower * log( c ) + realPower * d ) + D_b * laplacian_b - unDb_a * laplacian_a + constImag, clampMin, clampMax );
c = (c + cDisplayOffset) * cDisplayMult;
d = (d + dDisplayOffset) * dDisplayMult
In the first two lines of the formula (ignoring wrapping if it is present above), values are computed for the 'c' and 'd' reagents that represent (respectively) the magnitude and phase of the complex value a + ib. At this point the 'amp' and 'phase' adjustment controls are applied to the computed values as well.
The magnitude (length) and phase (angle) of the complex vector are only intermediate steps in an orbit computation. They could have been implemented as ephemeral variables (and not take up a whole reagent field), but I've found that having these two values around can be quite useful later on, for example when making direct use of the recorded voxel values - so I have (perhaps wastefully?) left them in as full fields, on purpose.
On the next two lines the main Orbits-step is taken by computing the change-in-a (delta_a, Real) and change-in-b (delta_b, Imaginary) values, using the mag/phase decomposition of the previous complex-valued state. Regular Mandel/Julia-style complex offset and power settings are applied in this step too.
I added offset and mult controls for the 'c' and 'd' reagents for display and recording purposes only. These are applied in the last 2 lines. This part of the formula is really more about adjusting for the way that Ready displays reagents (or more particularly how it renders an image of them,) than anything else. This part can safely be ignored in terms of what the main formula actually does.
After implementing this, I verified that I had implemented the fractal formula correctly by pre-initialising the reagent values to a part of the the complex plane that includes the usual fractal shape, in other words, with ranges around -3.0 to 3.0:
- Reagent u (a) = scaled x-co-ordinate
- Reagent v (b) = scaled y co-ordinate
Once I had made sure that the formula was working I went exploring, somewhat randomly in its parameter-space, without regard to whether it still produced the usual fractal shape. I found several quite interesting things along the way, one of which resulted in the video above. Some parameter settings produced patterns quite analogous to things that you might see whilst exploring other well-known RD formulas, and some were reminiscent of other things, but different in an interesting way.
Some of the most interesting patterns have included soft travelling wavefronts (not entirely dissimilar from well-known other RD spiral waves, such as those seen in Complex Ginsburg-Landau Reaction Diffusion). A distinguishing feature being that the waves 'break' in an interestingly-shaped way as they travel. I suppose responding to some obscure underlying mathematical facts about how complex numbers behave when they are modified in feedback like this.
Here is a recent recording of one of these:

No comments:
Post a Comment