Join Aaron F. Ross for an in-depth discussion in this video Working with Auto Resize, part of Liquid Simulation in Maya.
- View Offline
We set the initial state for our fluid, and we're actually ready to go ahead and animate the bucket tipping over. But in order for that to work, we'll need to enable Auto Resize. If Auto Resize is off, the fluid density cannot exist outside of this pre-existing box. But if we turn on Auto Resize, the 3D container box will resize automatically to optimally contain the fluid density. So to make that happen, we'll select that fluid container and go back to its attributes, Ctrl+A.
And in the Auto Resize section, we can flip that switch back on. I want to mention here at this point that this is, unexpectedly, a destructive act. If you turn Auto Resize on, then you cannot go back and set a new initial state on your fluid container. What that means is that before you flip this switch on, you need to make sure that your fluid is in the correct state. Because if you turn this on, and then you try to set a new initial state, then your container will go back to its original position, and basically you'll lose your work.
So, I turn it on. And if I press Play, you'll notice that the box became a little bit smaller. And it's now optimally sized to include that density. There are a few parameters here you can play around with. For example, the max resolution is the maximum number of voxels on a side of the box, and its set to a value of 200 now, which is a pretty high value. We probably won't reach 200, but I'll leave it at that high value of 200. And that should be fine for our simulation here. Additionally, you've got the auto resize threshold.
That's a threshold that determines whether or not the box will automatically resize with a given density. Effectively what that means is, if you have a low threshold, then the box will not tend to resize very much. It'll tend to get larger, but not get smaller. And if you have a high threshold, you'll have to have a greater density in order for the box to become larger. The default value of 0.2 is pretty good, so I'm going to leave it at that. Finally, there's the auto resize margin, and that's just an extra buffer of a set number of voxels around the density.
And so right now, we've got an auto resize margin of two, so we get two extra voxels around the existing density here. So I'm going to leave it at that. So we're ready to actually animate the bucket, I want to rewind back to frame one. And before I do any keyframing, I am going to want to disable evaluation on the fluid shape node. We'll go into the Modify menu, go to Evaluate Nodes, and Disable Evaluation on the Fluids.
So I want to go a few frames forward, let's say frame five, and set a rotation key on this locator here. I make sure that only that locator is selected, and if you're not sure what's selected, maybe go into the Outliner, Window > Outliner. Select that bucket locator, and I'm just going to keyframe it in the z-axis only. So I'll select Rotate Z, and then right-click and Key Selected. I'll turn on Auto Key, just to save a little bit of time. Here's Auto Key down here.
Turn the little skeleton key icon on. And I'll go down, let's say, seven frames later, to frame thirteen. And then I'll rotate. And you can see, when I release the mouse, I've got a new keyframe there. Let's check this in orthographic view. I'll tap the spacebar and go to the front view. Make sure I've rotated that so it's not going through the floor. Okay, and then go a couple frames later, because I want to little bit of rebound there. Let's say, frame 15, rotate it back up a few degrees, and then a couple frames later, rotate it back down. And rewind to play that back.
Looks okay. I'll turn Auto Key off, and if I want to go into the finer points of this, of course, I can go into the Graph Editor. Window > Animation Editors > Graph Editor. Select that Rotate Z channel, and press the F key. And I just want to sort of fine tune that animation a little bit. I'll select this first keyframe and then, with the Move tool selected, I'll just adjust that tangent a little bit. Select the tangent and then move it. And so that this looks a little bit better here, I want to select this keyframe, and break it's tangents. And then select each one of these tangents and move them. That'll just give us a little bit better feel to that animation. Rewind and play that back.
So, we got our bucket tipping over. Very good. Tap the spacebar. Go back out to my perspective view here. And then re-enable the fluid. So, go back up to Modify > Evaluate Nodes > Evaluate All, turn that back on. Back out a little bit, and with Auto Resize on, what we should see is that the fluid box changes size automatically. We've got a pretty good looking fluid here now. And not that many steps to it. Next we will go back into our fluid simulation properties and maybe fine tune them a little bit.
- Creating dynamic foam and bubbles with nParticles
- Rendering particles with the Fluid shader
- Colliding particles and fluids with polygons
- Storing simulations with disk caches
- Emitting particles from a texture
- Pouring liquid with nParticles
- Converting particles and fluids to smoothed polygons
- Simulating volumetric liquid with a 3D fluid container
- Controlling key simulation parameters
- Texturing a 3D fluid