“How can I use Maya to create an animation of wine pouring into a glass?”
If you had asked me the same question a few months ago, my answer would have been quite different. I would have stepped you through Maya’s built-in fluid system and then shown you all of the tricks and cheats to get it looking acceptable. However, now that we live in a world where Maya 2015 has completely reimagined its fluid simulation system, there is really only one method I would recommend, and it’s called Bifrost.
Originally developed by Exotic Matter and using Naiad technology, Bifrost is a procedural engine, capable of generating liquid simulations. Based on a FLIP (Fluid Implicit Particle) solver, Bifrost can generate liquid from emitters, which then react to gravity and also be directed using colliders and accelerators.
Although fully integrated into Maya, the simulation calculations are actually handled externally by the Bifrost Computational Server. Using Viewport 2.0, this enables you to author, refine, playback and scrub within Maya, all while the simulation is actually being processed in the background. Such interaction is crucial to bringing a greater level of creativity and control, while still providing a very high degree of efficiency.
Over the following steps I’ll introduce you to the Bifrost system and show how to get a basic simulation up and running. I will step you through the process using a simple scene involving pouring wine from a bottle into a glass. It’s important to note that even though we are using a simple scenario to go through the procedure, the same steps can be applied to much larger simulations, such as on pools, waterfalls, rivers and oceans, to name just a few.
Our aim is to replicate the effect of filling a wine glass with liquid from a wine bottle and to have the liquid react naturally to the various objects within the scene. For the purposes of generating a final render, we also want the materials to replicate an actual liquid. To achieve this goal, we’ll create a simple geometry emitter to represent the wine coming out of the bottle. We’ll set both the bottle and the glass as collision objects, so the liquid will react to these objects correctly. We will also set up a Kill-Plane to increase the efficiency of the solve.
Once we are happy with the simulation, we’ll bake out the information to a cache sequence and create a liquid mesh object, using the baked data. This mesh can then be textured, using the Bifrost material for the final render.
As always, let us know what you think of this tutorial on Facebook and Twitter!
And if you missed the issue that this tutorial appeared in, head to our online shop.
Step 01 – Prepare the scene
It is important to set the scene up correctly before starting the simulation process. This means animating any objects that need animation and correctly positioning everything in the scene. It’s also important to get the scale right. Bifrost works exclusively in metres, regardless of the scale units currently set in Maya. For example, if you have a cube 100 units high and your Maya units are set to centimetres, Bifrost will treat the object as 100 metres high. This is a critical element to remember, as any simulation will not look right if the scale is not correctly planned out.
Step 02 – Create the Bifrost simulation objects
Let’s start by creating the emitter object. We will use a simple polygon cylinder carefully placed in the neck of the bottle. Scale it so there is clearance around the emitter and is not penetrating into the bottle’s geometry. With the emitter selected, go to the Bifrost menu and select Create Liquid. This will produce all of the required Bifrost objects, which include Bifrost1, BifrostLiquid1 and BifrostMesh1. You’ll also notice the additional controls added to the emitter’s shape node, under the new section entitled Bifrost. In fact, any object used as an emitter, collider or accelerator, is given extra Bifrost controls.
Step 03 – Make the collision objects
Using the Outliner, select Bifrost1 and click the timeline’s play button. You should see a growing yellow bar appear on the timeline, with a green bar growing slightly behind it. This indicates that the simulation is processing. You should also see the particles are dropping straight through the bottle. We need to turn the bottle into a collision object. Select the Bifrost1 object, then Shift-select the bottle and choose Add Collider in the Bifrost menu. Now when you press play the bottle will deflect the particles. Do the same for the glass.
Step 04 – Refine the simulation
The most important setting is the Master Voxel Size, located at the top of Bifrost1’s BifrostLiquidContainer1 panel. This parameter sets the size of the voxels in metres scale. For our wine glass simulation we need to be working in centimetres, so set it to 0.005. This means the voxels are 5cm in size and will create a more-realistic simulation. As well as this, it will increase the simulation processing time, but it’s the price we pay for accuracy. We also want to decrease the Transport Time Scale to 0.75. This provides a more-stylistic look by slowing down the simulation time.
Step 05 – Bake out the cache
Now that we’re happy with our result, let’s bake out the cache data to save having to process the simulation every time. This will also make the process of creating a mesh much more responsive. Simply go up to the Bifrost menu and select Bifrost Compute And Cache Options. Set the output location and cache name, then click the Create button. This will create a file sequence, which contains the simulation data. Once processed, select Bifrost1 and go to the Caching section. Tick the Enable Disk Cache option and ensure the cache path is correct.
Step 06 – Make a simple mesh and material
Select the Bifrost1 object and tick the Enable setting in the Bifrost Meshing options. You should now have a mesh representation of the simulation. Tweak the settings for the mesh until you’re happy with the geometry, then hide the Bifrost1 object. Notice that the mesh is still visible. You are actually seeing the BifrostMesh1 object, which already has a material applied. Head over to the BifrostLiquidMaterial1 tab and adjust the settings to suit your desired effect. Try disabling the Foam Remap controls, as the simulation’s timing is quite slow and would not have a great deal of foam.