Understanding the Fluid SimulatorEdit
When I first encountered the Fluid Simulator I had a hard time understanding its behavior, especially the Start time and End time didn't seem to make any sense at all. Going on a Google spree revealed that many people have problems figuring out the secrets behind fluid simulation, and I didn't find any truly helpful guides. In this little guide I'll try to explain it in a newbie friendly way. It may not be entirely correct, although it might help newbies understanding how it works.
First of allEdit
Start time and End time are in seconds. Don't forget this. Even if your simulation seems to go insanely fast when you set Start time to 0 and End time to 10 and having 250 frames in your animation with 25 frames per second, there is a good reason for this. For now, just remember this, don't let your mind wander and believe that the values are in milliseconds or that you have to do some wicked math dividing/multiplying with frames and so on.
Also notice that the domain is the bounding box for the whole fluid calculation. EVERYTHING is done inside this box. It acts as the floor, ceiling and walls for all of the fluid. This is very important, as the number 1 reason why I couldn't get a good fluid simulation going. If I have time, I will do a section on Fluid > Control, but for now, I will say that it adds a LOT of calculation time. Running on an I7, ATI Radeon 8970 Video, Asus P6X58D Premium, 64-bit Windows 7 and 64-bit Blender, I crashed my computer with the lowest quality settings. So just remember that the domain MUST surround the area in which you do calculations. Also note that after you set up your simulation, the domain becomes the actual liquid, so give it proper material and try not to bake until you're pretty sure of your simulation.
Setting up the sceneEdit
We'll learn how the fluid works the practical way. plane
- Start with the default box, this simulation will be very simple.
- Let's work in wireframe mode, press the ZKEY to turn off solid mode.
- Go in to camera view by pressing Numpad0.
- With the box selected, scale it up to two times by pressing SKEY, then 2, then ENTER. This fits the camera fairly well.
- Press Numpad7 for a top view.
- With the box selected, press Shift-D (don't move the mouse or else the duplicated box will move) then press ENTER to confirm the duplicated box's location. If you do move the box, just press Escape then the new box will be kept but the move cancelled.
- While the new box is selected (and in exactly the same spot as the other box), press SKEY, then .5, then ENTER to scale it to half size.
- Stay away from the mouse, accuracy is important here and I'll explain why later.
- Now we want to move the new box into one of the upper corners. Press the GKEY, then press the XKEY, type in -1, press ENTER and the box should move to the left wall of our larger box.
- We want the box in a corner, so press GKEY Y 1 Enter, the box should now be in the top left corner from our current view.
- However, we're in 3 dimensions, not 2 so click Numpad1 for a side view. This time we'll move the box up along the Z-axis: G Z 1 Enter.
- Excellent, our setup is done.
Setting up the simulationEdit
- Make sure you're in Object Mode, and that you followed the above steps precisely.
- Select the smaller box and click F7 twice. You should get a panel where the rightmost pane says "Fluid Simulation". Click Enable.
- Our small box will be the fluid, so just click the Fluid button. That's all there is to do with the small box.
- Now select the large box. The Physics panel should still be visible, click Enable in the Fluid Simulation pane and then select Domain.
- By default your animation should have 250 frames. Rendering should also be set to 25 frames per second by default, this tutorial assumes this setup.
- Since we got 250 frames and 25 frames per second that means our animation is 10 seconds long. So here comes the tricky part, which actually isn't that tricky at all:
- Start time is by default set to 0 seconds. This means that on the very first frame the simulation has just begun. You could increase this value to say, 1 second and that would mean that on the first frame the fluid simulation has already run for 1 second. We don't want to do this, so keep it at 0 seconds.
- End time is by default set to 0.3 seconds. What does this mean? This means that on the 250th frame the simulation has run for 0.3 seconds. However, by default our animation is 250 frames long with 25 frames per second, making those 0.3 seconds stretched over 10 seconds. Basically this means that we're watching the show in slow motion, or slightly less than 1/33 the realtime speed. So now you may think "it looks quite realtime to me!", and yes, it does, but why does it do that? Well, that's hard to explain. Consider this: In a world without friction, how far would a drop of water fall after 1 second? The answer is about 4.9 meters. So, if a drop of water falls from 4.9 meters it will take 1 second before it reach the ground. How long would it take the waterdrop to reach the ground if it falls from 3 centimeters? About 0.078 seconds. So why do i mention 3 centimeters? Because by default the size of our domain is 3x3x3 centimeters, or really small. If you're like me, you were probably thinking that the fluid was flowing around in a bathtub or a barrel, not in the wrapping of a cupcake. Set End time to 10 seconds.
- Since our imagination likes big things, let's crank up that cupcake to say, a swimming pool. Make sure the big box is selected in Object Mode In and look at the Fluid Simulation pane. Just to the left of the "BAKE" button there should be 3 other buttons, possibly named "St", "A", "B". Click A for advanced options.
- Some new boxes should appear, Gravity (should be -9.81 for the Z-axis, nothing else), Water and the option we're looking for, "Realworld-size". Also Gridlevels and Compressibility, but let's not care about those now.
- The "Realworld-size" value says how large our domain is in meters, and as you can see it's 0.03 meters by default, or 3 centimeters. We want it huge, so crank it up to 10, which is the limit for Blender 2.45. Now our swimming pool is 10x10x10 meters (don't drown!), remember this because scale matters with fluid. Do not think we're playing with cupcakes again :)
- Now click BAKE, and read on while your computer is chewing zeroes and ones.
- Remember how I told you to be very accurate about placing that second box? And how I began talking about gravity, falling waterdrops and stuff? Well, now you're going to see why.
- As stated, our "swimming pool" is 10x10x10 meters. The smaller box we added is exactly half the size (well, in terms of length/width/height, not volume), or 5x5x5 meters. Remember that a drop of water would fall 4.9 meters in 1 second? And that our animation got 25 frames per second? This means that the bottommost part of our blob of water will be exactly 5 meters above the "ground", and that after 25 frames our water should be very close to the ground.
- If you got a fast computer, Blender should be done baking by now. Go to frame 25, for example by using the arrow keys (up/down goes 10 frames forwards/backwards, right/left goes 1 frame forward/backward). Take a close look at the blob, then go forward 1 frame. Notice how the blob hits the ground? Rings a bell, doesn't it? :)
- Although, we're not done! We gotta render our swimming pool. It's easy, but takes time, hit Ctrl-F12 and go make dinner.
- When the rendering is done, press Ctrl-F11, and think of a 10x10 meter large pool. You might want to keep an eye on your kids if your local swimming pool acts this way, though.
Scale matters. It's really difficult to understand fluid dynamics on a very small scale, especially when you don't even know what scale is used. The "Realworld-size" value seems to be left out in many guides, I would recommend you set it to something you can relate to, or you'll end up with simulations that look really slow/fast or having an End time value that seemingly makes no sense. Further I'm not a mathematical genius, for all I know I could be way off with my explanation, although this way the values makes sense to me, and I'm able to make fluid simulations without "guessing" on values for End time.