How to convert Particles to Objects?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  03 March 2005
this is a brain teaser.
if you right click on the newly animated objects > properties > Show Trajectories
nothing is there so I have no idea how to bake this animation....
__________________
"cry me a river..."
Eddie, in a Sarcastic tone
 
  03 March 2005
Originally Posted by Gräck: Perhaps someone has a trick?


This is rather easy and does not even require a scripted operator.
Basically you write a short for loop (actually two) very similar to the trick I used for the Atmospheric Gizmos, but the outer loop goes through the frames.
Then, on every frame (or every nth frame if you want), you go through all your particles currently in the system, read their Transformation and With Animate On () assign to the corresponding scene object, creating an animation key for it.

This BAKES all particle animations into the scene objects. The examples on my page were mostly about DRIVING objects. In those examples, removing the PFlow would kill the animation. You just need explicit keyframes for position, rotation ans scale.

We used this on Scooby Doo 2 to get particles emited from particles - we exploded the Tar Monster into approx. 300 chunks, animated with collisions etc. using PFlow, then baked to keyframes (so we could also tweak the result by hand if needed), and assigned all the chunks as emitters again, emitting small debris while moving away from each-other...

See the upper left screenshot here:


Hope this helps.
 
  03 March 2005
Thank you very much for you reply, Bobo, and the others, too.

I am a noob to MaxScript so I don't know where I have to insert the line "Animate On ()"... It was easy to modify your script so it works with standard objects. I only had to change the name "AtmosphericGizmo" to the name of the standard object and I just removed the line which causes the scaling of the gizmos.

So my question is:

Is it possible for me (MaxScript-noob) to modify your script so I get a baked animation or do I have to learn a little bit about MaxScript first? Or would it be enough reading your explanation for your script?

Otherwise, is there a chance that you would edit the script for me? I would be very thankful.
 
  03 March 2005
Originally Posted by bobo: Basically you write a short for loop (actually two) very similar to the trick I used for the Atmospheric Gizmos, but the outer loop goes through the frames.
Then, on every frame (or every nth frame if you want), you go through all your particles currently in the system, read their Transformation and With Animate On () assign to the corresponding scene object, creating an animation key for it.


I didn't know you could do that. you mean with a script from outside pflow or in max listener?
do I access the particles or the driven object? I don't know how to access particles from outside...
I"M TOO OLD FOR THIS.
I tried manually setting a keyframe at diferent frames on one object then deleting the pfsourse but that didn't work. (but without autokey I'll try it w/autokey since you mentioned animate on()

Edit: now thats weird! just by pressing auto key and playing the animation once it worked thus putting a key at each frame!!

another edit: No not really you have to advance manually throught the frames one by one which justifies the need for a script like bobo said unless the animation is 30 frames for example.
__________________
"cry me a river..."
Eddie, in a Sarcastic tone

Last edited by Werewolf006 : 03 March 2005 at 11:26 AM.
 
  03 March 2005
Originally Posted by Werewolf006: I didn't know you could do that. you mean with a script from outside pflow or in max listener?


*Create a simple default PFlow (add a Cache if you want to speed things up)
*Create a Box primitive
*Clone the Box 100 times
*Main Menu > MAXScript > New Script

Paste the following code into the new script editor:

theSystem = $PF_Source_01 --this is the default PFlow source
theArray = $Box* as array --this is the array of boxes you created
for t = animationRange.start to animationRange.end do --loop through animation segment
(
	sliderTime = t --set the slider time to the time value
	theCount = theSystem.numParticles() --get the number of particles in the whole flow
	for p = 1 to theCount do --loop through all the particles
	(
		theSystem.particleIndex = p --set the p-th particle as active
    	if p <= theArray.count do  --if the particle index is less than the number of boxes,
    		with animate on theArray[p].transform = theSystem.particleTM --set the transformation of the p-th box to the matrix of the p-th particle
	)--end p loop
)--end t loop


