Skip to content
SpecializedSource checked

Reaction-Diffusion

Creates organic patterns by simulating chemicals that spread and react on a grid.

Quick Facts

Compact metadata for implementation and discovery.

Category
Procedural Generation
Difficulty
Advanced
Family
Pattern Simulation
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
2
Formulas
1
Relationships
4
Code example
Ready
Visualization
Ready

Overview

Reaction-Diffusion systems update chemical concentrations through diffusion between neighboring cells and local reaction terms.

Core Concepts

chemical concentrationdiffusionlocal reactionemergent pattern

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(cells)

Average

O(steps * cells)

Worst

O(steps * cells)

Space

O(cells)

When to Use

  • Use when organic texture patterns should emerge from local interactions.
  • Use when animal-skin patterns is a central requirement.

When Not to Use

  • Avoid when exact art-directable shapes are required.
  • Avoid when the generator cannot enforce the playability, connectivity, or style constraints required.

What It Does

  • Computes pattern simulation within Pattern Simulation workloads (O(steps * cells) time, O(cells) space).
  • Works by Creates organic patterns by simulating chemicals that spread and react on a grid.
  • Maintains key invariants across chemical concentration, diffusion, local reaction.

Use Cases

  • Animal-skin patterns
  • Organic textures
  • Generative art

Inputs

  • Chemical grids
  • Diffusion rates
  • Reaction parameters

Outputs

  • Patterned concentration fields

Key Formulas (1)

Gray-Scott update

Anext = A + (diffA · laplacian(A) − A·B·B + feed·(1−A)) · dt
A_next = A + (diffA * laplacian(A) - A*B*B + feed*(1-A)) * dt

Shows a common reaction-diffusion update for one chemical.

Pseudocode

  1. 1.Initialize chemical concentration grids
  2. 2.For each step, compute diffusion from neighbors
  3. 3.Apply reaction equations
  4. 4.Clamp or normalize concentrations
  5. 5.Render one concentration as a pattern

Canonical Example

Input
grid starts with small chemical disturbance
Output
pattern = spots after many steps
Explanation
Diffusion spreads chemicals while reactions amplify local differences.

Implementation Notes

  • Use ping-pong buffers so each update reads the previous state consistently.
  • Expose seed, scale, and constraint parameters so outputs can be reproduced.
  • Keep a tiny example with expected output beside the implementation.

Common Pitfalls

  • Large timesteps can make concentration values unstable.
  • Random-looking output can still contain repeated patterns, dead ends, or invalid regions.
  • Not defining boundary, empty, or degenerate inputs before implementation.

Interactive Mechanism Walkthrough

2D Grid Wavefront & Trajectory

Show spots and stripes emerging from interacting chemical fields.

S
#
#
#
#
#
#
#
G
Step 1 of 5: Initialize chemical concentration grids
generated-grid

Notes

Small parameter changes can switch patterns between spots, stripes, and noise.

Sources (2)

What each reference supports for this entry.

Turing Morphogenesis

Paper

Original reaction-diffusion reference for activator-inhibitor pattern formation.

Open source

Texturing and Modeling: A Procedural Approach

Book

Procedural texturing reference supporting Reaction-Diffusion noise, tiling, terrain, growth, or pattern-generation mechanism.

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Conceptual neighborCellular Automata

Both evolve grid states through local update rules.

Grid-based reaction-diffusion simulations often discretize differential equations with finite differences.

Tags

Procedural GenerationReaction-DiffusionSimulationCellular Automata