Wednesday, 26 February 2014

Thinking Particles: Bullet: Cancerous growth

This is a Thinking Particles setup to create a cancerous growth like effect. It is made possible mainly due to how stable bullet is, allowing particles to spawn on top of each other without causing an "explosion" of the simulated objects.



Basic scene setup:

A box for the ground plane, a point that can be used to position the first particle, a spherical gravity to hold the particles together and a TP object.


Method:

The method involves having a parent particle which spawns two child particles at its position (after a random time has elapsed) before being killed. This leaves two particles in its place, which then under the bullet solver, spread out and these become parent particles that will go onto spawn their own children again. This creates a loop that will keep "dividing" the particles at an exponential rate.

Groups:

Active:
     All children in this group are subject to the forces and bullet.
Wait:
     Particles are in until timer is up and they are sent to divide. All particles are spawned into this group.
To_Divide:
     When sent to this group the particles activate the spawning of two new particles and its particle death.
Stop_Divide:
     Sent to this group once a particle number count is reached to stop particles dividing forever.

Dynamics:

Spawn_Initial:
     A single particle is spawned at the point in the scene. This is sent to the Wait group.


Assign_Shape:
     Where a shape can be assigned to particles. In this case i used a geosphere.


Wait_to_Divide:
     This takes the Wait particle and assigns it a random number between 25 and 90. When the particle age reaches this random number, it is sent into the To_Divide group.


Divide:
     The To_Divide particle spawns 2 particles with its position and alignment. It then dies after a time of 1 frame. If this was not here, there would be a frame before the new particles are born and after the To_Divide particle dies where there was no particle at all. The new particles are spawned into the Wait group, creating a loop between this and the Wait_to_Divide group.


Stop_Divide:
     This is an additional feature where the particles will be sent to the Stop_Divide group once the "Max Cells" count is met. This prevents the Divide group from spawning anymore, stopping the particle division. This is done using a PSearch with a very high max radius, as to find all particles in the scene. It checks the "Found Count" and compares it to the "Max Count" minus 2 using a threshold. If this is above the threshold it is sent to the Stop_Divide group.


The reason you subtract 2 from the "Max Cells" count is firstly you have to subtract 1 to compensate for the search particle not including itself in the count. Secondly, the threshold only triggers when it is over the value not equal to. So if your max count was 4, and there were 4 particles in your scene, it would not trigger as 4 is not above the 4 threshold (think count > 4, not count => 4). This is why another 1 has to be subtracted.



Forces:
     Where the spherical gravity is applied as well as spin and friction. The friction can be used to control how fast the particles "divide".


Bullet_Solver:
     Where the bullet solver is applied, and the floor plane added.


Active groups Bullet setup:

For all the groups under the Active group, I created a BulletPhysics parameter and set it to use a sphere shape. This is important. The sphere is very fast to simulate and very stable when spawning on each other. It also means you can have an assigned shape that is not a sphere and the TP would still work.


No comments:

Post a Comment