RealFlow在线教程翻译(2)——Foam with SPH Fluids(基于平滑粒子流体动力学算法(SPH)的流体泡沫)

来源:互联网 发布:百度云盘超级会员淘宝 编辑:程序博客网 时间:2024/04/26 22:20

(以下英文部分及图片皆来源于RealFlow官方文档:http://support.nextlimit.com/display/rf2014docs/Foam+with+SPH+Fluids)


注:SPH (Smoothed Particle Hydrodynamics)是平滑粒子流体动力学方法是缩写。是指近20多年来逐步发展起来的一种无网格方法,该方法的基本思想是将连续的流体(或固体)用相互作用的质点组来描述,各个物质点上承载各种物理量,包括质量、速度等,通过求解质点组的动力学方程和跟踪每个质点的运动轨道,求得整个系统的力学行为。


    The creation of foam and spray from particle simulations is an often-used approach. RealFlow provides two common approaches to generate this type of fluid: Python scripting and RealFlow's “Graphs” system. In this example you will learn how to create spray particles from a turbulent fluid with the “Filter” daemon.

    在粒子仿真中创建foam(泡沫)与spray(水花、浪花)是很常见的操作。RealFlow提供两种常用的方法来生成这类流体:Python脚本和RealFlow的 “Graphs”(图像)系统。在本例中,你将学会使用“Filter” 场(过滤场,即粒子触发某条件后转换其所属发射器的场)(注:deamon在RF中一般指力场或范围作用场)在湍流(或晃动流体)中创建浪花粒子的方法。


The result of the tutorial. The image has been rendered with RealFlow's implementation of Maxwell Render and the "MultiPoint" option to create more foam particles.

                                                                             教程结果。该图像使用RealFlow的Maxwell渲染器渲染,为实现更过泡沫的效果,使用了“MultiPoint”选项。

Here is the nodes list:

  • 1 “Cube” object
  • 1 “Square” emitter
  • 1 “Container” emitter
  • 1 “Gravity” daemon
  • 1 “k Volume” daemon
  • 1 “Surface Tension” daemon
  • 1 “Filter” daemon
教程中用到的node列表:

  • 一个“立方体”几何体对象
  • 一个“正方形”发射器
  • 一个“容器”发射器(此处用来盛放泡沫粒子)
  • 一个“重力”场
  • 一个“体积消除”场(注:该场作用为将该场体积范围之外(或之内)的粒子回收)
  • 一个“表面张力”场
  • 一个“过滤器”场

All scene elements can be added from RealFlow's “Edit” menu:

  • Add > Objects | Emitters | Daemons
  • RealFlow nodes can be moved, scaled, and rotated with the WR, and E keys.

  • Imported objects from SD files have to be unlocked before they can be transformed with Selected object > Node Params > Node > SD ↔ Curve

  • Viewport perspective is changed with the 123, and 4 keys.

  • Shading modes are toggled with the 789, and 0 keys.

所有场景元素可以在 “Edit”菜单中添加:

  • Add > Objects | Emitters | Daemons
  • 可以通过WR, 和E键对node进行移动,缩放和旋转。

  • 通过SD文件导入的对象在修改前需通过Selected object > Node Params > Node > SD ↔ Curve  操作解除锁定。

  • 通过1234键切换视口透视图。

  • 通过7890键对阴影模式进行切换。

The Setup(设置)

  • Add a cube object and rescale until you get a long basin. This node (“Cube01”) will hold the fluid.

  • 添加一个立方体对象并调整大小直到得到一个长方形容器,该容器用来盛放流体。
  • Add a “Square” emitter and place it near one end of the cube.

  • 添加一个“Square” 发射器并将其置于之前创建的立方体的一端。
  • A “Container” node will be used to store the foam particles.

  • 一个“Container” 节点用于存放泡沫粒子
  • Place a “k Volume” to delete (eventually) escaping particles.

  • 放置一个“k Volume”用于删除(最终)逃逸粒子。
  • The “Gravity” daemon introduces a force.

  • 添加“Gravity” 场引入重力
  • With a “Surface Tension” daemon the fluid looks more “liquid”, because it amplifies the particles' tendency to form drops.

  • 添加“Surface Tension”(表面张力)场使流体看起来更像液体,因为它增强了粒子聚集成为液滴的趋势。
  • Create a “Filter” daemon.

  • 创建“Filter” 场


Adjusting the “Square01” Emitter(调整“Square01” 发射器)

   To get a sufficient amount of randomness and turbulence, some emitter parameters are animated. For this purpose we will use two basic expressions based on sine functions. These simple formulas will help to increase and decrease the parameters' values periodically, creating a randomized look.

   为实现足够的随机性与波动性,修改了一些emitter参数。为实现这个目标,我们使用基于正弦函数的两个基本方程。这些基本的公式将会帮助周期的增加与减少参数值,从而实现更加随机的效果。

Finally, a few more adjustments are necessary(一些调整是需要的):

  • Increase the number of emitted particleswith Node Params > Particle > Resolution> 75.0
  • 通过Node Params > Particle > Resolution > 75.0增加发射器粒子数量。
  • Scale the emitter to create a rectangular shape (rough values are 0.5 and 2.0 for the horizontal values, and 1.0 for the vertical axes. Move the emitter upwards, but please make sure that it is not outside the “Cube01” object.
  • 缩放发射器尺寸来创建一个长方形(宽长比0.5,水平方向2.0,垂直方向1.0),向上移动发射器,但应保证其在“Cube01”之内
  • Instead of a constant particle stream, a fixed volume is used in this scene. Enter a value greater than 0 underNode Params > Square > Volume. Click on “Reset” to see the volume. The parameter's value should be set to value so that the particles nearly touch the “Cube01” node's bottom.
  • 本场景中使用固定体积流而不是定常粒子流。在Node Params > Square > Volume中输入一个大于0的参数。点击“Reset”来看volume值。该参数的值应该被设置成能够使粒子接触“Cube01”的底部。
  • By default, the particles are emitted in a regular pattern. Add some randomness underNode Params > Square > V random (H random) > 1.0 (1.0)
  • 默认情况下,粒子按照规律模式发射。通过Node Params > Square > V random (H random) > 1.0 (1.0)增加一些是随机性。
  • Node Params > Node > Color > choose a blue color(将颜色改为蓝色


Adjusting the “Container01” Node(调节“Container01”)

    The “Container” node is not an emitter in a traditional sense. It is simply a place where particles can be added. With these particle-shifting methods you always have to make sure that the source emitter (here: “Circle01”) and the container have exactly the same “Resolution” values, because otherwise you will see exploding particles. Here are the settings:

   “Container”节点在传统意义上不是一个发射器,只是一个可以添加粒子的地方。(注:此案例中仅将其理解为一个容器更为恰当)使用粒子转换方法(指filter)需确保源发射器(这里是“Circle01”)与本容器(此处指“Container01”)有相同的“Resolution”(分辨率)值,否则会出现爆炸粒子。以下是具体设置:

  • Node Params > Particles > Resolution > 75.0

  • To make the foam float, change its density: Node Params > Particles > Density > 900.0

  • 为使泡沫能够漂浮,修改其密度:Node Params > Particles > Density > 900.0
  • Node Params > Node > Color > choose white(将泡沫颜色改为白色

   

     The decreased “Density” will make the foam float on top of the fluid, and the colours help to separate the foam from the fluid visually.

    “Density”参数的减小将会使泡沫漂浮于流体之上,颜色的修改使我们能够在视觉上分辨出泡沫和流体。


Adjusting the “k Volume” Daemon(调节“k Volume” 场)

    The “k Volume” daemon is just a box that can be rescaled and adjusted to enclose a certain volume. In this case, the daemon's box will be slightly smaller than the “Cube01” node. Note the “Scale” settings from “Cube01”, add 0.01 to each value, and transfer them to the “Scale” parameters of the daemon, e.g.:

    “k Volume” daemon 仅仅是一个用来封闭某个确定空间的可调节的箱体,它应比“Cube01”略微小一些。查看“Cube01”的“Scale”参数值,在每个相应值上增加0.01,并将它们赋给“k Volume”的“Scale”值。

  • Cube01 > Scale > 6.0, 3.0, 3.0

  • k Volume01 > Scale > 6.01, 3.01, 3.01

 

    This tight fit is necessary, because in this scene, new foam particles will be created and they will most probably leave the cube. To delete them immediately, the “k Volume” daemon must be very close to the cube's borders.

    这些微小的修改是必要的,因为在此场景中,新的泡沫粒子会被创建并且它们很可能会离开cube容器,为了能够立即删除它们,“k Volume”必须非常紧密的贴合“Cube01”的边界。

Adjusting the “Filter” Daemon(调节“Filter”场)

  • Source Emitters > Square01(设置源发射器)

  • Target Emitter (True) > Container01(设置目标发射器)

  • Condition > On Particle Collision(设置过滤条件)(注:相当于触发条件)

  • Split > Yes(过滤后是否生成新的粒子)

  • @ # child > 3

    When a particle collides with the cube object it is transferred from “Square01” to “Container01”, and removed from the source emitter simultaneously. With the “Split” option, the filter creates 3 additional particles per filtered foam particles. This way it is possible to increase the amount of foam and get a denser look.

    粒子与立方体容器碰撞后即从“Square01”转变为“Container01”,与此同时立即从源发射器中移除。通过 “Split”选项,filter会在最初每个filter泡沫粒子基础上再新增3个额外粒子。该方法增加了粒子数量并使仿真结果看起来更稠密。(注:以上设置使粒子在碰撞容器壁后从Square01中转到Container01中,即从原晃动液体转为泡沫)


Adjusting the “Surface Tension” Daemon(调节“Surface Tension” )

    This daemon acts globally on all of the scene's emitters. This means that it will affect both the “Square01” emitter and the particles in the “Container01” node. To get nicely shaped drops and strings, use the following settings:

    该daemon作用于全局的emitter。这意味着它会同时影响 “Square01” emitter和 “Container01” node 中的粒子。为得到形态更好的液滴和流,使用以下设置:

  • Surface_Tension01 > Node_Params > Surface Tension > Strength > 100

  • Balanced > Yes

The Simulation(仿真)

    Click on “Simulate” to see the results. Play with the “Volume” settings of the “Square” emitter to get splashes of varying strength. You can also also add a second “Filter” daemon and filter against the particles' “Pressure” value to introduce a second criteria for the creation of foam.

    点击“Simulate”观看结果。调节“Square” emitter的“Volume”参数得到不同强度的水花。还可以添加第二个“Filter” daemon ,filter粒子的“Pressure”值以引入创建泡沫的第二准则。


    Another idea is to work with a second “Filter” and another “Container” emitter to transfer foam back into water, for example after a certain age or when a particle's speed falls below a speed threshold.

    另一个想法是使用第二个“Filter”和另一个“Container” emitter,从而使泡沫回归water,比如在某个时长后或当粒子的速度低于某个特定值后。




1 0
原创粉丝点击