Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 28-08-2007 , 01:27 PM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991

bFlocking artificial flocking tool

Here's a custom Maya tool I've written in Python to generate artificial flocking or 'boids' based on the work of Craig Reynolds. Its an early version but has a few controls in that might be useful.
It might also be useful for people learning Python within Maya as it generates windows with user interface controls as well as generating objects in random locations.

bFlocking v0.1 Maya 8.5+

Have fun user added image
Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 2 28-08-2007 , 06:09 PM
AlphaFlyte's Avatar
Subscriber
Join Date: Nov 2003
Location: Sweden
Posts: 326
Quite an impressive project you got going here Si. I haven't taken it for the test spin yet, but I will try to find someone with Maya 8.5 in my surroundings and see how it does.
I'm glad they incorporated Python too now. It really seems like power at your finger tips and it seems quick to learn. Have you read any really great Python books? I'd love to dig a little deeper than say "Hello world" and basic loops.

Can't wait until velocity and separation is keyable. Perhaps in v0.2? =)

Thanks for sharing. It's going to be interesting to see the UI python code, as well as the flocking of course user added image


Currently working on reclaiming Space
The Salvation Prophecy
# 3 29-08-2007 , 12:59 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
'In the scripts folder there may or may not be a userSetup.py. If there is not then create it '

err, no i dont have this in my folder and i do not know how to create it much less edit it. Never used python Tick, is there a tut i can find to create this usersetup.py


take it easy and life will be easy
# 4 29-08-2007 , 01:08 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
Thanks AlphaFlyte user added image
Yeah I'm glad they incorporated Python into Maya as it is a powerful language and is incorporated into loads of things now - I used to play Eve-online and it was good to hear that they use it lots in that.
The actual catalyst to using Python and not Mel was because I still do a little work at my old job writing custom elements for a Content Management System called Plone - and it is written in Python user added image
I also had a play with Mel and once you know a C style language (PHP in my case) then it is real easy to pick up and use.

No books, it was all online (and therefore free)
I just visited the Python website and started reading a few things in the beginners section https://wiki.python.org/moin/BeginnersGuide/
and guess what? I even went through the good old hello world stuff user added image Still havent gone through tuples and dictionaries yet tho..

If you want to rip out the UI code and have a play with it then please do - it is really quite straightforward, the only problems I had was that some of the options/methods dont seem as clear as in Mel but thats probably because its newer. There are comments in the code that might help understand it a bit better.

Some kind of caching is definitely the next step as realtime playback can be really bad if there are lots of boids/objects

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 5 29-08-2007 , 01:12 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
sure mirek,

Open up notepad (or if on the Mac then the equivalent text editor) and type in the required line. Now save the file as userSetup.py in the folder that it states. If using windows then it might try and save it as userSetup.py.txt so in the 'save as type' box change it to 'All Files'. This should remove the .txt bit
Now restart Maya and things should happen user added image

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 6 29-08-2007 , 03:46 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
Ah ha, just found out how to access particles as a group as well as individual particles and their attributes through Mel/Python.
This means I should be able to rewrite the system to use the particle generation method (i.e, the user can add the particles where they want on screen) and also use the particle caching system that particles have access to user added image

Edit: This should also allow me to use the particle object (hodling all the particles) as the keyable object for changing velocity and separation etc...

Cool!

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net

Last edited by t1ck135; 29-08-2007 at 03:50 AM.
# 7 29-08-2007 , 04:48 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
sounds like your on a happy roll tick user added image

the movies are getting intensive.., i spent a couple of hours with the script but because i dint know how to write the python script (now you have shown me) I sort of ended up playing with particles and fields.

great you are getting this happening.

point.., it could take a while before I get this together.., im starting to get paralysis from the stress of too much work.., too many deadlines.., but it will get done. priorities!

Muser added image


take it easy and life will be easy
# 8 29-08-2007 , 06:23 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
hehe, its good fun getting into the particle thing (not that I've done much yet) user added image

I might have a new version up at the end of the week that uses the built in particles for generation and placement. I'm just cutting out lots of unnecessary code at the minute and am hoping to get it all going - it'll make it a lot simpler to do stuff, kind of going along the lines of what Steve (gster) was saying

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 9 29-08-2007 , 03:14 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
i got half way through reading that stuff Steve was doing with boids (???.., sounds like 'androids'..??) and sort of went blank.., sounds amazing. I like code but html is about my limit and CSS, maybe a little kava and action script but VERY limited.., maybe one day.., but I think id prefer to storyboard something.., maybe if i get a few years behind bars sometime I'll check pythion script (thats a joke!)

Muser added image


take it easy and life will be easy
# 10 03-09-2007 , 01:56 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
I'm gonna have to put a temporary hold on the rewrite using maya's particle system mirek. Got some things to get sorted for next week but hopefully once thats out of the way I can get back on track.

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 11 03-09-2007 , 09:13 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
no problem, the movie gets locked off in a couple of weeks. Ill have a go with what I got unless you get it togeher. I was talking to the guy yestrday, he wants me to have a go at it.

Muser added image


take it easy and life will be easy
# 12 03-09-2007 , 09:40 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
I think you have done a good job of it.., there are a few errors thrown up lile 'no sims' (whatever that is?? But im running my first simulation now. I am brain dead at the momet..,, so, how can I change the objects to whatever I create as flies,, as Steve said, probably cubes with wings.


take it easy and life will be easy
# 13 04-09-2007 , 05:27 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
the code has a line that creates a polysphere or cone but that should easily be modified to make a copy of an existing piece of geometry.
If I get a little spare time tomorrow morning I'll try and complete the rewrite where it uses mayas particle system (90% complete already). Then judging from some particle tutorials I've seen it should be easy to swap the particles with a model of your choosing and also be able to use the caching element (which I've already got working ok).

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
# 14 04-09-2007 , 06:51 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
mate, i know you have a lot of work on.., only if you can!

I did a render and it only rendered the first frame.., I think it should be hardware render?? but my graphics card cant do it with 8.5.., i'lll have to put the ATI back in.

cheers dude


take it easy and life will be easy
# 15 04-09-2007 , 07:04 PM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
There you go mirek, version 0.2
https://www.flash-fx.net/3D/tools/bFlocking/

View the readme files for new instructions on using Maya's particles instead of them being auto generated.
All you will need to do is copy the new bFlocking.py over the old one.
I've included some default settings for swarming in the readme that might help user added image

EDIT: The last version didnt work correctly with frames and so as you found you weren't able to render it properly. This version definitely now works when rendering per frame.

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net

Last edited by t1ck135; 04-09-2007 at 07:09 PM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads