Lenia is a family of cellular automata that produces lifelike behaviors and patterns, first described in the seminal paper by Bert Wang-Chak Chan. This project is heavily inspired by the original Particle Lenia research by Alexander Mordvintsev et al., which implemented a particle-based version of Lenia in Python and JAX. Recognizing the importance of scale (number of particles) for simulation dynamics and iteration times for rapid pattern exploration, I ported the simulation to the GPU and made it 3D. I also added several update kernels in addition to the original Gaussian one and programmed in support for multi-species particle simulations which opens up a whole new breed of Mathematical Lifeforms, some that behave very reminiscent to critters found in Particle Life.
This port was achieved using compute shaders within Three.js and the (still unofficial) Three.js Shading Language (TSL). You can explore the Particle Lenia universe yourself at the bottom of this post on the condition that your browser supports WebGPU and you have a graphics card with enough muscle to crunch the numbers. The source code for the Particle Lenia implementation can be found here, go wild.
A too short intro to Energy Fields and Particles in Particle Lenia
The energy field is defined as
where is the repulsion field and the growth field (typically generated by two different convolution kernels). Particles follow the motion law
i.e. they drift toward lower energy by simultaneously minimizing repulsion and maximizing growth . The rich behaviors you see are purely emergent from these local interactions and, to a lesser extent, the choice of kernels (the Mexican-Hat kernel is a personal favorite).
If you’re interested in the math, I encourage you to read the exposition in the original Particle Lenia paper. It only requires that you understand what a ‘gradient’ is (ask an LLM) and how to apply the chain-rule for finding the differential equations.
Gallery
Click on any image to view it in full size.
×❮❯