MEGAN RIEL-MEHAN
  • Home
  • Science Visualization
  • Research
    • Initial findings
    • Image processing
  • Civic Tech
  • Fine Art
  • News
  • Methods and Notes
  • CV and Resume

Conditional Control of Clones

7/14/2015

0 Comments

 
The goal of this set of experiments was to be able to control the position or movement of a single clone within a MoGraph Cloner. The system I had in mind when I started these tests was a ligand binding to a substrate, but it could be applied to many different systems. 

1. Attractor Field with Random Effectors  
The attractor field gets a lot of the work done, and for many cases, this set up is all you need. I have simulation tags on both the clones and the sphere, and an attractor field with a falloff as a child of the sphere. 

To achieve the movement I have in this video, I created two Random Effectors, one with small displacement and one with very large displacement. The problem with the Random Effector is that each clone is never going to be able to truly change it's position (to my knowledge). It's not as obvious in the example above, but when you color the clones, you can see they never mix. 
This is a comparison with the random walk system I made and explain in section 3. In this example the clones with the Random Effect are able to move 100 cm in two directions, but they never actually mix, as you can see by the gradient, since they can never escape their original position. 





2. Plain Effector and a MoGraph Selection Tag (still with Random Effectors)
In this next example I used xpresso to conditionally add clones to a MoGraph Selection tag based on their distance from the Sphere, and then used a Plain Effector to change their position. In this case I targeted their position to the Sphere, but what separates this from the Attractor field example is I can use the Plain Effector to change location in just one direction, like 50cm in the x, instead of all being attracted to the same point. 

Here's the important aspects of this setup: 
  • I added a MoGraph Selection tag to the Cloner, and with that selected I made a Plain Effector, 
  • Changed the Transform Mode to "Absolute" and the Transform Space to "Effector", changed Position to 0,0,0  
  • Made the Effector a child of the Sphere. 
Picture

Here is my xpresso setup. 
  • It iterates through all the clones, and the MoGraph Data node passes the position vector to the Distance node, which calculates that clone's distance to the sphere. 
  • The Compare node is set to "Vector", "<", and Input2 is 40. 
  • If the Output is 1, then the MoGraph Selection node adds it to the MoGraph Selection tag. 

You could of done this with just a Python node but I thought this was visually more comprehensible. 
Picture
The downside of this setup is it still lacks a true random walk, and I still can't explicitly control a clones position independent of all the other clones, whatever I set the Plain Effectors Transform parameters to their going to be applied to all the clones in that selection. Enter the Dynamic Body State Node (!).

3. Dynamic Body State Node
It drove me nuts that the MoGraph Data node didn't have position as an input port option, but I discovered the Dynamic Body state Node does, and so much more. The "Object" for the input port is the object that has the dynamic tag on it (Dynamics must be turn on), so in my case it was the cloner. The first version I did of this I just tried to recreate the setup I have in the previous examples. You can use the Dynamic Body State node to change the position of a clone, but if you do, it overrides the collision calculation, so your clones will end up intersecting. So I used the "Add Force" and the "Linear Velocity" inputs.  I did two different versions, the first one the random walk vector decreases as the cubes get close to the sphere, so they can't come back off the sphere very easily. 

def main():
    global randwalk
    global field
    spherev=spherepos-clonepos
    if (frame+index)%5==0:  #so that every clone does not change direction every frame
        newclonepos=randvector*steplength
    else: newclonepos=currwalk
    if dis< mindis:
        pos=dis
    else:
        pos=mindis
    randwalk=newclonepos#*pos/mindis #2nd term reduces their chance of escaping
    field=spherev*(-pos/mindis+1)   #linear falloff



You can download the file to make this video:
xpressorandomwalkwithdynamics.c4d
File Size: 276 kb
File Type: c4d
Download File


Nested Iteration

I then set up a nested iteration so that I could add any number of clones of spheres as well. This enables you to change the number of either clone on the fly and the setup still calculated the attraction appropriately, as you can see in the video below. 
Picture

I made two user data settings, the step size of the random walk, and the distance the cubes start being attracted to the sphere, which is represented by the disk around the sphere below. In this example, I first increase the size of the random walk, and then increase the size of the field. 
I experimented a lot with the different input ports for the Dynamic Body State node, and this setup works well, but if you watch the upper right sphere in the video it seems to attract the cubes more strongly. I've tried rotating the clones and changing the count, so I'm pretty certain it has to do with the Object Index, which makes me think the iteration isn't working exactly how I expect, I would love any insight on that. I also think there is a more elegant way to get a random vector, I just initially saw some bias in the simulation when I had the Iteration going direction into the Random Seed, and it's my understanding that sequential random seeds have similar random tables, so I used a noise node to get a different Random Seed. 
Hope you enjoy!
dynamic_state_node_0002.c4d
File Size: 342 kb
File Type: c4d
Download File

0 Comments



Leave a Reply.

    Even though I no longer do bench work, I find the practice of recording "experiments" and notes to be helpful in keeping my thoughts and projects organized.  I also hope other people find useful things in here too. 

    Categories

    All
    Animation
    Cell Crawling
    HBV
    Heroku
    PGRN.org
    R
    Web Development

    RSS Feed

Download CV
Contact me:
  • Home
  • Science Visualization
  • Research
    • Initial findings
    • Image processing
  • Civic Tech
  • Fine Art
  • News
  • Methods and Notes
  • CV and Resume