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

145791012

Comments

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969


    Okay. Because I know this issue can be such a pain and since many objects you may want to use with PySwarm are not oriented in the +X axis, I am making an unofficial patch version of V0.5.1 available that will work until I can come up with a better solution in V0.6. This is not an official version because I have not had time to test it fully, but in the few test cases I created, it worked fine, and did not require editing the BOIDs in any way.

    You can download this patch shell here:
    https://drive.google.com/file/d/0B8V9-txK8F4MbHB3NHlVZ0FfZzQ/edit?usp=sharing

    Now that I had a few spare moments to test this patch further, I have to retract my statement (again). The patch only works for some cases - of course it worked for the cases I first tested! =/

    As it turns out, the rotational calculations are much more complex when dealing with rotated objects. The more they are rotated away from the +X axis, the more complicated the calculations become.

    I'll have to spend some time on this one....

    Apologies.
    FD

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    I have been able to work out the adjustments necessary to address re-orienting BOIDs.

    The following demonstrates the successful animation of a school of angelfish, whose default orientation is facing upwards (+Z axis).
    https://www.youtube.com/watch?v=7otQzDXF5vs

    I currently "hardcoded" the script to handle this orientation.

    I just need to figure out the most prudent way to modify PIA and the script to handle all of the possible orientations.

    FD

  • DUDUDUDU Posts: 1,945
    edited December 1969

    The problem of the European comma is quite real and I also believe that it is for this reason I must use Carrara in english language version.
    My Windows is programmed for Europe and generates European symbols automatically.
    I modified several lines of data in script by replacing the commas by points, but finally the loading of script marks the following error: “float is needed”, what it is, mystery…
    Tomorrow I will publish the render of second test starting from your script modified in the wordpad, I would like in a forthcoming test to insert there a zone or two of exclusion…

  • DartanbeckDartanbeck Posts: 21,623
    edited December 1969

    The following demonstrates the successful animation of a school of angelfish, whose default orientation is facing upwards (+Z axis).
    https://www.youtube.com/watch?v=7otQzDXF5vs
    So cool!
  • 0oseven0oseven Posts: 626
    edited January 2014

    I have been able to work out the adjustments necessary to address re-orienting BOIDs.

    The following demonstrates the successful animation of a school of angelfish, whose default orientation is facing upwards (+Z axis).
    https://www.youtube.com/watch?v=7otQzDXF5vs

    I currently "hardcoded" the script to handle this orientation.

    I just need to figure out the most prudent way to modify PIA and the script to handle all of the possible orientations.

    FD

    Fantastic - I'm sure this is a very useful mod to pyswarm. Thanks for dealing with it.
    Re PIA - I see your problem with orientation. Most I guess would either be X,Y or Z but what if the object creator was "untidy" ??

    by the way the errors I had mentioned to you seem less of a problem lately. Maybe I'm getting the hang of pyswarm at last LOL

    Meanwhile a clip of aircraft chasing each other - sort of. banking could use more control options.

    http://www.bond3d.byethost18.com/index.php?topic=51.msg245#msg245

    Post edited by 0oseven on
  • DUDUDUDU Posts: 1,945
    edited December 1969

    I have been able to work out the adjustments necessary to address re-orienting BOIDs.

    The following demonstrates the successful animation of a school of angelfish, whose default orientation is facing upwards (+Z axis).
    https://www.youtube.com/watch?v=7otQzDXF5vs

    I currently "hardcoded" the script to handle this orientation.

    I just need to figure out the most prudent way to modify PIA and the script to handle all of the possible orientations.

    FD

    This test makes me think of extraordinary film: Arizona Dream… some fishes up on the desert...
    Here, one sees well the immense possibilities of Pyswarm.
    I am sure that, thanks to you, animation will make a step ahead, thank you for your work!

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    The problem of the European comma is quite real and I also believe that it is for this reason I must use Carrara in english language version.
    My Windows is programmed for Europe and generates European symbols automatically.

    I am still looking into this. I may switch one of my computer's Windows settings to European and trace this down. Since PIA is a Windows app, I suspect it is the culprit. If so, Carrara doesn't have anything to do with the problem. I already derived a PIA modification, but need time to test it fixes the problem. If so, you should be able to work without switching to English.

    I modified several lines of data in script by replacing the commas by points, but finally the loading of script marks the following error: “float is needed”, what it is, mystery…

    This is likely caused by having missed a comma in a number that needed to be a period.

    Tomorrow I will publish the render of second test starting from your script modified in the wordpad, I would like in a forthcoming test to insert there a zone or two of exclusion…

    I look forward to seeing what you have! :)

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    So cool!

    Thanks, DB.

    I wish I had more time to work on this. With a few more months of work, this app has the potential to be a great addition for Carraratons.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    0oseven said:
    Fantastic - I'm sure this is a very useful mod to pyswarm. Thanks for dealing with it.


    No problem. Making PySwarm work simply and every time is my primary objective.

    Re PIA - I see your problem with orientation. Most I guess would either be X,Y or Z but what if the object creator was "untidy" ??

    I am finding a pattern behind the orientation issue. I believe there is an algorithm. If so, then it is likely to handle any rotation. But then again, I'm eternally hopeful! LOL.

    by the way the errors I had mentioned to you seem less of a problem lately. Maybe I'm getting the hang of pyswarm at last LOL

    Meanwhile a clip of aircraft chasing each other - sort of. banking could use more control options.

    http://www.bond3d.byethost18.com/index.php?topic=51.msg245#msg245

    Mechanical systems (airplanes, helicopters, etc.) move different from animals. It doesn't become obvious until you try to animate a mechanic system and you see how unnatural it moves. I am adding several new motion controls in V0.6 that will help control banking and pitch.

    Thanks for posting this scene!

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    To contrast the "angel fish" animation I posted yesterday, here is a PySwarm test on a group of 5 fighter aircraft.
    https://www.youtube.com/watch?v=NsEkTlmt0dM

    It took me about 10 minutes to create the scene, add the objects, build the PySwarm script, and generate the animation (after several iterations). I used the Carrara provided F15c and a radio antenna for an attractor.

    Some key settings:
    Cohesion: Active
    Separation: Active with 150 feet separation
    Alignment: Active
    Containment: Active - 1 box safe zone with a size of (2500, 2500, 800)
    Attraction: Active with the radio antenna serving as the attractor
    Speed Limit: Active with min of 100 ft/sec; max of 250 ft/sec
    Max Turn: Active with max turn set to 60 deg/sec

    One difference I have discovered between animating living creatures and mechanical systems (like airplanes) is in the number of keyframes per second.
    - For animating animals (birds and fish), I found setting the keyframe rate somewhere between 10-15 works best.
    - For airplanes, I found a much lower rate is better, usually 1-3 per second. I set the rate to 3 keyframes/second in this example.

  • FractalDimensiaFractalDimensia Posts: 0
    edited January 2014

    ATTENTION: For those working on systems in languages where the digital delimitor is anything other than a period ("."); for example, the comma (",") in Europe...

    A modified version of PIA (V1.1) is available that should correct the issue of using PIA on your system, without having to change your system's language to US English.

    It can be downloaded here:
    https://drive.google.com/file/d/0B8V9-txK8F4MWi1DYTliOXMyZEk/edit?usp=sharing

    PLEASE NOTE: If your operating system language is set to be in the US English standard, or another language where the period (".") is the digital delimitor, you do not need this version of PIA. V1.0 should work fine for you.

    To install this version on your system, download the zipped file and copy the contents (one file named "PIAV11.exe") to the folder you currently have PIA installed in. When you run PIAV11, it should read any existing projects you have saved.

    This change has been tested on several systems and shown to work correctly. However, please post any problems or questions you have to this thread, or email me at [email protected].

    Explanation:

    Python expects numbers to be in the format: "111.33" and is not able to read "111,33" as a number. However, PIA V1.0 uses the operating system's settings to determine what character to use as the delimiter when it generates PySwarm scripts. PIA V1.1 overrides the system's natural formatting INTERNALLY to ensure numbers are properly formatted for Python. PIA does NOT modify or change anything in your system, or the operating system.

    Post edited by FractalDimensia on
  • DUDUDUDU Posts: 1,945
    edited December 1969

    Here the link to view my second test with Pyswarm v0.5: http://www.youtube.com/watch?v=eT5tOoVfT70&feature=em-upload_owner

    Thank you FD !

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Here the link to view my second test with Pyswarm v0.5: http://www.youtube.com/watch?v=eT5tOoVfT70&feature=em-upload_owner

    Thank you FD !

    Marc, it looks like your animations are coming along! I especially like how the animation ended with the B2's landing in a row. :)

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    PySwarm V0.5.2 is now available.
    See the first post in this thread for details on downloading the files.

    This is the last minor release of PySwarm before I complete V0.6, which will include a number of significant enhancements.

    Modifications from V0.5.1 to V0.5.2:

    Enhancements (Minor):
    1. PySwarm now provides an explanation for some cases where the script "crashes." I am currently working on a wiki page on troubleshooting to help you diagnose some kinds of problems.

    2. A slightly improved algorithm for cohesion, separation, containment, and attraction will reduce BOID collsions. (Note that V0.6 will have a completely revamped approach for handling containment zones.)

    3. Some additional information is printed in the PyCarrara window during the import, such as objects found and number of BOIDs engaged.

    Bug Fixes:
    1. BOID initialization when Landed mode is not activated

    2. Fixed a problem in calculating max velocity change.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    I started a "Troubleshooting" wiki page.
    http://pyswarm.wikia.com/wiki/Troubleshooting_PySwarm

    I will be logging all known software bugs, problems, and issues encountered, and offer suggestions for work-arounds or resolution on this page.

    When you encounter a problem using PIA or the PySwarm script, check there first. If there is no description of your problem or if the solution described there doesn't help, please post your issue to this thread or message me directly. I will endeavor to resolve all PySwarm problems!

    From now on, I will update the wiki page to describe the problem and possible solutions, and only post a reference (link) in this thread.

    Thanks for your assistance.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Recently, I have made several references to the release of V0.6, which, considering all of the changes I am working on, may be the most significant version since I released V0.3 (especially if the amount of time it has taken is any indication!).

    Looking at what I have completed so far and what remains, I realized that it might make better sense to release the enhancements over several weeks. (This may also give people a chance to digest all that is coming ;-) ) So I will be releasing V0.6 in three waves.

    Here are the changes I have planned for these three releases:

    V0.6 (First Wave) Changes:
    1) BOID Orientation - PySwarm will be able to handle some variations in BOID orientation without having to position them to face the +X axis.

    2) Container Objects - Instead of defining containment zone values (base, size, etc.), you will be able to use Carrara objects in your scene as zones. These objects can then be moved and resized during the animation sequence, and PySwarm will adapt to these settings.

    3) Attractor Region - This feature will limit attraction effects to only be within a specific radius. This is mostly for implementing negative attractors, where BOIDs stay a certain distance from the attractor; though using this effect with positive attraction has its uses.

    4) More Movement Controls - A number of new movement controls will be added to improve animation - such as better Bank and Pitch controls.


    V0.6.1 (Second Wave) Change:

    Better Containment Algorithm - The zone containment algorithm is being redesigned so that BOIDs don't "ping" off containment walls, but instead move to avoid collisions whenever possible (like real animals do).


    V0.6.2 (Third Wave) Change:

    Motion Cycles - The last part of V0.6 will include parameters to create motion cycles for BOIDs through keyframe insertion. The resulting animation will be better than using NLA loops because motion cycles can be set to adjust to variable BOID speed - for example, as BOIDs move faster, motion cycles can be shortened or amplitude of motion can be more dramatic. I'll post more on this as I get closer to releasing this change.


    In addition, I will be releasing a restructured version of PIA (V2) with the first wave release. This version will be designed to handle ALL of the PySwarm enhancements for V0.6. This means that the remaining two waves of changes need only include revised PySwarm script shells.

  • PhilWPhilW Posts: 5,145
    edited December 1969

    This all sounds great! I haven't had a lot of time to play with this recently but continue to follow developments with great interest. (Not helped by apparently losing notifications over the last week or so...)

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    PhilW said:
    This all sounds great! I haven't had a lot of time to play with this recently but continue to follow developments with great interest. (Not helped by apparently losing notifications over the last week or so...)

    No worries, Phil. I look forward to when you have a chance to try it out and give me your thoughts.

  • DUDUDUDU Posts: 1,945
    edited December 1969

    I await V 0.6 impatiently, it will be very interesting for me with regard to the containers objects, and more, in moving !
    It will be interesting that, in a future version, you define these “Container objects” like zone of attraction.
    @+

  • FractalDimensiaFractalDimensia Posts: 0
    edited January 2014

    I have posted a starter tutorial on my experiences and personal lessons learned on setting up scenes in Carrara for importing PySwarm scripts.

    In this tutorial, I cover:
    - Creating and reusing default Carrara scenes
    - Importing BOIDs (even of different types)
    - Setting BOID orientations and hot points
    - Naming, replicating, and number BOIDs
    - Setting PySwarm parameters in PIA (basics)
    - Importing the PySwarm script
    - Tweaking the parameters

    https://www.youtube.com/watch?v=IEyZyto9mxQ

    I was hoping to cover these topics in 15-20 minutes; however, the tutorial turned out to be 30 minutes long. I would have remade it, but I am recovering from acute bronchitis and my voice was giving out. Apologies. I will have to work on making my tutorials more succinct.

    The resulting 1 minute animation sequence made during this tutorial can be viewed:
    https://www.youtube.com/watch?v=UG_z4eKPrgg

    Also, you can download the .CAR scene file created in this tutorial with the following link:
    https://drive.google.com/file/d/0B8V9-txK8F4MZmhCTFZtMzFFWVU/edit?usp=sharing

    Post edited by FractalDimensia on
  • HeadwaxHeadwax Posts: 9,996
    edited December 1969

    thanks for this FD, looking forward to the time I have enough time to sit down and absorb it! Here's something almost relates that could be of interest to your mathematical brain :)

    http://www.cgsociety.org/index.php/CGSFeatures/CGSFeatureSpecial/cellular_forms

  • DartanbeckDartanbeck Posts: 21,623
    edited December 1969

    head wax said:
    thanks for this FD, looking forward to the time I have enough time to sit down and absorb it! Here's something almost relates that could be of interest to your mathematical brain :)

    http://www.cgsociety.org/index.php/CGSFeatures/CGSFeatureSpecial/cellular_forms

    Great article Mr. Head Wax, Thanks for that! Reminds me of FD, too! ;)
  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    head wax said:
    thanks for this FD, looking forward to the time I have enough time to sit down and absorb it! Here's something almost relates that could be of interest to your mathematical brain :)

    http://www.cgsociety.org/index.php/CGSFeatures/CGSFeatureSpecial/cellular_forms

    Great article Mr. Head Wax, Thanks for that! Reminds me of FD, too! ;)

    LOL! You guys! And am I that transparent???? ;)

    Actually, I did some chaos theory research work in the 80's looking at the ratio of surface area to volume for some forms of membranes' (like brains). I suspect the model this Andy Lomas built is based on the same foundational work - it's all about dynamic particle growth under various interdependent (non-linear) tensions. Good examples are the crystalization of water molecules into snowflakes, coastlines, fingerprints, and zebra stripes. And when you measure the ratio of such structures, you know what you get???

    FRACTAL DIMENSIONS!!!

    Like people, there's an infinite number of possibilities.

    If anyone is interested in a basic understanding of the concept, Wikipedia actually does a good job explaining it (better than I could!).
    http://en.wikipedia.org/wiki/Fractal_dimension

    Thanks, Mr HW, for sharing this. :)

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Okay. For those still hanging on to what is happening with PySwarm, I have completed development and testing of V0.6 and should be releasing the package on Sunday (or Saturday if we get snowed in tomorrow and I have nothing else to do! :) )

    The only thing I have left is packaging the files and preparing them for release.

    With V0.6, I will be releasing all the file contained within either an EXE or Windows MSI installer. No more hassles creating directories or dragging and dropping files. You'll be able to run the installer and let it do all the work for you. (Also, as an additional feature, it will come with an UNinstaller, so you can remove all the files at any time with a simple command.)

    I will need time to test the installation package on Windows XP, 7, and 8.

    I also added a "PySwarm Release Notes" for this version that lists all of the new features, enhancements, and fixes. You can read about all of these here:
    http://pyswarm.wikia.com/wiki/PySwarm_V0.6_Release_Notes

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    V0.6 is now available for download. I have updated the first post in this thread on details for downloading, installing, and using this new version.

    FD

  • FractalDimensiaFractalDimensia Posts: 0
    edited January 2014

    For those who have been following along with this thread (and with 5300 hits, there's got to be a few of you out there, quietly in the background, wondering when to jump into trying out this add-on), with V0.6, I have made the transition into using PySwarm incredibly easy.

    First, the installation is through an installation app. No more unzipping, dragging, dropping, etc. Simply run the downloaded installer and it is ready to go, with a folder in your Start menu.

    Second, if you're concerned about having "stuff" on your computer you can't get rid of, no worries there. The installer comes with an uninstaller. You even have 3 ways to access the uninstaller. You can completely uninstall PySwarm in 1 minute.

    Third, I have now included six ready-made animation .CAR files that you can study. Each scene comes with a PySwarm parameter file that you can load into the PySwarm Interface App (PIA). Then run the animation in Carrara while you review the parameter settings used to create it. Then make a few tweaks, create a new script, import it into the scene, and watch the animation change! The six animations demonstrate some of the recent key features of PySwarm:
    - Variations in using the six BOID rules
    - Adjusting motion control parameters (banking, pitch, speed, etc.)
    - Multiple containment zones (safe and restricted)
    - Animated containment zones
    - Handling various BOID default orientations

    Here are links to animation sequences produced from three of the six demo files included in this release:
    Angelfish Bowl: BOIDs with a skewed default orientation, contained in a sphere and avoiding a large object in the middle
    https://www.youtube.com/watch?v=TzVtTOWP1WM

    Moth Maze: This demo shows BOIDs flying in a complex structure of 8 safe containment zones.
    https://www.youtube.com/watch?v=he-x_NMYWvQ

    Moving Containers: This demos BOIDs avoiding moving restricted containers within their safe zone.
    https://www.youtube.com/watch?v=XxrYJ5WEfkc

    Fourth, V0.6 is (I believe) highly stable. I've testing PIA on Windows XP, 7 and 8, and it runs flawlessly. And the PySwarm script now prints error messages for many of the common scripting problems. Further, PIA catches many of potential problems in the settings before you even generate the scripts.

    And fifth, with the remaining two waves of releases for V0.6 (better containment animation and basic motion cycles), there will be enough options and settings to create some very realistic animation sequences. These updates will be completed in the next month, so now's the time to start getting ready!

    You have no more excuses!

    Stay Swarming, my friends!!

    Post edited by FractalDimensia on
  • DUDUDUDU Posts: 1,945
    edited December 1969

    Ah ah… serious work starts now!
    FD, you should launch a challenge with “Pyswarm”!
    Thank you.

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    Ah ah… serious work starts now!
    FD, you should launch a challenge with “Pyswarm”!
    Thank you.

    Thanks DUDU for the suggestion. I'll have to consider this. Of course, ANYONE could start a challenge. :cheese:

    I suppose I could give away a copy of PySwarm to the winner. ;)

  • FractalDimensiaFractalDimensia Posts: 0
    edited December 1969

    For those using PySwarm V0.6, I wanted to make you aware of a particular situation that might cause a problem importing a PySwarm script. It is a very special case, but it is possible.

    If you choose to initialize BOID positions randomly "Inside Container Zone #1", be sure that you check the "Activate Zone" for Zone #1 and use the "Safe" mode.

    I will have PIA do additional checks for this condition in V2.1.

  • 0oseven0oseven Posts: 626
    edited December 1969

    Hi

    FD , Thankyou for all your hard work in making this facsinating plugin for carrara and the latest release.

    I didn't see mention of the terraine following ability in the new release or upcoming plans unless it goes by another name. It was hinted at some time ago so just wondering if you still plan to incorporate that. Forgive me if I overlooked it somewhere. Just getting to grips with V0.6.

    I had thought of a challenge in the CarraraTor forum but thought best to wait until most of your mods are done so we all play with the same tool.
    What do you think of that Dudu ?

Sign In or Register to comment.