Reaction-diffusion simulator

Simply put, reaction-diffusion refers to the underlying reaction and diffusion processes of a chemical. Reaction-diffusion processes are generally modeled by systems of partial differential equations (PDEs).

Details

Very rarely is a system of PDEs able to be computed analytically. Instead, one must resort to a numerical approximation. There are various methods for numerically approximating systems of PDEs, but for this project I used Euler's method to keep things simple. Despite how simple this method is, it produces surprisingly robust results. In addition, it is trivial to parallelize: I implemented a compute shader to carry out the calculations, which means it runs entirely on the GPU. Even on a relatively old GPU, it is capable of carrying out calculations on a full-screen grid in real-time.

Visualization

I went a little overboard on this project, because I thoroughly believe this is the best way to truly learn about things. I implemented numerous reaction-diffusion models, each with its own set of user-specifiable parameters. I also implemented custom palette support. Both the models and palettes are implemented in a modular, extensible way so that new models and palettes can be added without having to rebuild the program. I also briefly experimented with R3 reaction-diffusion models, as can be seen in one of the videos below. Like most of my programs, I implemented support for 3Dconnexion's SpaceNavigator mouse, which allows interactive translation and rotation on all 3 spatial axes.

The user can perturb the grid by drawing on it, and also change color palettes during the visualization:

One of the shader modes applies vertex displacement to a mesh in R3 based on the chemical values:

Visualizing R3 reaction-diffusion models:

I implemented support for real-time sampling of chemical values; they move around with the grid even as the user rotates it:

Reaction-diffusion

Another example of the R3 mesh view:

Reaction-diffusion

Reaction-diffusion

The user can adjust model parameters in real-time:

Reaction-diffusion

Another demonstration of the sampling boxes:

Reaction-diffusion

Reaction-diffusion

Perturbing the RD grid with a real-time musical waveform:

Reaction-diffusion