• Login
  • Register

Work for a Member company and need a Member Portal account? Register here with your company email address.

Project

On Reaction-Diffusion

Char Stiles

3 quick projects using reaction-diffusion 

Reaction-diffusion is a readily used tool in the generative computer artists' tool belt. I am very fond of the algorithm, because every time I am reminded by the bizarre, but undeniably memorable way that mathematician J. D. Murray described it:

...consider the following, albeit unrealistic scenario, of a field of dry grass in which there is a large number of grasshoppers. If grasshoppers get warm, they can generate a lot of moisture by sweating. Now suppose the grass is set alight at several random points and a flame front starts to propagate from each. We can think of the grasshopper as an inhibitor and the fire as an activator. If there were no moisture to quench the flames, the fires would simply spread over the whole field, which would result in a uniform charred area. Suppose, however, that when the grasshoppers get warm enough they can generate enough moisture to dampen the grass so that when the flames reach such premoistened areas the grass will not burn.

I always find it as a handy algorithm to go to when I am in a hurry to get something out. For example, when Future Sketches was offered a room to fill up in Zach Lieberman's Future Sketches / Code Poems show in Miami Artechouse, we agreed that it would be a good idea to have a couple interactive pieces in there, including a sort of "mirror" type art piece, where its a vertical screen and a camera augments the feed in front of it, so the experience is like walking in front of a magical mirror. I like to call it the bread and butter media art experience! Its quick to whip up and people know what to expect, and each get a unique experience!

I think of these pieces as a fun way to get something up and running quickly! I combined reaction-diffusion mixed with cyclic cellular automata in all written in OpenFrameworks. Cyclic cellular automata was added to create more dynamics to the system. Its similar-ish to reaction-diffusion and sometimes they can look the same, but cyclic cellular automata uses discrete rule-based cells to create patterns instead of partial differentiable equations in continuous space.

I showed it again with some slight changes in the algorithm to make it more subtle for members week.

Another instance where I needed to get something up quickly was for a website for people to register for Media Lab's student run party, called 99 Fridays. The organizer was scrambling a bit and asked me to make a website for people to register a week before the party was supposed to happen. I was up for the challenge, because I knew the perfect thing to do given the theme of "Gender Fluid Dynamics": a fake interactive fluid simulator using reaction-diffusion! I spun up a website with a webGL shader and tweaked the reaction-diffusion parameters until I got this undulating liquid-looking system. The whole website took 3 hours to get up and running (not including the break I took in the middle).

 I liked how the mouse interaction felt, as if it was the reactant in the diffusion. So I decided to make a few different mouse interactions using reaction-diffusion. 

I started with a simple sketch, similar to the 99Friday website:

I had some fun messing around with it mindlessly, like a digital fidget toy.

I wanted to play with what the mouse is and the behavior of the system. Here is an idea I had of making a smoking crosshair. I achieved the effect of the system traveling upward but tweaking the function that retrieved the previous frame to seed the next frame, but I nudged the y coordinate up a bit.

Here is some unpleasant trash. With both of these I used a clamp function to  only highlight the changes in the system, to create the fading effect. 

As with many graphical systems when you "mess up", the outcome is still beautiful! Unexpected but beautiful. Here is a small gallery of the unstable systems I documented.

I tweaked the parameters to create an unstable system that looked more fiery, added a small gradient between a deep red-orange to red, combined with the y offset to get this fiery gesture. 

Through tweaking the parameters you can get a wide variety of expressions and gestures out of the algorithm! 

This was not the first time and it will not be my last time using reaction-diffusion in my work!