View Full Version : particle goal

03 March 2003, 12:13 PM

I animated a poly character and I need to cover his entire body with particles.
So I created an emiter from the surface of the poly, the result is good. Now I want the particles to follow the movement of the body, so I make the poly a goal for the particles. The problem is particles' goal is not the poly surface but its vertices, and the result is very ugly. What I want is the particles's goal to be the poly surface just like they do when emitting.
I know it's easy to do with nurbs and some expressions with parentU/V and goalU/V, but I can't convert my model to nurbs cause it's too slow and make maya crash.

anybody has a solution please ?

03 March 2003, 12:31 PM
then you create the emitter make sure you switch on need parentUV

after that create the two attr goalU and goalV

make the surface a goal for the particles
and set the goal to 1 at first

creattion expression

goalU = parentU;
goalV = parentV;
goalPP =1;

then in a runtime expr you can lower the goal so that the particles are not sticky to the goal

goalPP = 0.8;

so just set it to a frame where all your particles are created

ohh shit, i should have read your whole text :)

so why it crahes if you use a polygon i don't really know. maybe try to lay out your uvs better !?

03 March 2003, 01:45 PM
yeah.. unfortunately polies dont work with goalUV..

can you keep emitting your particles?

if not there is still a rather mean workaround:

- create your particles
- use my particle deformation script from highend to create a poly surface from the particles pos.
- assign the new poly surface as a goal for the particles (goal weight 1)
- deform the new poly object with the same settings as your underlying poly surface.

like that the particles will follow 100%..

but will be kinda slow i fear - but have a try



03 March 2003, 04:14 PM
you could do your own goaling in expressn perhaps..
not at my box, but i reckon you could just find the vertex index from which a particle was emitted by simply looping through the particles by the numner of vrts, giving you a list of particle ids for each vrt, which then do your goaling expression for them about their vrts. can do this as dynExpression. ill have a play at this when i get back to my box, but seems like it should work?

03 March 2003, 04:56 PM
yes.. but then he would still have the problem, that he could only goal the particles to a vertex and as he wrote that is not intended.. ;)



03 March 2003, 06:59 PM
Thanks for your answers !
I'm afraid I was wright and it's impossible to goal particles to polys' UVs.
Alexx thanks for your tip I will try your script.

03 March 2003, 07:47 PM
if you dont wanna search for it:

particleDeformationPoly.mel ( )

good luck :)


edit: just to mention: that script is farm from being bullet proof.. so handle with care :) (not that it would kill something or so.. but if you have a look in you will see what i mean :)
btw: i tested it in production with 70.000 particles and all was fine

03 March 2003, 08:39 PM
Is there a way to use some kind of neutral-pose reference object to place the particles? hmm...

-- Mark

03 March 2003, 11:15 PM
I think I figured it out!!

Take a look at this avi, go to:

And then download sticky.avi, it's 260k compressed in DivX 5.03.

Is that what you're after?

03 March 2003, 07:42 AM
shite, pardon me! so the aim is to have particles evenly covering the surface, and sticking to that surface as it moves about? do you want your goaling to make the particles static, stuck on the surface? or with movement? (what i thought initially) for the case w/o movement, just sticking to the surface, you might try colliding the particles w the surface, w friction 1 and resiliance 0, sucking the particles onto it w appropriately placed fields, or maybe some simple nurbs surfaces as goals that can be bound to the same deformation system as the poly. this might not work so well, get some jumping problems. just dl'ed codec for this box, and now see your animatn jozvex, cool!, look forward to hearing how you achieved it!

just had another thought, depending heavily on what your doing with your particles, maybe you could use an emit from texture setup, and have particles last only a frame, and emited from texture once per frame, turning over all the particles each frame? doh, nurbs only!

thinking more about a reference-object-like setup that mark suggests ..

03 March 2003, 07:48 AM
Jozvex > that's exactly what I want to do, but in the video the ball seems to be a nurbs sphere, I need to do it on a poly sphere and that's the problem !

Wrend > yes my particles need to stick on the surface in order to recreate the shape of my character, then I can add some turbulence to make them move a little.

For the moment I smoothed my poly object so that the particles still stick to the vertices and it looks better cause we can't see very well the structure of the mesh.

03 March 2003, 07:51 AM
By the way thanks for the script alexx !

