C – Multiple particles for peak & trough
So I was thinking more about mathematical functions in two dimensions that give a nice smoothing, remembering the heat equation from university
So I took a completely different approach of calculating the brightness at each point in the grid based on some functions. This would be so much faster to run.
So I tried this with the simplest example I could think of. I created two types of particle for peak and trough. I could then calculate the brightness of each point just from its distance to the peak and trough particles. These should create natural bright and dark spots of varying shape.
The great thing is that several bright / dark spots then cluster and join together to create the natural sloping shapes I wanted. The repelling ring is purposefully larger so that particles can disappear in and out and this will create way more randomness by the constellation of particles chaging majority. Here the ratio is 5 dark to 8 bright, yet the image starys pretty balanced
That creates these final effects with fewer
and more particles
Next the biggest part was to create the right movement in the particle. without friction the particles are essentially accelerated by any repelling force. Hence the right level of friction needs to be added. This is hard to balance out perfectly since over time they will either accelerate or slow down more and more. By tracking their combined speed I could keep track of the overall movement / power in the system.
I wanted to add to the movement an element of random impulses. So sometimes they will slow down, then speed up again in a different direction. So I simply add random impule whenever the particles go below a minimum velocity. I then balance this with the level of friction and the size of the circle and bounce off of the outer circle.
D – all particles are created equal
Then I thought, can’t I just have all same particles, but they each have their own colour, which consists of hue, brightness, saturation. So fading between peak and trough would become fading between 0 and 100 brightness.
This could allow particles of different colours to create nice ranges of fading hues. But not luck, I had some problems with triangulating the values between more than 2 particles. Three particles showed some interesting results but the calculations were giving completely different results than what I was expecting.
E – flexible scale
So being the creative technologist I am I decided this would require much more maths I can work on later, as in the meantime I would like to build my lamp thank you. And the point of using a pi + processing is that I can change the animations easily later.
So I went back to the peak-trough which gives me smooth fields of 0 to 100. Now instead of applying these to just the brightness I can simply define colour scales just like in heatmap images or different topological / weather maps.
Also, as this is going to run on a raspberry pi, these calulations are way simpler to compute and will run better. As I am still anticipating a few speed/ smoothness issues with the final implementation.
Additionally I can really easily do things like reduce the size of spots of complete darkness. This will be incredibly useful as later I will have to adjust the colour scales to match the LEDs.
Finally, the best thing about this animation is that the drawing is just a visualisation for me to see the effect. With 2 extra lines I can turn off all the drawing functions and have it run the calculations only. This is a huge bonus for running it on the raspberry pi. Why not create these animations in python or so in the first place? Well because without the graphical result to judge and fine-tune the effects this would take infinitely longer. Best of both worlds if youre asking me.