PySwarm for PyCarrara (V0.6) Released 01/25/2013

16791112

Comments

  • DartanbeckDartanbeck Posts: 21,549
    edited December 1969

    I am working on a scene where I have placed a number of BOIDs in a group, and after animating them with a PySwarm script, I am also animating the group by moving and rotating it, which causes the BOIDs to move and rotate accordingly.

    FD

    Whoa!
    I think that I'm getting closer to the day that I get to play with PySwarms, and I am really looking forward to it. I'm also hoping to test out PyCloid too.
    Thanks to both you and Frederic Ribble!
  • 0oseven0oseven Posts: 626
    edited February 2014

    Thankyou ! Very informative and once again we learn more of PySwarms's capabilities. I think this has answered something that has puzzled me recently.I sometimes get an error message when importing a script which reads something like " cannot find boid /F161**** " when my boids are named F161 F162 etc. The slash may indicate something to do with groups ?

    My boids for these tests are aircraft sometimes with several nested groups of components Plus I"m experimenting with placing them into an animation group ( which creates a NLA track)

    I"ll wait until your update is released before posting more queries.
    cheers

    teaser test - section pyswarm animation with nla clip applied (for the roll) sound on

    http://youtu.be/AGGckYtkoLo

    Post edited by 0oseven on
  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Whoa!
    I think that I'm getting closer to the day that I get to play with PySwarms, and I am really looking forward to it. I'm also hoping to test out PyCloid too.
    Thanks to both you and Frederic Ribble!

    Still looking forward to what you have in mind!

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    0oseven said:
    Thankyou ! Very informative and once again we learn more of PySwarms's capabilities. I think this has answered something that has puzzled me recently.I sometimes get an error message when importing a script which reads something like " cannot find boid /F161**** " when my boids are named F161 F162 etc. The slash may indicate something to do with groups ?

    My boids for these tests are aircraft sometimes with several nested groups of components Plus I"m experimenting with placing them into an animation group ( which creates a NLA track)

    I"ll wait until your update is released before posting more queries.
    cheers

    teaser test - section pyswarm animation with nla clip applied (for the roll) sound on

    http://youtu.be/AGGckYtkoLo


    Post queries ANY TIME! Asking questions is great feedback and helps me find blind spots in my thinking.

    To be precise, the "/" symbol is how PyCarrara finds objects in the Carrara scene. PySwarm handles the first "/" internally.

    Very nice test scene! I can't wait to see what you have in store for this!

  • DUDUDUDU Posts: 1,945
    edited December 1969

    Hi FD,
    I (finally) installed the v0.6…
    I made some tests with the zones of containment with objects, there are many possibilities.
    There are two things in connection with the PIA:
    1- When I edit an existing project and if I rename it, then, all the data go back by default (and it is necessary all to start again).
    2 - Would it be possible to import an existing script in the PIA ?

    Thank you.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Hi FD,
    I (finally) installed the v0.6…
    I made some tests with the zones of containment with objects, there are many possibilities.

    Great to hear! Looking forward to what I I create!

    There are two things in connection with the PIA:

    1- When I edit an existing project and if I rename it, then, all the data go back by default (and it is necessary all to start again).

    You can edit the pull-down name, but you are right, the name does not stay changed.

    I do not currently have PIA set up so you can change the name of projects. I actually started working on that feature, but did not get it completed yet. I will complete this for the next release of PIA.

    2 - Would it be possible to import an existing script in the PIA ?

    Sorry for the inconvenience, but the scripts created in PIA V1.0 and V1.1 are not compatible with V2.0, so you will have to re-enter the data into the new PIA. The easiest way to do this is to open both versions of PIA and go through the tabs, transferring the settings.

    However, from now on, new versions of PIA will detect and read previous versions of saved projects (starting with V2.0), so you won't lose any of your data in future updates of PIA.

  • JoepingletonJoepingleton Posts: 746
    edited December 1969

    FractalDimensia, Thanks for the great plug in.

    I am thinking that PySwarm may be the best method of animating this scene. The characters are simple spheres and don't need to be animated other than moving about and not running in to each other. They also need to not run into the main Character. I am thinking that I would use PySwarm to make the main character a "repulser" object and the other characters swarming objects moving randomly around it. Also I think that the blinking for them all could be accomplished using videos as surface shaders.

    Does this sound like something PySwarm could produce?

    Thanks for any advice or feedback.

    furryCrowd01a.jpg
    960 x 540 - 117K
  • FractalDimensiaFractalDimensia Posts: 0
    edited February 2014

    joeping said:
    FractalDimensia, Thanks for the great plug in.

    I am thinking that PySwarm may be the best method of animating this scene. The characters are simple spheres and don't need to be animated other than moving about and not running in to each other. They also need to not run into the main Character. I am thinking that I would use PySwarm to make the main character a "repulser" object and the other characters swarming objects moving randomly around it. Also I think that the blinking for them all could be accomplished using videos as surface shaders.

    Does this sound like something PySwarm could produce?

    Thanks for any advice or feedback.

    Joe,

    If I understand what you are attempting to do, this is exactly the kind of animation PySwarm was designed for.

    Technically, just to be clear, PySwarm does not work to create true "random" motion/animation. Instead, all motion is based on precise heuristics (formulas). If by random you mean you want them to move independent of each other, then you should be able to get good results as follows:

    * Deactivate cohesion and alignment
    * Activate separation (so they won't collide into each other)
    * Activate attraction, and use the main character as the focal point. Use a negative strength value to repel the others.
    * Activate containment and set your containment area so they don't all go running off in different directions

    I assume you will want to only allow motion on the surface (X/Y) plane, so you'll probably want to limit them to 2D movement (Movement tab). Set the altitude to the z value of the characters' hot point. (Optionally, you can also try setting the containment area to a very small z value, and they will bounce slightly up and down as they move about.)

    If this produces too much randomness (they'll operate more like billiard balls bouncing around on a table), you might try activating cohesion and alignment, but set the strength values to a small value (maybe 0.1-0.3).

    The hard (tedious) work will be numbering each character instance. I am still looking for a way to automate this....

    With character animation, hair should react to motion since it is all keyframe driven. Using a video shader for eye motion/blinking should work as well.

    Post any further questions or issues in this thread, and I'll respond when I can.

    BTW, the characters look adorable!

    Good luck!
    FD

    Post edited by FractalDimensia on
  • 0oseven0oseven Posts: 626
    edited December 1969

    Check my reply at carrarators if you have not already seen it.

    Fractal - any news on the release of next version ??

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    0oseven said:
    Check my reply at carrarators if you have not already seen it.

    Will do.

    Fractal - any news on the release of next version ??

    Apologies for the delays.

    TBH, this endeavor (PySwarm) has consumed nearly all of my limited free time the past 4 months, and I have realized I needed to set it on the back burner for a few weeks and come back at it with a clear head. There's nothing too complicated in any of the upcoming features I am adding that I can't solve (containment algorithm, motion animation, terrain following); they'll all get done. I just need to tackle them with a fresh mind.

    And meanwhile, a number of 3D animation projects and experiments I have been wanting to conduct keep piling up and like shiny objects, keep drawing my attention.
    - Audio-driven animation
    - Personal 3D animation production pipeline development
    - Several animated music videos
    - And LightWave, which I purchased a month ago and still sits unopened on my desk =/

    The PySwarm itch will return quickly and I'll be back at it. I'll post a report at the end of next weekend.
    FD

  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    Thanks for the tips and great plug in FractalDimensia,

    Post edited by Joepingleton on
  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    After watching Fractal Dimensia's fantastic PySwarm Tutorial 2 video ( http://youtu.be/IEyZyto9mxQ ) I made some revisions to my first experiment.

    This is my second experiment with the PySwarm plug in for Carrara 8.5 Pro. This time I used 49 Boid objects, 1 attractor object and 1 restricted zone. I also added 1,000 creatures made from 1 creature in to the background using the surface replicator. The "Red" character has some eye movement. It's body points at several boids using a few Point at modifiers turned on and off at different times. The camera movement is part PySwarm export and some keyframing. I played with the hair settings to speed up the render.

    View the animation on YOUTUBE.COM by clicking here.
    View the Stereoscopic 3D animation on YOUTUBE.COM by clicking here.
    Click here to see the 3D animation on 3DVisionLive.

    Thanks for the help and feedback.

    furryCrowd01_anim.jpg
    633 x 570 - 282K
    Post edited by Joepingleton on
  • DUDUDUDU Posts: 1,945
    edited December 1969

    FD...HELP !

    Capture.JPG
    1168 x 185 - 34K
    Capture2.JPG
    546 x 391 - 34K
  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    joeping said:
    After watching Fractal Dimensia's fantastic PySwarm Tutorial 2 video ( http://youtu.be/IEyZyto9mxQ ) I made some revisions to my first experiment.

    This is my second experiment with the PySwarm plug in for Carrara 8.5 Pro. This time I used 49 Boid objects, 1 attractor object and 1 restricted zone. I also added 1,000 creatures made from 1 creature in to the background using the surface replicator. The "Red" character has some eye movement. It's body points at several boids using a few Point at modifiers turned on and off at different times. The camera movement is part PySwarm export and some keyframing. I played with the hair settings to speed up the render.

    View the animation on YOUTUBE.COM by clicking here.
    View the Stereoscopic 3D animation on YOUTUBE.COM by clicking here.
    Click here to see the 3D animation on 3DVisionLive.

    Thanks for the help and feedback.

    Joe, looks like you've made improvements already! I especially like how the red character gives the others "the eye" Cool animation!

    Just one comment: The rapid spinning is caused by the characters in a tight space wanting to quickly move away from others they are near. When you have only a few rules active (in this case separation and attraction), those rules will affect the characters' responses more dramatic than when more rules are applied. You might try simultaneously increasing the separation distance slightly and reducing the separation strength value. They will still attempt to move apart, but their motion should not be so extreme. Keep lowering the strength settings until you get the results you want.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    FD...HELP !

    I have not seen this problem before and it too has me baffled.

    The first error message (something like): "WindowsError: [Error 2] The system cannot find the file specified"

    This error is occurring even before PySwarm script is started, which probably causing the code that follows to not run properly (unable to find the attractor).

    From what I know so far, the error is likely being caused (again) by Python settings related to non-English. I will need to read up on this more before I can offer any suggestions.

    Until then, it might be useful to know whether you get this error in using PySwarm on other Carrara scenes? Or is it unique to just this one? What happens if you deactivate attraction? Does it run okay then? Any specifics you can provide as to when you get this error and when you don't will help me run it down.

    FD

  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    Thank for the tips FD,
    It appears that PySwarm will need many experiments. Your method of trying different settings to dial in the motion is the way to go.

    Post edited by Joepingleton on
  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    joeping said:
    Thank for the tips FD,
    It appears that PySwarm will need many experiments. Your method of trying different settings to dial in the motion is the way to go.

    This experimentation has led me to an interesting technique to apply a walk cycle to the PySwarm output. I thought you might be interested in the results of my first test.

    View the animation on YOUTUBE.COM by clicking here.

    This is my first experiment with the PySwarm plug in for Carrara 8.5 Pro and NLA Clips.
    I created a "Boid" group that was a figure with a looping walk cycle NLA clip with a duration of 1 minute. Then I replicated that "Boid" 25 times and numbered the "Boid" groups. then I used PySwarm to generate a movement script with 25 boids, 1 attractor object and 1 restrictive zone. Then I just imported the PySwarm script into Carrara. One walk NLA clip and the Pyswarm script control all movement, no key frame editing.

    It's very rough and has many problems, but it proves that a walk cycle can be applied to Pyswarm output easily. The possibilities are endless.

    What do you think?

    I have not had any time to do much experimentation yet using NLA clips, ERC, and PySwarm together, other than to validate they do integrate (my "Shark Tank" study was to apply these 3 together). So it is nice to see someone leapfrog me on this! It is a great start, and I look forward to seeing more.

    You might notice some characters still walking through your restrictive zone. This is because it is too "small" for them to react correctly, so they speed through it when it is encountered. When I complete the new containment algorithm, you should see some improvements in applying zones to individuals with walking cycles. Key to that is BOIDs won't "ping" off zone walls; they'll navigate away from them before they get close. This will make it easy to create animated crowds where you want to contain them (for example) on walkways near streets in a city. When I get the terrain following feature completed, you'll have even more capabilities; for example, people stepping up and down curbs, climbing stairs, running over hills, etc. without having to do any keyframe editing. But alas, I need more time to devote to this. =/

  • 0oseven0oseven Posts: 626
    edited December 1969

    Re news on update.
    Thanks fractal - I'm sure we are all happy to wait for as long as it takes - plenty to practice with in current version. Congratulations! Over 7000 views of this thread shows big interest in what you are doing.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    0oseven said:
    Re news on update.
    Thanks fractal - I'm sure we are all happy to wait for as long as it takes - plenty to practice with in current version.

    Thanks, 0oseven. :) TBH, I too am biting at the bit to see what I can do with motion animation and terrain following! I have a few ideas to try out with it.

    Congratulations! Over 7000 views of this thread shows big interest in what you are doing.

    Dang.... Yeah... No pressure. :ohh:

  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    FractalDimensia,
    Thanks for the hard work on this plug in and for tips. Very informative and much appreciation.

    Post edited by Joepingleton on
  • FractalDimensiaFractalDimensia Posts: 0
    edited February 2014

    joeping said:
    FractalDimensia,
    Thanks for the hard work on this plug in and for tips. Very informative and much appreciation. I tried some of your suggestions out in my latest experiment.

    This is my second experiment with the PySwarm plug in for Carrara 8.5 Pro and NLA Clips. I created a "Boid" group that was a figure with a looping walk cycle NLA clip with a duration of 1.5 minutes. Then I replicated that "Boid" 25 times and numbered the "Boid" groups. Then I used PySwarm to generate a movement script with 25 boids, 1 attractor object and 2 restrictive zones. Then I imported the PySwarm script into Carrara. One walk NLA clip and the Pyswarm script control all movement, no key frame editing.

    View the animation on YOUTUBE.COM by clicking here.
    View the Stereoscopic 3D animation on YOUTUBE.COM by clicking here.
    Click here to see the 3D animation on 3DVisionLive.

    I think it turned out better than my first experiment.
    What do you think?

    Joe, really like what you've got going. :) The segment in the middle (between about 0:30 and 0:55) looks good - randomly placed people walking.

    One suggestion - You can stop the feet slipping on the floor by setting the min and max speed values to the same - at whatever speed keeps slipping from occurring.

    I am wondering, however, why there are places where (it looks like) the people aren't walking in the direction they're facing (e.g., walking sideways); for example at about 0:10, when they encounter the first restrictive zone. PySwarm should be setting the z rotation value (heading) to be the movement direction - in other words, they should always be moving in the direction they are facing.

    FD

    Post edited by FractalDimensia on
  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    Thanks for the help FD,

    I have a question about the Motion Tab in the PySwarm Interface application. What does it do? I couldn't find any information about it on your wiki.

    Post edited by Joepingleton on
  • FractalDimensiaFractalDimensia Posts: 0
    edited February 2014

    joeping said:
    Thanks for the help FD,
    I think you are right about the foot slipping. I had the initial speed as 1 and the min speed as 0 and the max speed as 2. I was trying to find out what the ranges did. I am thinking 1 keeps the feet from slipping. I also need to work on the walk NLA clip as it is just a quick walk cycle export from Poser's walk designer to test the concept.

    The places where the people aren't walking in the direction they are facing is what is confusing me too. It seems to stem from what happens when they encounter the restrictive zones. They speed off in random directions like my first experiment, but this time they seem to make circles.

    The BOIDs will react when they encounter the zone boundaries by moving as if bouncing off the walls. If you do not have any (or have just a few) other rules turned on, then there will be little interaction between them. The effect of going in circles is probably because they move away from the zones, and then encounter other BOIDs, so they move away from them, but then encounter more, and then move away from them - causing them to "spin."

    Spinning and other effects occurs when they get crowded and they don't have any way to deal with limited separation.

    Some things you can do:
    1. Try to create more space between the BOIDs. (Try initial distance between them to be 2-3 times your Separation Distance value.)
    2. Reduce the Separation Distance value and/or lower the Separation Strength setting.

    I am also getting this error when I import the Pyswarm script:
    Starting PySwarm V0.6
    25 BOIDs found.
    Traceback (most recent call last):
    File "PyCarrara_13731BC8", line 1368, in
    ZeroDivisionError: float division

    === Script execution terminated ===

    I have no idea what is causing it as I turn everything off and I still get this error. It's has to be my settings and lack of knowledge of how things are really working in PySwarm. This is only my fourth experiment with Pyswarm, but I am encouraged with the results so far. Many more experiments are needed.

    Check your setting for Keyframe Rate - Is it possibly set to zero? (Though I don't think PIA will allow this.)

    If that is not the problem, can you email your script file (".PY") causing the error? I'll take a look at it.

    I have a question about the Motion Tab in the PySwarm Interface application. What does it do? I couldn't find any information about it on your wiki.

    The Motion tab current does not do anything. The tab is for accessing features for an upcoming release (V0.6.2). All the fields in the current release are inactive because the PySwarm script code is not complete yet.

    Post edited by FractalDimensia on
  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    Thanks for the tip FD,

    It was the Keyframe rate and your other suggestions helped in today's experiment. I started from scratch on the PySwarm settings and discovered that the keyframe rate is very important. It seems it calculated the collisions better at higher frame rates. Thanks for the info on the motion tab it looks so good I thought it had to be something cool. =)

    This is my Third experiment with the PySwarm plug in for Carrara 8.5 Pro and NLA Clips. I created a "Boid" group that was a figure with a looping walk cycle NLA clip with a duration of 1.5 minutes. Then I replicated that "Boid" 25 times and numbered the "Boid" groups. Then I used PySwarm to generate a movement script with 25 boids, 1 attractor object and 3 restrictive zones. Then I just imported the PySwarm script into Carrara. One walk NLA clip and the Pyswarm script control all movement, no key frame editing.

    View the animation on YOUTUBE.COM by clicking here.
    View the Stereoscopic 3D animation on YOUTUBE.COM by clicking here.

    I think its an improvement on my last experiment.
    What do you think?

    walkPySwarm01.jpg
    633 x 570 - 294K
    Post edited by Joepingleton on
  • mmoirmmoir Posts: 821
    edited December 1969

    This plugin is looking very cool, great stuff.

  • DartanbeckDartanbeck Posts: 21,549
    edited December 1969

    joeping said:
    What do you think?
    Beautiful, is what I think!
    Great experiment with great little Boids resulting in a most enjoyable little simulation. Love it!
  • JoepingletonJoepingleton Posts: 746
    edited February 2014

    Thanks for the feedback and encouragement.

    Post edited by Joepingleton on
  • DarkSide ProjectsDarkSide Projects Posts: 25
    edited December 1969

    Thanks alot :) Cant wait to try this!

  • JoepingletonJoepingleton Posts: 746
    edited March 2014

    FD I LOVE your PySwarm Plug in. Thanks for the tips and feedback. This is another experiment with the PySwarm plug in for Carrara 8.5 Pro and NLA Clips.

    I created 4 "Boid" groups that were a zombie figure with offset looping walk cycle NLA clips with a duration of 3 minutes. Then I replicated that "Boid" 50 times and numbered the "Boid" groups. Then I used PySwarm to generate a movement script with 50 boids, 1 moving attractor object and 3 restrictive zones. Then I just imported the PySwarm script into Carrara. One walk NLA clip and the Pyswarm script control all movement, no key frame editing.

    I think its an improvement on my last experiment.
    What do you think?

    View the animation on YOUTUBE.COM by clicking here.

    zombie_carrara_pyswarm_walk_experiment_by_joepingleton-d78eygu.jpg
    633 x 570 - 204K
    Post edited by Joepingleton on
  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    joeping said:
    FD I LOVE your PySwarm Plug in. Thanks for the tips and feedback. This is another experiment with the PySwarm plug in for Carrara 8.5 Pro and NLA Clips.

    I created 4 "Boid" groups that were a zombie figure with offset looping walk cycle NLA clips with a duration of 3 minutes. Then I replicated that "Boid" 50 times and numbered the "Boid" groups. Then I used PySwarm to generate a movement script with 50 boids, 1 moving attractor object and 3 restrictive zones. Then I just imported the PySwarm script into Carrara. One walk NLA clip and the Pyswarm script control all movement, no key frame editing.

    I think its an improvement on my last experiment.
    What do you think?

    Looks like you're making great progress on your videos and the use of PySwarm. Nice job with the zombie hoard! You even have them steering free of buildings and objects. Nice!

    It also looks like the "walking sideways" problem is gone. Did you do something to fix this?

    Thanks for sharing and look forward to further advancements!

    I just back yesterday from a week-long trip, and will settle down this evening and start working on the plug-in again.

Sign In or Register to comment.