了解流体模拟器
Section outline
-
Understanding the Fluid Simulator
::了解流体模拟器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 all
::首先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.
::开始时间和结束时间是以秒数计算的. 不要忘记这一点. 即使当你将开始时间设置为0和结束时间设置为10并且动画中有250,每秒25时,你的模拟似乎会非常快,这也是有充分的理由的. 现在,请记住这一点,不要让你的头脑,认为这些值是以毫秒数计算的,或者你必须用做一些邪恶的数学除法/乘法等. 还要注意,域是整个流体计算的边界框. 每个东西都是在这个框内完成的. 它作为所有流体的地板,天花板和墙壁. 这非常重要,因为这是我无法获得一个好的流体模拟的第1个原因. 如果我有时间,我会在流体控制上做一个很好的操作,但现在我会说它Setting up the scene
::准备情景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.
::让我们在线框模式下工作, 按ZKEY关闭固体模式. -
Go in to camera view by pressing
Numpad0
.
::通过按下Numpad0进入摄像头视图. -
With the box selected, scale it up to two times by pressing
SKEY
, then
2
, then
ENTER
. This fits the camera fairly well.
::选择了框,按下SKEY,然后按2,然后按ENTER, 缩放到两次. 这适合相机. -
Press
Numpad7
for a top view.
::按Numpad7可以看到顶部. -
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.
::选择了该框,按下Shift-D (不要移动鼠标,否则重复的框将移动),然后按下ENTER以确认重复的框的位置.如果您移动了该框,只需按 Escape,则将保留新框,但移动将被取消. -
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.
::在新框被选中 (与其他框完全相同的地方), 按SKEY,然后5.5,然后ENTER以缩小到半个尺寸. -
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.
::现在我们要把新框移到上面的角落之一. 按GKEY,然后按XKEY,输入-1键,按ENTER,框应该移到我们较大的框的左边. -
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
.
::现在我们在3维,而不是2维,所以点击Numpad1以获得侧面视图. 这次我们将框沿Z轴向上移动:G Z 1 Enter. -
Excellent, our setup is done.
::很好,我们的设置完成了.
Setting up the simulation
::设置模拟-
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
.
::选择较小的框,然后双击F7. 您应该看到一个右边窗格上写着"流体模拟". 点击启用. -
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.
::默认情况下,你的动画应该有250. 染也应该设置为每秒25, 这个教程假设这个设置. -
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.
::启动时间默认设置为0秒. 这意味着在第一个中,模拟刚刚开始. 你可以增加这个值,说, 1秒,这意味着在第一个中,流体模拟已经运行了1秒. 我们不想这样做,所以把它放在0秒. -
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
.
::默认设置的结束时间为0.3秒. 这意味着什么? 这意味着在第250时,模拟运行了0.3秒. 然而,默认情况下我们的动画是250长,每秒25,使这些0.3秒延长了10秒. 这基本上意味着我们正在慢动作观看节目,或者略低于实时速度的1/33. 所以现在你可能会想"它看起来很实时!"是的,它确实如此,但为什么它会这样做? 好,这很难解释. 考虑一下:在没有摩擦的世界里,一滴水在1秒后会跌到多远? 答案是大约4.9米. 所以,如果一滴水从4.9米落下,它将需要1秒才能到达地面. 如果从3厘米落下,水流器
::既然我们有250和25每秒,这意味着我们的动画长10秒.所以这里是棘手的部分,这实际上不是那么棘手:开始时间是默认设置为0秒.这意味着在第一个的模拟刚刚开始.你可以增加这个值,说,1秒,这意味着在第一个的流体模拟已经运行了1秒.我们不想这样做,所以保持在0秒. 结束时间是默认设置为0.3秒.这意味着什么?这意味着在第250的模拟运行了0.3秒.然而,默认我们的动画长250每秒25,使这些0.3秒延伸到10秒.这基本上意味着我们正在看这个节目在运动中,或略低于1/33的实时速度.所以你可能认为"它 -
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.
-
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.
::由于我们的想象力喜欢大东西,让我们把那个蛋糕打开,比如说,一个游泳池.确保在对象模式中选择大框,然后看看流体模拟窗口.在"BAKE"按的左边应该有3个其他按,可能名为"St","A","B".点击A以获得高级选项. -
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.
::应该出现一些新的框,重力 (应该是-9.81的Z轴,没有别的),水和我们正在寻找的选项",现实世界大小". 也格式和可压缩,但让我们现在不关心这些. -
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
::实体大小的值表示我们域的尺寸是多少, 默认是0.03米, 也就是3厘米. 我们想要它大, 所以把它调到10, 这是Blender2.45的限制. 现在我们的游泳池是10x10x10米 (不要淹死!), 记住这一点, 因为尺寸与液体有关. 不要认为我们再次玩蛋糕. -
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.
::像我们所说的,我们的"游泳池"是10x10x10米.我们添加的较小的盒子是正确的半个大小 (好吧,从长度/宽度/高度而不是体积),或5x5x5米.记住,一滴水在1秒内会下降4.9米?而且我们的动画每秒得到25?这意味着我们水块的最底部将在"地面"上方正确5米,并且在25后,我们的水应该非常接近地面. -
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?
::如果您有快速的计算机,Blender 应该已经完成了.例如,通过箭头键进入 25 (上/下 10 前/后,右/左 1 前/后).仔细观察一下块块,然后向前 1 .注意块块如何撞击地面?听起来很熟悉,不是吗? -
Although, we're not done! We gotta render our swimming pool. It's easy, but takes time, hit
Ctrl-F12
and go make dinner.
::虽然我们还没完成,我们还要翻新游泳池.这很容易,但需要时间,按Ctrl-F12然后去做晚餐. -
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.
::想象一下一个10x10米的大池子. 如果您当地的游泳池是这样的,
Final notes
::结论性说明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 .
::尺度很重要. 很难在很小的尺度上理解流体动力学,尤其是当你甚至不知道使用什么尺度时. "实世界尺寸"值似乎在许多指南中被遗漏了,我建议你将其设置为你可以与之相关的东西,否则你最终会得到看起来非常慢/快的模拟或看起来没有意义的结束时间值. 此外,我不是数学天才,我知道我可能会对我的解释有所误解,尽管这样的值对我来说是有意义的,我能够在没有"猜测"结束时间值的情况下进行流体模拟.Extra Practice
::额外的练习This YouTube tutorial on fluids might also help: Link and this Realistic Water Texture
::这篇关于液体的YouTube教程也可能有帮助:链接和这篇真实的水纹理Links
::链接-
Youtube:
Comparison of different values for resolution and real-world size
::Youtube:对分辨率和真实世界尺寸的不同值进行比较
-
Start with the default box, this simulation will be very simple.