Parallelizing Cellular Automata with WebGPU Compute Shaders
11 hours ago
- #webgpu
- #cellular-automata
- #parallel-computing
- Cellular automata (CA) are systems where simple rules generate complex, emergent behavior, formalized by John von Neumann in 1948 and popularized by Conway’s Game of Life in 1970.
- CA are inherently parallel, making them ideal for GPU acceleration using WebGPU compute shaders.
- Conway’s Game of Life is the most famous CA, with rules based on neighbor counts determining cell survival or death.
- Life-like CA generalize Conway’s rules, leading to diverse behaviors like self-organization or chaos (e.g., Anneal CA with rulestring B4678/S35678).
- Larger-than-Life CA expand neighborhood size and introduce cooldown states, enabling more complex interactions (e.g., Bosco’s Rule: R5,C2,S33-57,B34-45).
- Von Neumann and Moore neighborhoods define cell interaction ranges, with Von Neumann using Manhattan distance for a diamond-shaped search area.
- Multiple Neighborhood CA combine distinct neighborhoods (e.g., inner and outer rings), creating biological-like structures.
- Cyclic CA use multiple states (e.g., 7 states) and advance based on neighbor thresholds, forming stable, repeating patterns.
- Continuous CA (e.g., SmoothLife, Primordia) use floating-point densities for smooth transitions, unlike discrete CA.
- Primordia measures local cell density and adjusts growth/decay based on thresholds, producing fluid dynamics.
- WebGPU enables real-time exploration of CA by leveraging parallel computation for efficient rule evaluation and rendering.