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!
Step 1
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…”
Step 2
The image you selected will be displayed as a background in the front orthographic view.
Step 3
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.
Step 4
While looking through the front view, go to “Create > EP Curve Tool”.
Step 5
Click on the “Tool Settings” button on the top right corner of the screen.
Step 6
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.
Step 7
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)
Step 8
At the “Surfaces” menu, go to “Surfaces > Revolve (option box)”.
Step 9
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)
Step 10
When you click on Revolve, the curve we created before will transform into a polygonal container.
Step 11
Go to “Edit > Delete by Type > History”, this will disconnect the container from the curve.
Step 12
Select and delete the curve. If you followed correctly step 11 the container should not disappear.
Step 13
Scale and position the container to the desired position.
Step 14
Look through the Front View.
Step 15
Go to “Create > EP Curve Tool”.
Step 16
Create a curve with the shape of our second container.
Step 17
Revolve the curve with the same option we used before.
Step 18
Select the container.
Step 19
Go to “Edit > Delete by Type > History”.
Step 20
Scale and position the container.
Step 21
Select and delete the curve.
Step 22
Make the vertexes of the container selectable.
Step 23
Select the vertexes at the top of the container. (Also in the inside).
Step 24
Move those vertexes towards the outside the container.
Step 25
With the container selected, go to “Edit Mesh > Insert Edge Loop Tool”.
Step 26
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).
Step 27
This is how the container looks now.
Step 28
Make the vertexes of the container selectable again.
Step 29
Select the vertexes at both sides of the extruded section of the container.
Step 30
Select the scale tool and scale the vertexes towards the inside of the container.
Step 31
This is how both containers look.
Step 32
Make sure both containers are at the same distance from the floor.
Step 33
Create a background for our scene, any background can work.
Step 34
Go to “Window > Rendering Editors > Hypershade”.
Step 35
Inside the Hypershade, create a new Phong material.
Step 36
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.
Step 37
Scroll down to the “Specular Shading” section. Change the “Cosine Power” to 75, the “Specular Color” to grey, and the “Reflectivity” to 0.380.
Step 38
Add that phong material to our containers.
Step 39
Go to “Window > Outliner”.
Step 40
Name both containers. This is just to have an organized scene.
Step 41
Select both containers.
Step 42
At the “nDynamics” menu, go to “nParticles > Create nParticles > Fill Object (option box)” make sure “Water” is selected”.
Step 43
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).
Step 44
When you click on particle fill, both containers should have the same particle system inside.
Step 45
Make the scene at least 600 frames long, and rewind the animation.
Step 46
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.
Step 47
Scroll down to the “Liquid Simulation” section, and change the “Liquid Radius Scale” to 0.600.
Step 48
Go to the nucleus options, and increase the “Substeps” to 10.
Step 49
Go to “Create > Polygon Primitives > Cube”.
Step 50
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.
Step 51
Select both containers and caps.
Step 52
At the “nDynamics” menu, go to “nMesh > Create Passive Collider”. This will make the objects collide with the nParticle system.
Step 53
Play the animation (it will play really slow).
Step 54
Stop the playback when all particles settle down, and they are not moving. (Note particles compressed during the playback)
Step 55
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.
Step 56
Delete the cubes we created before.
Step 57
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.
Step 58
The water should not be visible.
Step 59
Animate the container.
Step 60
Rewind the animation.
Step 61
Make sure to make visible the water again, go to “Window > Playblast (option box)”
Step 62
Select the time range where your animation takes place, and where do you want to save the file. Click on playblast.
Step 63
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!
Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.