Mark R. Wilkins > I've just ordered your Mel Scripting book, I'm very eager to read it !!:applause:

03 March 2003, 08:29 AM
No no my sphere is polys!

And I think I may have just found an even better way! Just a sec!

03 March 2003, 09:41 AM
Originally posted by Jozvex
No no my sphere is polys!

And I think I may have just found an even better way! Just a sec!

can you enlight us *how* you did it?



03 March 2003, 12:13 PM
yes Jozvex tell us how you did it.... please .......
Anyway I managed too thanks to your script alexx !
It worked perfectly. I emitted particles from my poly model with a speed of 0 so that they look stuck to the poly. I then set initial state to them and applied your script. This gave me a very weird poly object but with vertices situated at the exact coordinates of the original particles. Finally I skinned this poly to my bones and make it a goal to the particles so that they stick at the vertices that were previously the old particles..... a bit complicated to explain but very easy and quick to do !
THANKS AGAIN !! :beer:

03 March 2003, 07:30 PM
hey seb4d..

great that it worked for you.. i had the fear that it is a bit complicated to set up.. but when you get the idea behind it it is quite simple and straight forward..

but i am still curious how josvez managed to get it.. :)



03 March 2003, 08:16 PM
yes me too, I'd like jozvex to explain his method.


03 March 2003, 12:41 AM
Ok guys, sorry I didn't reply but it was getting late for me here in Australia.

Hmm, it's looking like my way isn't as fantastic as I thought, though you guys might be able to figure out the next step.

The way my avi works is basically the same idea as Wrend's when he suggested:

"you might try colliding the particles w the surface, w friction 1 and resiliance 0, sucking the particles onto it"

I created my sphere, emitted the particles from the surface with a Min and Max distance of 0.1, they collide with the sphere (resiliance 0, friction 1, conserve 0) and are sucked towards the center because there's a Locator acting as a goal inside the sphere. That keeps them stuck to the surface even with deformations applied.

Now, the problem is that if any parts of the surface fold over, (ie with a bend deformer for instance), because the particles are trying to get to the centre, they jump accross the fold. And, the friction and resiliance settings can't seem to prevent particles from still sliding along the geometry.

Example avi:

See fold.avi.

So, unless your character is a sphere, it won't really work. But I have 2 more ideas on improving it!

1. What if you did the same thing, but instead of the goal being a locator, you emitted the exact same particles into the inside of the geometry, then made both sets of particles the goal to each other!

Then they would sort of magnet each other to the surface. Get what I mean? Each particle and it's 'inside double' would be trying to to get to each other, but would collide with the surface. Pinning themselves to the mesh.

2. My other idea is totally different. What if when the particles collide with the surface, you record the per-particle contact data position and then make those positions be the per-particle goal.

So they always want to stay in the position where they contacted with the surface.

Any ideas?

03 March 2003, 04:10 AM
i feared just such problems with this approach 8(
thought that using a goaling surface instead of just a point field, allowing you to rig it in with the poly geometry, hopefully reducing the amount of sliding/jumping. or volume fields hierachicaly animated as an inbetween method.

i really like your idea of the inner and outter particles goaling to each other! wonder about feedback problems tho. have a play when i get back to my box (sux having net and workstation disslocated!). not sure about your second suggestion, what kind of position data are you talking about? world/local/UV? and how do you track that point during defomation? how easy it to go from world position to UV and back i wonder?

had another thought, though it may be too slow.
use the polyMeshInfo node, or similarly named. you could then have a bunch of particles that loop through the number of faces on your model, each one flipping the face id of the node to their corresponding face and sucking the position out (done w/o using MEL commands, in dynExpressn). this also gives you the option for movement about the face w animatn of the U/V position, and for initial placement. if your faces arent uniform in size, you might need to do some weighting on which face id's get more or less particles on them (use the polySelectnConstraint to grab the ids). might do the trick, might be to slow, might need to break the particles up into seperate shapes to reduce the dynExpression evaluation times (if your use of the particles permit this ...what are you doing with them?).

had a chance to play w this mark? cooking up some solutions?

03 March 2003, 08:10 AM
All these methods seem interesting although a little bit complicated for me :p

I did what I explained previously with Alexx' script and I got the result I expected. I just needed particle to get the shape of my model and follow it.
You can see a short example on my web site , in the 3D section (link below).


CGTalk Moderation
01 January 2006, 05:00 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.