Saturday, April 24, 2010

Growing Plant Experiments

I experimented with Python and Box2D in the past week and wrote my first self-replicating cell plant simulator. The results are in 2D, but they gave me a sense of direction.

This one was produced in a zero-gravity environment. The plant was created by having a "driver" cell at the top split into three cells, two static ones and a third new "driver". All cells would be glued through trusses made of distance joints, which is the lines you see. Each joint would grow linearly over time, and get bigger and bigger until it reaches a treshold.

Occasionally, a driver cell would split into two driver cells, forming branches that continued to grow on their own.

I was fairly happy with the above solution, but distance joints don't have a collision boundary, so it was possible a plant could grow into itself, or the truss would misalign.

Here is an example of a plant with weak, misaligning trusses, and trusses that grow back into themselves. Also zero gravity, with a low resonant frequency for distance joints.

This is the first experiment with gravity. Here I'm using the cells themselves to build a structure, without using trusses to expand the space. Each cell divides into two cells properly, but some cells don't divide (30% chance) and just keep growing. The cells are not connected. I made the observation that large cells tend to cluster at the top, while small and replicating cells prefer to stay close to the ground.

Now I'm splitting each cell into two at steady time intervals, and connect both new cells with all previously connected ones through distance joints. This time, heavily stretched distance joints will be removed. After a few iterations, this optimal triangle formation can be observed.

A few iterations later. You can see that the limited space for the growing structure contracts the joints (red), and a few cells overlap. All in all, the resulting structure is more close to a tumor.


I like the growing cell approach more, but I have no idea yet how to make them take on a specific shape.

Also, the resulting formation is a lot more rigid, but it should be flexible. Bullet, the engine I plan to use for the 3D conversion, supports soft bodies, so it's likely I'll use a soft body variant.

At some point, these structures need to be skinned, that is: a surface has to be generated from the cell point set. I have no idea how to do that, either.

1 comment:

  1. Skinning: How about scripting Blender to do that?