Adverti horiz upsell
Maya|Dynamics - Interparticle Collisions
Maya|Dynamics - Interparticle Collisions
sdb1987, added 2005-09-19 15:01:35 UTC 65,392 views  Rating:
(3 ratings)
Page 1 of 1

Edited by nathaniel adam briggs - syntheticMagic.com


Ok, this tutoral on interparticle collisions (particles from the same emitter colliding) and particle - particle collisions (particles from different emitters colliding) is fairly simple. Anyone who is comfortable with using emitters and the Dynamic Relationships Editor will be able to follow it easily (I hope). There are no scipts, plugins or expressions used, so don't worry.

I have only been working with Maya for 6 to 7 months now, so this may not be the best or most efficient way to do this, but it works. If someone has already written a tutorial similar to this, I apologize.

Right, for this tutorial we'll make a scene with a container that fills up with particles. This could be usefull for simulating liquid with blobby particles. Oh, I'm using Maya Unlimited 4 to do this, but it should definetly work with Complete and perhaps even earlier versions of Maya.

A playblast avi (DivX 5) of a similar (pouring liquid between cups) scene I 'prepared earlier' can be downloaded here container.zip. It's 630k.

Section 1: Creating the Scene

1. Start a new scene and save it as "container.mb" (or something equally obvious).
2. Set your playback speed to 'Play every frame' in the Animation Preferences so that the particles will calculate properly.
3. Create a polygon cylinder, name it "Container" and extrude the top cap in, then down, to create a simple container like in the picture below:



I have my perspective viewport in X-Ray shading mode so that I can see inside the container easily, I recommend you doing this too.

1. Next, create a particle emitter with it's default settings, called it "Liquid" and move it just inside the top of the container.
2. Going down the list of attributes in the Channel Box, change these settings:

Emitter Type: Directional
Rate: 10
Direction X: 0
Direction Y: -1
Spread: 0.3
Speed: 2

These settings will cause particles to spray down into the container. The rate is only set to 10 because if you emit partcles that collide too fast, they'll bounce off each other and spray all over the place!

3. Select the actual particles (not the emitter) and open it's Attribute Editor.
4. Down in the Render Attributes rollout, change the particle render type to Blobby.
5. Change the radius to 1. That's a fairly large radius but for this tutorial we don't want thousands of little particles, just a fair amount of large ones (otherwise it'll take forever to fill the container and will need a lot of memory to calculate).
6. Close the Attribute Editor and with the particles still selected (not the emitter) create a default Gravity field.
7. Now we need the particles to collide with the container, so just select the container, then also select the particles (hehe not the emitter) and choose 'Make Collide' from the Particles menu.
8. One last thing to do to in this section is to prevent the particles from bouncing out of the container. Select the particles (not the emitter) and scroll the Channel Box down to the section called 'GeoConnector'. Open this section and change the Resillience to 0.4

Now if you play your scene, you should see particles spraying into the container and filling the bottom layer. Not very convincing liquid yet though, because all the particles go through each other and so the container doesn't fill up.

Here is an image of how it should look so far:



Section 2: Making the particles collide

Ok, the actual interparticle collisions part. It's so easy that you'll probably kick yourself for not thinking of it (or not).

In Maya, objects can be the source of fields, right? Right. So you could have a Sphere that has the force of an Air field (air is just an example). An object's vertices can also be the source of a field, so each of the Sphere's verts could have the force of an Air field.

Well, guess what else can be the source of a field? Particles! Either as a whole, or on a per particle level.

So to get interparticle collision, I make each particle be the source for a Radial field (that affects an area equal to the particle's radius). Then I make those same particles be affected by those Radial fields, so in effect, they bounce off each other. If you have thousands of particles all with their own radial field, it can get quite memory intensive, but it's not too bad.

1. Select your spraying particles (not the emitter) and create a default Radial field (which will affect the particles because you had them selected during it's creation).
2. Now select the Radial field and going down the Channel Box, change these settings:

Attenuation: 0
Max Distance: 2 (you have to try and alter this value to represent the radius of the particles). To me it seems to need to be double the radius.
Apply Per Vertex: On (makes each particle emit a Radial field).
Radial Type: 1 (makes the collision more solid),

3. Next, select the Radial field together with the particles (not the emitter) and from the Fields menu, choose 'Use Selected as Source of Field'.

That's it! Now if you play your scene (set the range to 1000 frames), the particles should collide with each other and fill up the container. You'll probably notice that the particles don't really settle very well, they keep on bouncing around in the container.

This can be solved by selecting the particles (for the last time, not the emitter) and setting their Conserve attribute to a lower value. I recommend around 0.85

To make different emitter's particles collide, you would just need to setup another particle emitter with Interparticle Collisions, and then using the Dynamic Relationship Editor, make the particles be affected by each others Radial fields as well. I hope some people found this tutorial useful, I feel it creates a lot of possibilities for cool effects.

If you find that something in this tutorial is wrong, or you'd just like to comment, please use the email link below.

Thanks!

Jared Martin