On Tuesday November 2, 2021, I’ll be releasing my long-form generative art project, Evolutions, on the Solana blockchain as a limited set of 1,024 unique tokens through the Flux Art platform.
Evolutions is a 10kb JavaScript program that generates flowing lines using millions of dots of colour. Each dot representing the path of an “agent” through time, simulating the behaviour of Physarum, a multinucleate organism. The hash of each token is randomly determined, and corresponds to a point in the multidimensional parameter space that encodes the behaviour of the agents. The agents all begin life distributed uniformly at random, either in a circle or across the entire canvas. As the simulation evolves over 400-600 frames, the agents move & chase each other’s trails.
Inspiration
The story of Evolutions began in April 2021 when a friend showed me a video of Slime Mould by Sebastian Lague on YouTube. As a Physicist with experience in agent based simulation, the Physarum model just captured me. The organic, hypnotic nature of the movement the model was capable of producing inspired me to begin coding straight away. My vision was to bring the natural, flowing movement from the Slime Mould videos into a static image that was variable & beautiful enough for a long-form style art project.
Coding began in p5.js since I wanted this to render in the browser & it’s always fun to learn a new language. This naturally set some limitations on the algorithm, namely that it couldn’t simulate more than 40,000 agents & took a few minutes to render.
I spent a vast amount of time trying to intuitively understand the parameter space of the algorithm and running 1000’s of simulations to see out how changing each parameter would affect the resulting image. It didn’t look great, but the potential was there & I kept tweaking the algorithm incessantly - I’m still catching up on my sleep debt :). But as someone who loves coding as much as creativity, Generative Art has been the ideal outlet for me.
Although I want people to interpret Evolutions in their own way, I’d also like to share what it means to me. To me Evolutions represents nature & the scientific process. How complexity emerges from simple rules, which are hard to discover when observing the finished output. A great Physicist once said:
“Poets say science takes away from the beauty of the stars — mere globs of gas atoms. Nothing is "mere". I too can see the stars on a desert night, and feel them. But do I see less or more?” - Richard P. Feynman
I couldn’t agree more, understanding how nature works & art is generated only enhances their beauty to me.
The Algorithm
So how does it work? Tens of thousands of agents, controlled by the population parameter, are scattered onto the canvas with random positions & directions (in cartesian or polar co-ordinates depending on the origin parameter). Agents are represented by very low opacity dots, the opacity is manually tuned depending on the foreground/background colour combination.
As the agents move they draw a dot in each position they visit, creating a ‘trail’. The classic Physarum algorithm would blend & fade these trails over time. To achieve more stable outputs & get the simulation to settle into a sort of equilibrium this was removed, so the entire history of the agent is recorded on the canvas (it’s just really hard to see sometimes).
Every frame, each agent looks straight ahead a certain distance & to the left/right by a certain angle, controlled by the horizon & perspective parameters respectively. Agents measure the strength of trails left by other agents at these 3 positions, across an area whose size is controlled by the precision parameter. Agents then follow a simple rule to move: they turn towards the area of strongest trail concentration (if it’s not already ahead of them), but turn randomly if trail strength ahead is lower than both the left & right. Turning speed is controlled by the nimbleness parameter and agents move one step forward in their new direction.
The parameters used for each token are completely unique & chosen uniformly at random from a continuous multidimensional distribution. I wanted to be principled & use a single master parameter range that the algorithm could sample randomly from, instead of searching for & then manually encoding completely distinct parameter sets.
Colour Palettes
Creating an aesthetically pleasing range of colours ended up being far harder than expected. The algorithm is very chaotic & hard to control, so agents can pass through certain areas in unpredictable ways. Working with extremely low opacity (2-10%) dots is also challenging and made it difficult to select colour palettes in a procedural way. The majority of colour palettes are hand selected with manually tuned the opacity, blend modes & colour to achieve a neon pop on the dark backgrounds.
As the agents move, their trails overlap & build up colour in certain parts of the image depending on the blending mode. So brighter or darker parts of the foreground represent areas that more agents have moved through.
There are around 45 hand picked combinations of foreground & background based on 50 unique base colours. I also had some fun initialising agents with a different colour based on their position by sweeping procedurally through Hues in the HSB spectrum, to create gradient like effects.
Provenance
Post-launch update. While my only personal inspiration was the YouTube video credited above, I’d like to explore the history behind the Physarum algorithm fully.
A number of papers on Physarum were published by Jeff Jones in 2009-2011. These apparently inspired Georgios Cherouvim to play with the algorithm, which was in turn picked up by Sage Jenson in 2019 who put together a GPU implementation of the algorithm. A number of YouTube creators & others picked up on this Sage Jenson work, in particular Sebastian Lague in who implemented the model in Unity for his Mar 2021 video. Having watched this video, I modified & re-implemented the algorithm using p5.js to target in-browser rendering.
Final Thoughts
I’d like to credit the whole generative art community for inspiring me to work on this project, particularly Sebastian Lague for his video & all the people who motivated his work. In turn, I hope that it inspires technical people who might not think they can be creative, to use their skills to explore the creative space.
It constantly amazes me that the variation between each output can be so vast, and I hope this is represented in the final 1024 pieces that are generated. I’m both excited & nervous to share Evolutions with the world.
Thanks for the thoughtful explanation. The Flux team are well placed to bring high quality generative art to Solana which is incredibly exciting given some of the challenges we all see on Ethereum. A project with great promise indeed.