Today, Alan Monroig begins to walk us through his chemical mixing scene in the first part of this awesome Maya fluids tutorial. Today's part covers modeling the objects needed and how to setup the initial fluid states, whilst part two goes on to complete the fluid animation itself and add some smoke to the scene. It's time to release your inner chemist!
To create the container we will need to have a reference image to match the shape of our container to a real one as much as we can. As I'm not allowed to include the image I used with the tutorial, head to the following link and choose a suitable reference image : Google Image Search. Once you've found a suitable image, save it to your hard drive. Then, back in Maya, look through the orthographic front view, in the view menu go to “View > Image Plane > Import Image...”
The image you selected will be displayed as a background in the front orthographic view.
If you go to the perspective view you will see the image as a plane, but we don´t want the image to be displayed in any other view that is not the front view. To hide the image go to its Attribute Editor, and check the “looking through camera” option.
While looking through the front view, go to “Create > EP Curve Tool”.
Click on the “Tool Settings” button on the top right corner of the screen.
Select the “3 Cubic” option inside the “Tool Settings” window of the “EP Curve Tool”. This will allow us to create a curve with round corners.
Make a curve that matches to the shape of the container on the background. (Note you also need to match the shape on the inside of the container)
At the “Surfaces” menu, go to “Surfaces > Revolve (option box)”.
Inside the revolve option box, increase the segments to 16, make the output geometry “Polygons” and the “Tessellation Method” to control points. (When need the object to be a made of polygons instead of NURBS because nDynamics only works with polygons)
When you click on Revolve, the curve we created before will transform into a polygonal container.
Go to “Edit > Delete by Type > History”, this will disconnect the container from the curve.
Select and delete the curve. If you followed correctly step 11 the container should not disappear.
Scale and position the container to the desired position.
Look through the Front View.
Go to “Create > EP Curve Tool”.
Create a curve with the shape of our second container.
Revolve the curve with the same option we used before.
Select the container.
Go to “Edit > Delete by Type > History”.
Scale and position the container.
Select and delete the curve.
Make the vertexes of the container selectable.
Select the vertexes at the top of the container. (Also in the inside).
Move those vertexes towards the outside the container.
With the container selected, go to “Edit Mesh > Insert Edge Loop Tool”.
Insert an edge loop just before the vertexes we selected before, this will polish the shape of the container. (Feel free to modify the shape of the container in your own way).
This is how the container looks now.
Make the vertexes of the container selectable again.
Select the vertexes at both sides of the extruded section of the container.
Select the scale tool and scale the vertexes towards the inside of the container.
This is how both containers look.
Make sure both containers are at the same distance from the floor.
Create a background for our scene, any background can work.
Go to “Window > Rendering Editors > Hypershade”.
Inside the Hypershade, create a new Phong material.
Open the Attribute editor of the phong material, add a name to it, change the color to black, the transparency to a white grey and the Ambient Color to black.
Scroll down to the “Specular Shading” section. Change the “Cosine Power” to 75, the “Specular Color” to grey, and the “Reflectivity” to 0.380.
Add that phong material to our containers.
Go to “Window > Outliner”.
Name both containers. This is just to have an organized scene.
Select both containers.
At the “nDynamics” menu, go to “nParticles > Create nParticles > Fill Object (option box)” make sure “Water” is selected”.
A window with nParticles options will show up, increase the resolution to 30, and the “Max Y” to .6, make sure “Double Walled” option is checked. (the “Max Y” option determines how full the container is, note that the water will compress, so this value will be at least half).
When you click on particle fill, both containers should have the same particle system inside.
Make the scene at least 600 frames long, and rewind the animation.
Select the nParticle system, go to its Attribute editor, increase the “Radius” to .340 (this will vary depending on the size of your scene), under the “Collisions” section, change the “Collide Width Scale” to 0.600, this will compress the particles creating more realistic water.
Scroll down to the “Liquid Simulation” section, and change the “Liquid Radius Scale” to 0.600.
Go to the nucleus options, and increase the “Substeps” to 10.
Go to “Create > Polygon Primitives > Cube”.
Create 2 cubes and move them on top of our containers, they will act as a cap, for the water not to go out of the containers.
Select both containers and caps.
At the “nDynamics” menu, go to “nMesh > Create Passive Collider”. This will make the objects collide with the nParticle system.
Play the animation (it will play really slow).
Stop the playback when all particles settle down, and they are not moving. (Note particles compressed during the playback)
Select the nParticle system, and go to “nSolver > Initial State > Set From Current”. This will make the water stay in the same position the whole animation, unless something interacts with it.
Delete the cubes we created before.
At the view menu, go to “Show > nParticles (uncheck that option)” this will hide the water, and allow us to create the animation of the container faster.
The water should not be visible.
Animate the container.
Rewind the animation.
Make sure to make visible the water again, go to “Window > Playblast (option box)”
Select the time range where your animation takes place, and where do you want to save the file. Click on playblast.
This will create a file with the animation. Check that the water is doing what you want it to do. If not, adjust the container animation and do another playblast. I did 10 playblasts before I liked the animation.
So that's it for this first part. Look out for the second part coming soon!