Digital Art Zone

 
   
2 of 22
2
PySwarm for PyCarrara (V0.6) Released 01/25/2013
Posted: 26 October 2013 09:02 AM   [ Ignore ]   [ # 16 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

OK, I’ve downloaded PyCarrara (which I didn’t have before) and PySwarm. When I try to load the script as directed in the manual, I get a message that Python26.dll is missing.  I had a look on the Python site and just got confused with talk of various versions of Python 2 and 3 - can you advise what I need to do to get this working, as you probably understand what you are doing on this more than I do!

Profile
 
 
Posted: 26 October 2013 12:23 PM   [ Ignore ]   [ # 17 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 26 October 2013 09:02 AM

OK, I’ve downloaded PyCarrara (which I didn’t have before) and PySwarm. When I try to load the script as directed in the manual, I get a message that Python26.dll is missing.  I had a look on the Python site and just got confused with talk of various versions of Python 2 and 3 - can you advise what I need to do to get this working, as you probably understand what you are doing on this more than I do!

Hi phil. Typing on my phone so will be brief.

In Frederic"s doc you will find a description about installing Python. Use the link he provides to download Python 2.6.6. I have not tried a more recent version yet. After installing Python Follow the directions to drop the files into your Carrara folder that holds plug ins.

I hope that gets you started.

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 26 October 2013 01:13 PM   [ Ignore ]   [ # 18 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

Thanks for your help - I wasn’t sure which doc / link you were talking about, but I managed to find Python 2.6.6 and have installed it and got PySwarm working so all is good!  Now to have a play.

Profile
 
 
Posted: 26 October 2013 01:43 PM   [ Ignore ]   [ # 19 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

I am starting to go through the PySwarm manual in more detail and an additional parameter occurred to me that you may want to consider and I thought I’d add it here before I forgot about it.

At the moment when an object turns, it stays upright throughout (or at least I believe so, I haven’t really started playing in earnest!).  Would it be possible to add a banking parameter so that the object (eg. a bird) could bank as it turns, this would produce more natural movement for some types of object.  As I am writing this, I realise that this means keeping track of the change in direction as well as the direction itself, which you are probably not currently needing to do, so it is probably a little more complex than I was at first thinking!  Still, I hope it is a useful idea.

Also, would it be possible to add variation in the starting height?

EDIT:  Sorry, I just read on to the end and you have already thought of these!!

Profile
 
 
Posted: 26 October 2013 02:23 PM   [ Ignore ]   [ # 20 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

Me again!  I have started playing with changing parameters and something is not working as I think it should - not sure if it is me doing something wrong, or if there is an issue with PySwarm.  I turned on the Attraction rule and used “Attractor” as the object (in your test scene).  That worked fine.  I then set key frames for the Attractor at 10sec, 20sec and 30sec, but when I re-ran the script. the objects did not follow the attractor but stayed around its original position.  Any ideas?

Profile
 
 
Posted: 27 October 2013 02:39 AM   [ Ignore ]   [ # 21 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 26 October 2013 02:23 PM

Me again!  I have started playing with changing parameters and something is not working as I think it should - not sure if it is me doing something wrong, or if there is an issue with PySwarm.  I turned on the Attraction rule and used “Attractor” as the object (in your test scene).  That worked fine.  I then set key frames for the Attractor at 10sec, 20sec and 30sec, but when I re-ran the script. the objects did not follow the attractor but stayed around its original position.  Any ideas?

Hi Phil!

I am glad you’re taking the time to play with the script some. You’re forging new ground as everything up until now has been just my experimentation.

I realize I may not have put this in the manual, but I discovered PyCarrara plug-in uses the HotPoint of the object for its position. So if you’ve moved the attractor object (for example) away from the HotPoint and having it revolve around that point in your keyframes, the objects will swarm the wrong place. You might try putting the attractor along a track. (?) I have a note to myself to explore this more as it would make more sense to extract the object’s center instead. I just haven’t had time yet to figure out if and/or how to get to that information through PyCarrara.

If this is not the case, then I’ll need more information to know what is going on.

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 02:41 AM   [ Ignore ]   [ # 22 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 26 October 2013 01:13 PM

Thanks for your help - I wasn’t sure which doc / link you were talking about, but I managed to find Python 2.6.6 and have installed it and got PySwarm working so all is good!  Now to have a play.

I will update the first post in this thread to give details about how to install Python and PyCarrara for others experiencing this. I also struggled a bit with getting everything installed and working.

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 03:04 AM   [ Ignore ]   [ # 23 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 26 October 2013 01:43 PM

I am starting to go through the PySwarm manual in more detail and an additional parameter occurred to me that you may want to consider and I thought I’d add it here before I forgot about it.

At the moment when an object turns, it stays upright throughout (or at least I believe so, I haven’t really started playing in earnest!).  Would it be possible to add a banking parameter so that the object (eg. a bird) could bank as it turns, this would produce more natural movement for some types of object.  As I am writing this, I realise that this means keeping track of the change in direction as well as the direction itself, which you are probably not currently needing to do, so it is probably a little more complex than I was at first thinking!  Still, I hope it is a useful idea.

Also, would it be possible to add variation in the starting height?

EDIT:  Sorry, I just read on to the end and you have already thought of these!!

Well, it is good to see others are thinking along the same lines as me! wink

FYI - Actually, the bank and roll are not that hard as I actually do calculate the heading change vector (heading and speed) before updating the object’s current one. This will be in the next release (V0.4).

In V0.4, I have changed how object positions and velocities are initialized. There will be THREE different ways:
1) Randomly placed within the containment area (which I hope addresses your random height request?)
2) Using objects’ current location and direction facing (so you can actually “prop” the scene with how you want the objects to start moving)
3) Inside a circle of a defined radius (similar to how V0.3 works)

Thanks for the feedback!

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 03:38 AM   [ Ignore ]   [ # 24 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12
FractalDimensia - 27 October 2013 03:04 AM
PhilW - 26 October 2013 01:43 PM

I am starting to go through the PySwarm manual in more detail and an additional parameter occurred to me that you may want to consider and I thought I’d add it here before I forgot about it.

At the moment when an object turns, it stays upright throughout (or at least I believe so, I haven’t really started playing in earnest!).  Would it be possible to add a banking parameter so that the object (eg. a bird) could bank as it turns, this would produce more natural movement for some types of object.  As I am writing this, I realise that this means keeping track of the change in direction as well as the direction itself, which you are probably not currently needing to do, so it is probably a little more complex than I was at first thinking!  Still, I hope it is a useful idea.

Also, would it be possible to add variation in the starting height?

EDIT:  Sorry, I just read on to the end and you have already thought of these!!

Well, it is good to see others are thinking along the same lines as me! wink

FYI - Actually, the bank and roll are not that hard as I actually do calculate the heading change vector (heading and speed) before updating the object’s current one. This will be in the next release (V0.4).

In V0.4, I have changed how object positions and velocities are initialized. There will be THREE different ways:
1) Randomly placed within the containment area (which I hope addresses your random height request?)
2) Using objects’ current location and direction facing (so you can actually “prop” the scene with how you want the objects to start moving)
3) Inside a circle of a defined radius (similar to how V0.3 works)

Thanks for the feedback!

Sounds like a good set of starting options, and yes that would satisfy my starting height request.

I don’t think you need to look at deriving an object’s centre, I think the hot point works fine and gives the user more control.  In my test, I did not change the hot point of the attractor.  You can have a look at what I have done here:  https://dl.dropboxusercontent.com/u/4297440/PySwarm V0.3.1 - TestCopyPhilW.zip

I was really surprised at how few times PyCarrara seems to have been downloaded!  But I am sure that with your PySwarm, this may become a whole lot more.

Profile
 
 
Posted: 27 October 2013 04:11 AM   [ Ignore ]   [ # 25 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 27 October 2013 03:38 AM

Sounds like a good set of starting options, and yes that would satisfy my starting height request.

I don’t think you need to look at deriving an object’s centre, I think the hot point works fine and gives the user more control.  In my test, I did not change the hot point of the attractor.  You can have a look at what I have done here:  https://dl.dropboxusercontent.com/u/4297440/PySwarm V0.3.1 - TestCopyPhilW.zip

I was really surprised at how few times PyCarrara seems to have been downloaded!  But I am sure that with your PySwarm, this may become a whole lot more.

Okay, had a quick look and it seems you found a problem. Thanks, Phil, for the heads up. I’ll upload a fix later today, and add a post to this thread. On another note, I’ll have to do more testing of future versions before releasing them. (I’ve complained about DAZ3D not doing adequate testing of Carrara before release, so I should practice what I preach! wink )

My guess on the limited use of PyCarrara has more to do with the pre-requisite to understand programming/scripting in Python than about not having many capabilities. On the scale of complexity, Python ranks in the “simple” end of the spectrum. Still, “simple” is a relative term. wink

As I’ve posted elsewhere, while recently reviewing the plug-in, it struck me just how powerful PyCarrara really is. I’ve only begun to scratch the surface. And I still have several more areas to explore that are completely tangential to PySwarm. But PySwarm seemed a good way to whet my palate!

Beyond creating something useful for Carrarans (PySwarm), my ultimate goal is to convince other programmers it is worth the investment to dive into this plug-in, and find new ways to make PyCarrara’s features available to everyone in creating great simulations.

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 05:02 AM   [ Ignore ]   [ # 26 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

Always good to get a few people testing as they may try things that you wouldn’t even think of!  Tnanks for looking into this so quickly.

As to more people using PyCarrara, now that they have the template of what you are doing, I am sure that more people should take a look.  Hey, I may even brush off my own programing skills (unused in over 20 years!  Back in the 80s I wrote a whole game in Assembler code…) to do the odd script.

Profile
 
 
Posted: 27 October 2013 10:43 AM   [ Ignore ]   [ # 27 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 27 October 2013 05:02 AM

Always good to get a few people testing as they may try things that you wouldn’t even think of!  Tnanks for looking into this so quickly.

As to more people using PyCarrara, now that they have the template of what you are doing, I am sure that more people should take a look.  Hey, I may even brush off my own programing skills (unused in over 20 years!  Back in the 80s I wrote a whole game in Assembler code…) to do the odd script.

That’s bringing back memories for me as well. I had my hand in writing several interactive games in a prior life. I’m certain all that is what guided me into Carrara. smile

You’ll find Python much easier to work with than assembler. Maybe PySwarm will help spawn a whole new Carrara revolution of developing reusable Python scripts! wink HA! Now that is a thought. If there are enough people interested, I might even try my hand at doing some video tutorials on this topic. But I’m still a long ways from that!

BTW, my second use of PyCarrara is to integrate the use of music and other sound files to manipulate objects. Frederic only briefly explored this with a few sample scripts, but they were with MIDI files. I’ve already done some basic tests using .MP3 and .WAV sound/music files, so I know it is possible to drive animation with sounds in other more readily available and standard formats. (Imagine using the sound of breaking glass to drive the explosion of a glass goblet or the hum of a motor to drive the shaking action of an engine. No need to attempt post-sync’ing your video and audio for one thing.) I’m still working on how to design a user interface that makes this principle available for non-programming Carrarans. I’m hoping to be able to post a few demos of this idea in the next month.

 

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 11:04 AM   [ Ignore ]   [ # 28 ]
Power Member
RankRankRank
Total Posts:  1194
Joined  2005-04-12

Wow, you don’t let the grass grow, do you!  I hope that your work will inspire more people to look into scripting.

Profile
 
 
Posted: 27 October 2013 12:31 PM   [ Ignore ]   [ # 29 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-07-03
PhilW - 27 October 2013 11:04 AM

Wow, you don’t let the grass grow, do you!  I hope that your work will inspire more people to look into scripting.

Like the saying, “I don’t want to die with my in-basket empty.” wink

 Signature 

The most complex object in mathematics, the Mandelbrot Set ... is so complex as to be uncontrollable by mankind and describable as ‘chaos’. — Benoit Mandelbrot

Profile
 
 
Posted: 27 October 2013 02:19 PM   [ Ignore ]   [ # 30 ]
Addict
Avatar
RankRankRankRank
Total Posts:  6183
Joined  2007-12-04

Well I just read through the pdf and find this to be a beautiful interface, as it were wink
This is excellent! Thank you! I still have to get PyCarrara, so there’s one more dl… but it says I also have to get Python. I imagine that’s just a search away, too.

Again, thanks for this!

 Signature 

Dartanbeck @ Daz3d          Check out the Carrara Cafe          ►►►  Carrara Information Manual   ◄◄◄

Profile
 
 
   
2 of 22
2