Hyphae simulation

I've started work on a simulation of fungus-like hyphae, based on project I saw called Mycelium.

My simulation, starts with a single growing point. This point is has a speed, a direction, and an curvature. In each iteration, its direction changes based on its curvature and its position changes based on its angle and speed. At the moment its speed is fixed. Then the pixel it is current on is coloured in. Each iteration, there a probability of its curvature changing and or it splitting into two growing points (each with an angle 45 degrees to the parent's, and with opposite curvatures). Then the two points continue independently.

Below is a video of my first attempt, which only took about an hour to code, most of which was spent playing with the parameters.

Below is a slight update, changing the colours, and making the hyphae translucent, so points that overlap are brighter:  

There is a lot of scope for improvements. I need to have some way to kill growing points, ideally based on a lack of food (i.e. high density of hyphae). You can see that by the end of the video, the simulation is slowing due the the exponential growth of growing points. I'd also like to try using an image to represent food. It might be fun to evolve the parameters, such as splitting probability, but I'm not sure what  fitness function would be suitable, perhaps one to maximise the coverage of screen.


Any chance you can share the code?

Hey this is a cool idea! Nice work! I've been working with genetic programming and would like to merge it with something like this. Could you post the source or email it to me?

If you email me via the Contact Me button on the left side of this page, I can email you the code.

Hi Peter I am a student doing master of architecture in Hong Kong. I am studying on the growth of mycelium and wonder if you mind sharing or giving me hints on how to code that. It is really amazing and I have no idea how to start. Hope you can help! Thanks

Post new comment

The content of this field is kept private and will not be shown publicly.