Here is a follow-up on the flocking-experiments that I posted before.
Last time, all forces were created from the boids themselves by influencing each other. I started to add external forces now with which I hoped to get a little bit more direction into the simulation. These are the results of the first test.
The force I added is based on an input image. Before I start the simulation, I calculate the gradient on each pixel and store that in an internal data-structure. When the simulation is running, whenever a pixel is hit, I lookup this gradient, find a vector orthogonal to it and let the boid move in that direction. The resulting images and simulations can be seen here :)
So far this is highly experimental. I try different parameters, different input images and different colors. If you have suggestions, leave a comment :)