*Press Ctrl+E and watch the boxes following the particles.
Then you can delete the PFlow and the boxes will still be animated and exportable.

There is a small caveat - the initial position of the boxes will also get animated to their first particle-defined position. As new particles are born, new boxes will move to the location the particle is born.

If the animation is created with a constant number of particles born on frame 0, this would not be an issue. Otherwise, the script would require the visibility of the boxes to also be animated to hide this additional motion...

But I hope you get the idea...
 
  03 March 2005
Thanx Bobo this one is even better than the original script.
if I combine it with Allan Mckay's lesson on fragmentation in pflow.....
immagine the possibilities
__________________
"cry me a river..."
Eddie, in a Sarcastic tone
 
  03 March 2005
bobo, question for you.

are theArray and theSystems some variable you created and named or like a vairable for max that it recognizes. neat script tho, pretty basic stuff if you know all your functions and stuff. hmmmmm. need to learn scripting. ah well.
__________________
BUTT KICKING FOR GOODNESS!

http://www.cgtalk.com/showthread.php?t=194937&page=2

"Deconstructing the Elements..." By Pete Draper
 
  03 March 2005
Originally Posted by Largo39: bobo, question for you.

are theArray and theSystems some variable you created and named or like a vairable for max that it recognizes. neat script tho, pretty basic stuff if you know all your functions and stuff. hmmmmm. need to learn scripting. ah well.



These are user-defined variables.
I tend to name my variables theSomething, because there are no built-in variables/faunctions in MAXScript that start with "the" and it is easy to spot my user variables this way...
 
  03 March 2005
that makes sense, mk, another question for you, do you have yo define these variables as like an int, float, or long? what does a pflow system count as? just wondering who inclusinve those variables are (ie: what can you stick in them).
__________________
BUTT KICKING FOR GOODNESS!

http://www.cgtalk.com/showthread.php?t=194937&page=2

"Deconstructing the Elements..." By Pete Draper
 
  03 March 2005
Originally Posted by Largo39: that makes sense, mk, another question for you, do you have yo define these variables as like an int, float, or long? what does a pflow system count as? just wondering who inclusinve those variables are (ie: what can you stick in them).


This is a specialty of MAXScript which I love and which makes it approx. 10 times easier to use than, say, MEL or C++ (but can also cause headache if you don't know what you are doing): MAXScript variables can hold ANYTHING, do not need a type declaration (or any declaration at all) and you can switch the value stored in the same variable anytime with any other value type.
This also means that arrays are typeless (they are values of class ArrayValue) and can contain ANY values, including other arrays, which in turn can contain other arrays and so on (until you run out of memory ) This makes it easy to declare N-dimensional arrays and store anything in them at will...

All max scene object classes derive from the Node class. Each object has its own class, and instances of this class can be created and stored in MAXScript variables with user-defined names. So the PF_Source is of class PF_Source, superclass GeometryClass, super-superclass Node.
You can create and store in variables all other Max class instances incl. materials, controllers, modifiers, you name it...

Cheers,
Bobo
 
  03 March 2005
Thank you very much, Bobo, it works very well!

But there's another thing I would like to have:
How can I create loop animations with PFlow?
 
  03 March 2005
Originally Posted by Gräck: Thank you very much, Bobo, it works very well!

But there's another thing I would like to have:
How can I create loop animations with PFlow?



I don't think there is a switch you can flip, but it is scriptable.
The trick is to use a Script Operator and record the initial position (or full transformation) of every new-born particle into a user channel (either the particleVector for positions, or the particleTM for the whole matrix). Then, when a particle dies, the operator would check whether there is a valid entry for that particle index and if there is, assign the same old position to the newborn particle.

If by loopable you mean the particle returns to its point of birth after a while, then you could add the FindTarget test to the above scheme to let the particle travel back to its initial position before death...
 
  03 March 2005
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:28 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.