Here's an interesting twist on a regular reaction diffusion simulation: coupling it with a fluid dynamics system.
Despite my best efforts, I haven't been yet been able to successfully port my go-to ActionScript CFD libraries from Oaxoa to AGAL, so for this piece, I've used ActionScript workers. I used my existing Workers Gray Scott demo and plugged in the CFD worker from my CFD and Box2D demo.
The code alternates through a reaction diffusion step then a fluid dynamics step. When each has completed it sends the data to the renderer which renders simultaneously while the next step is calculating (so each render is based on the reaction diffusion solution then the fluid dynamics solution then the reaction diffusion solution and so on).
The shared property between the two systems is the u species which is passed to and from the fluid dynamics system as the density.
The fluid dynamics takes a little longer to calculate than the reaction diffusion, so on slower machines it can appear to stutter. For the video above (which uses the Smoking Solitons preset), I took a screen recording and used After Effects to smooth it out (I also used the Tritone filter to jazz up the colours).
I've added a toggle switch to the UI to switch between the coupled reaction diffusion / fluid dynamics or just the reaction diffusion or just the fluid dynamics. The final application looks like this:
One thing I've noticed is that it runs abysmally under my debugger version of Flash Player. On my machine, using the non-debug PPAPI player under Chrome works fine.
The application lives here and the source code is available here.
And to wrap up, here's another After Effects treated output of spooky alien neon loops. Easily replicated with the parameters {k: 0.009, f: 0.132, dU: 0.209, dV: 0.022}.
Add a comment