Learn how to set up FX and particle systems in Maya with industry pro Mike Zugschwert, in this sample chapter of our popular eBook?
To start creating an animation of water I need some geometry to simulate my water against. I am going to model a glass and a bottle to pour water from. It is important to keep scale in mind when you model. In my preferences under the settings category, I make sure my working units are in centimeters and then I model everything roughly to real-world scale (Fig.01).
Now I can add some particles to the scene, but first I can take advantage of an nParticle preset. Under the menu nParticles > Create nParticles, there are five options for default particle settings (Fig. 02).
I select Water and then in the same menu, use Create Emitter. This will create an omni emitter and an nParticle object in the scene. By default, omni emitters have their Max Distance set to 0, which means all of the particles will spawn in the exact same place. This will be problematic for my water simulation because the forces that drive the simulation will cause the particles to shoot away from each other very quickly. So in the emitter's Attribute Editor, under the Distance/Direction Attributes I set Max Distance to 2 for now and I can adjust this later. I also set my emitter rate to 500 and place the emitter inside the bottle (Fig.03).
Another thing to change right away is the Substeps count for the nucleus solver. The default is 4, which can lead to unstable simulations. I turn it up to 12, and if during my simulations I see particles exploding or moving through collision objects I can turn it up more. Also I enable the Use Plane option under the Ground Plane options. This will keep any particles that miss the glass from falling into infinity. If I didn't create my geometry at the origin, I could create a plane in my scene to use as a collider (Fig.04).
Finally, I need to add the geometry as collision objects for the particles. With my geometryselected I go to nMesh > Create Passive Collider. This will create new nRigid objects in my scene for each object in my selection. In the Attribute Editor for the nRigidShape I can adjust the collision attributes like thickness, bounce, and friction. The default values should work just fine.
Now I can playback my scene to watch my simulation. The default values for the water preset work pretty well, but there are some improvements I could make.
Tip: If you don't use the water preset, the most important thing to do is enable Liquid Simulations and turn off Self Collisions. With liquid simulations enabled there are attraction and repulsion forces that act on the particles to create the behavior of water that must allow the particles to interpenetrate. If Self Collide was turned on, it would interfere with the fluid simulation and you would not get fluid behavior.
In the nParticleShape tab in the Attribute Editor, I start by changing the particle radius. The larger the particle, the less I need to fill the glass but the less detail I will get in my simulation. A radius of .15 should work well for a scene of this scale. Also, I change the Radius Scale Input from none to Randomized ID and increase the Radius Scale Randomize to .1. What this does is randomizes the radius of the particles. This will help prevent the particles from stacking along surfaces, as shown in Fig. 05.