Reaction-diffusion textures come from a set of coupled partial differential equations that result in appealingly cellular, organic solutions.
Turk[Turk1991] quotes these as Turing's original [Turing1952], discrete 1D reaction-diffusion equations, which relate the concentrations of two chemical species and , discretized into cells and .
Here is the reaction rate parameter, and are diffusion rate parameters, and is a decay parameter for . We can interpret as a chemical, generated in barren regions, that is consumed to produce chemical . naturally decays, with an even higher decay rate where the concentration of is large. Both species diffuse, but normally diffuses faster than .
Turk recommends of approximately 12, but picks a random slightly different value for each cell. We note nicely random results can be obtained even with fixed parameters by randomly varying the initial conditions--we found favorable results using initial values for and randomly distributed on the interval . Turk recommends a diffusion rate of (the reaction-free stability limit) and . We find these parameters work well.
We note that the equation for is unstable if is negative. Since negative results can occur because of the fixed decay factor, must be clamped to zero or the solution grows without bound.
We can easily derive the multidimensional and continuous--in both space and time--version of Turing's reaction/diffusion equation. Note that we have generalized the fixed growth constant 16 to .
Here is the reaction rate parameter, and are diffusion rate parameters, is a growth parameter and is a decay parameter. We always use the values , , and , since these values result in spatial features that are a few units across.
In practice, we must (re)discretize this continuous set of equations in both space and time in order to solve this system. Using the first-order Euler method, this recovers Turing's original discrete equations--that is, these continuous equations can be seen as a way to derive consistent parameters for the discrete equations. For a timestep of , . For a uniform mesh size , in 2D and similarly . We of course always choose as large as possible--the theoretical diffusion stability criterion requires ; and the nonlinear reaction rate also has some limit, which appears to be near .
The advantage of using a continuous formulation is that we can take advantage of the powerful tools available for quickly solving partial differential equations, such as the multigrid method. For small grid spacings and large domains, multigrid can dramatically accellerate convergence, as illustrated in Figure 1. We find the coarse-to-fine direction of multigrid to be sufficient--no reverse restriction is required.
| ||||
Figure 1. Illustrating the dramatic speed advantages of multigrid on a 1024x1024 domain with a grid spacing of . concentration is shown in red; is shown in green. |
The character of the solutions to this equation depends strongly on the ratio , as illustrated in the parameter map below. Interesting, spatially varying results only appear for near one. Larger values over-active, which results in dominating; while smaller values fail to achieve a self-sustaining quantity of , which results in unstable pulsating patterns. In the remainder, we fix at 20 and vary the growth rate between 17.5 and 27.5, as shown in the dark box.
|
Figure 2.Parameter map for growth and decay parameters. The growth rate varies along the X axis from 0 at the left edge to 30 at the right edge. The decay rate varies along the Y axis from 0 at the bottom edge to 30 at the top. |
| ||
Figure 3.Varying growth parameter according to a photograph for a bizarre effect. |
Globally illuminated scene without texture. |
Illumination on ground plane. |
Growth rate derived from illumination. |
Grown texture. |
Grown texture, recolored. |
(900K MPEG Movie, 320x240) Scene rendered using grown texture. |