PDA

View Full Version : branching pflow


xXm0RpH3usXx
12-11-2009, 05:45 PM
Hey folks,

I am fiddling around with maxscript and particle flow lately.
To have a goal, or something to work on, I started thinking of making trees with the particle flow system combined with a maxscript.

I have already made a little custom script which generates custom deflectors in foliage form (normal meshes i will add to a deflector) and use a script i downloaded which makes splines out of the particle's path (its not working 100% so i think i'm going to need to remake that later on.

I hope someone gets interested, I am totally in for any input you want to make, everything that could help is appreciated!

So far i actually set up a pflow which branches already, man that already cracked my head :P
I'm not quite sure on how to change the angle the new particles branch in in both directions, but i guess i will somehow get this to work!

Just to make it not only text i made a quick shot, though the attached 3D file will be of more visual help!

You can download the file here, maybe someone wants to fiddle around with it:
http://www.speedyshare.com/files/19737911/branching_pflow_test2.max


Update:

I tweaked the settings further:

The child branches are shorter than their parents
The branch end and start have the same icon, makes distinguishing two branches from another easier
Also I found out that the Speed Operator somehow has like the orientation in it, i ask myself what the Rotatition Operator than is good for?
Because in my test settings it does not affect the direction of the subbranches...

How do I make the subbranches face the right direction?
Because the Speed Operators default settings only let me control that vaguely!
I also uploaded a new version of the set up here:

http://www.speedyshare.com/files/19741774/branching_pflow_test3.max

And this is a generated branch mesh with splines, not yet really beautifull, but one can see where i am aiming for (you can see the mesh inside the .max file aswell):

http://imagehoster.us/images/70branchobject.png
http://imagehoster.us/view.php?filename=70branchobject.png

noouch
12-12-2009, 01:05 PM
I did pretty much exactly the same thing you're doing minus the splines.

The rotation operator will not change the velocity of the particle, just the orientation in itself, which isn't relevant if your particle is just a point. The best way to control the direction of the branches is either with some forces and drag, or with a script operator, which will probably have your head spinning the first few days, but it's definitely worth it if you're going to be doing lots of particle stuff.

xXm0RpH3usXx
12-12-2009, 01:58 PM
a reply! *freu*

****, i actually feared that someone would say that!
i'm not going to use the forces, i would need to set a force at every branche's offspring!
thats not handy...

Did you already implement the direction control?
Thanks for the rotation hint, i thought that the particle would fly in the direction its facing, but I see I am wrong on that!
I do need to do an extensive research on how to code with pflow then...

Maybe something like the direction of the parents' particle +/- an angle one can define via a rollout

OlegB
12-12-2009, 08:51 PM
Another option is Box#3 extension for Particle Flow - http://www.orbaz.com/products/particleflow/box3/ - that allows you to do animations and constructions like this one - http://www.orbaz.com/forum/viewtopic.php?t=359 - see the BloodMoon animation in that topic.

Thanks,
Oleg B.

xXm0RpH3usXx
12-13-2009, 02:17 PM
well, if my sucky internet connection lets me i will download the demo though i am a bit confused, there is only a validation file to download for 2010 64 Bit, whereas there are actual demo versions downloadable for other versions, whats the difference?

And to be honest i dont want to pay 500 Euro for that and i dont want everybody who wants to use this script (i plan on making it open source once finished) to buy that just because of it...

So far i found out that i can emulate the Speed Operator relativly easily with a Script Operator, only turining true the Speedchannel.
I then save the pCont.particleSpeed of the first branches' tip in a global variable called vectorparticle01 (just a testname, it is the first particle spawned though) and retrieve that in a second script i have placed in the event where the second branches' tip is flying away...

Now i dont know how to use that in an intelligent way, I found out that one can rotate the point3 value's facing with multiplying with a quat so i am trying this now:

myangleaxis.axis = x (x will be defined via the ui when its done, now its 90 just as a test)
myquat = myangleaxis as quat
pCont.ParticleSpeed = pCont.ParticleSpeed * myquat

Though I am not that focused and concentrated to actually evaluate its usefullness...
I think i messed up some stuff here and dont use the right values or whatever...

Is there anyone interested in the .max files?
Its a pain in the ass for me to upload them due to my bad connection, but I would do that if it actually servessomething, but not if nobody even cares...

OlegB
12-13-2009, 02:22 PM
And to be honest i dont want to pay 500 Euro for that
Yes, Box#3 is a commercial extension for Particle Flow. But it's not 500 Euro - it's a bit less - $495 = 339 Euro with the current exchange rate.

Thanks,
Oleg B.

noouch
12-13-2009, 04:49 PM
Did you already implement the direction control?
Thanks for the rotation hint, i thought that the particle would fly in the direction its facing, but I see I am wrong on that!
I do need to do an extensive research on how to code with pflow then...

Maybe something like the direction of the parents' particle +/- an angle one can define via a rollout

I implemented it in 2D which is pretty simple and straightforward. The result is this:
http://noouch.de/video/progplant_new_01.mov

Unfortunately 3D rotation is a bit beefier, and last time I failed to wrap my head around it:
http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/3drota.htm

The way I rotated was using the rotations described in the first three examples.

Another (possibly easier) way you could rotate the branches would be to convert the velocity vector to spherical coordinates, rotate, and then convert back to cartesian coordinates:
http://en.wikipedia.org/wiki/Spherical_coordinate_system

xXm0RpH3usXx
12-17-2009, 07:05 PM
Thanks for the info, working with the spherical coordinates worked out to be not too complicated!
i made some progress, nothing big, i am still not really sure what values to put in to get the right effect, but i came up with some values that looked good for a test!

http://img34.imageshack.us/img34/5629/branchobject02.png

The only problem is that somehow the branch tip particles sometimes choose a different direction during their flight...
But not always, most of the branches are fine, but some aren't...

http://img34.imageshack.us/img34/2783/branchobject03.png

I guess thats because i had to use the speed operator in the on pCont.Proceed handler (is that the right term?)
but it is listed under "proceed" whatever it is called in the list at the bottom of a new script!
so i cant use it on the Init event, can I?

Here is the testscene as usual:
http://www.speedyshare.com/files/19837936/branching_pflow_test5.max

Any ideas on how to save the vectors of the second branche's tips and call them for the appropriate child branch?
It was easy, because i only had one first branch, to save and read the appropriate vector, but in this step i used a few "random" functions, so i dont know the exact speed point3 of them and i dont know how to tell maxscriptp to use the appropriate...
Or so to say how to tell maxscript what is appropriate

CGTalk Moderation
12-17-2009, 07:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.