This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
Content Optimization
Materials
Art Samples
Tutorials

Water Body

Water body enables physical simulation of liquids of different density and viscous behavior. It also models the appropriate buoyant force on submerged objects and wave dynamics as two-way interaction is calculated. Water simulation is visually pleasant and fast enough, so it can be used within a game environment; however, if the mesh is big and dense, it can become quite costly.Water body 可以对不同的液体进行物理模拟密度粘性行为.它还对水下物体上的适当浮力和波浪动力学建模为双向互动被计算。水模拟在视觉上令人愉悦且速度足够快,因此可以在游戏环境中使用;然而,如果网格又大又密,它会变得非常昂贵。

Water body can be assigned to the following types of objects:Water body 可以分配给以下类型的对象:

注意
In case of an arbitrary mesh, water will not have appropriate shading, but all physical properties will still be present.在任意网格的情况下,水将没有适当的阴影,但所有物理属性仍将存在。

See also也可以看看#

Mesh Requirements网格要求#

A mesh, to which a Water body is assigned, should meet the requirements given here. Mesh requirements are the same for both Dynamic Mesh and Water Mesh objects.分配了 Water body 的网格应满足给定的要求这里.两者的网格要求相同动态网格水网对象。

Grid Simulation Model网格仿真模型#

The Water body is modeled as a two-dimensional grid with point particles positioned in the vertices of the mesh. The particle movement is restricted to two directions: it can be lifted upwards or dragged downwards. In the case of changing its position, the particle acquires a velocity that affects the neighboring particles and thus describes the grid of Water body at each physics time step. Thus, the waves are generated when physical bodies get in contact with water or a particle is directly assigned new velocity.Water body 被建模为二维网格,点粒子位于网格的顶点。粒子运动被限制在两个方向:它可以向上提升或向下拖动。在改变其位置的情况下,粒子获得影响相邻粒子的速度,从而描述每个物理场的 Water body 网格时间步长.因此,当物理物体与水接触或直接为粒子分配新速度时,就会产生波。

Water grid changes during physics simulation物理模拟过程中的水网变化

Liquidity流动性#

Liquidity defines the viscosity of water (or any other liquid): it determines how readily it splashes and affects wave formation. It multiplies the speed with which water particles pass velocity vectors to the neighboring ones.流动性定义了水(或任何其他液体)的粘度:它决定了它飞溅和影响波浪形成的难易程度。它乘以水粒子将速度向量传递给相邻粒子的速度。

  • The higher the value, the more viscous the water is and the smaller are the waves risen by the objects (e.g. syrup).值越高,水越粘稠,物体(例如糖浆)引起的波浪越小。
  • Low values provide higher surface waves (e.g. tap water).低值提供更高的表面波(例如自来水)。

    注意
    Be careful not to set too high or too low values, because that may lead to unstable simulation and blowing up of the water. To regain stability, try to tweak Interaction.注意不要设置太高或太低的值,因为这可能会导致模拟不稳定和水爆炸。要恢复稳定性,请尝试调整 Interaction

Density密度#

Density of water determines the buoyancy of objects according to Archimedes' principle. Based on the volume of the submerged part of the shape and its mass, buoyancy force is applied to its center of mass and pushes the object upwards, whereto the mean normal of the grid covered by submerged shape points.根据阿基米德原理,水的密度决定了物体的浮力。根据淹没部分的体积形状和它的质量,浮力被施加到它的质心并向上推动对象,其中被淹没的形状点覆盖的网格的平均法线。

  • By the minimum value of 0, the objects will not float in the water, but rather fall through it without any resistance.通过 0 的最小值,物体不会漂浮在水中,而是在没有任何阻力的情况下通过它。
  • Higher values increase the buoyant force. If set too high, the immersed objects start to be pushed out in the air.较高的值会增加浮力。如果设置得太高,浸入的物体开始被推出到空中。

Physical Behavior of Objects in Water物体在水中的物理行为#

Two-way dynamic interaction provides both physically and visually convincing simulation of the waves from the physical bodies as they disturb the fluid. Imagine a moving boat that forms a wake wave behind it, or a character creating ripples while moving in the water (see the picture above).双向动态交互提供了物理和视觉上令人信服的模拟,当它们干扰流体时来自物理体的波。想象一艘移动的船在它后面形成尾波,或者一个角色在水中移动时产生涟漪(见图以上)。

Interaction with Objects与对象的交互#

A physical object submerged into the water (or any other liquid) has its own velocity vector. On the other hand, all the water particles that are covered by this physical body or surround it, have their own integrated velocity vector, which approximates the state of water. The Interaction value is a coefficient that determines how much the object's velocity influences the velocities of water particles and thus generate waves.浸入水(或任何其他液体)中的物理对象具有自己的速度矢量。另一方面,所有被这个物体覆盖或包围的水粒子,都有自己的积分速度矢量,近似于水的状态。 Interaction 值是一个系数,它确定对象的速度对水粒子速度的影响程度,从而产生波浪。

  • By the minimum value of 0, an object produces no disturbances on the water surface.通过 0 的最小值,物体不会对水面产生干扰。
  • Higher values make the disturbances of water surface more intense and the waves from moving objects become higher.越大水面的扰动越强,在移动的物体浪变得更高。

    注意
    Too high values may blow the water up, as the law of conservation of energy does not constrain the system! Try decreasing damping values to regain stability.太高的值可能会把水吹起来,因为能量守恒定律不会约束系统!尝试减少减震值以恢复稳定。

Linear Damping and Angular Damping线性阻尼和角阻尼#

Objects getting into the water are expected to slow down, as resistance of the water is higher than the drag in the air. Damping values work the other way around compared to the Interaction coefficient:进入水中的物体预计会减慢速度,因为水的阻力大于空气中的阻力。阻尼值与 Interaction 系数相反:

Linear Damping defines how much linear velocity of the submerged object is decreased over time when influenced by velocities of surrounding water particles. And similarly, Angular Damping defines the gradual decrease in the object's rotation. Both linear and angular damping forces are accumulated before being applied.Linear Damping 定义了在受周围水粒子速度影响时,水下物体的线速度随时间降低了多少。同样,Angular Damping 定义了对象旋转的逐渐减少。线性和角阻尼力在施加之前都会累积。

  • By the minimum value of 0, objects movement is not hindered by the water. As a result, there are no waves in the water.通过 0 的最小值,物体的运动不受水的阻碍。结果,水中没有波浪。
  • Higher values make the damping of linear or angular velocities more intense, and objects slow down faster as they get into the water. The waves from the objects in this case become more pronounced, as the energy of the system increases.较高的值会使线速度或角速度的阻尼更加强烈,并且物体在进入水中时会减慢速度。在这种情况下,随着系统能量的增加,来自物体的波变得更加明显。

    注意
    The water may blow up in case the values are be very high. Try decreasing the Interaction value to regain stability.如果值非常高,水可能会爆炸。尝试降低 Interaction 值以重新获得稳定性。

Emission of Particles粒子发射#

It is possible to create an additional visual effect of small droplets, splashes or bubbles on the water when objects fall into it. To enable this effect perform the following steps:当物体落入水中时,可以在水面上产生小水滴、飞溅或气泡的额外视觉效果。要启用此效果,请执行以下步骤:

  1. Create a Particle system effect by clicking Create -> Effect -> Particle system in the main menu of UnigineEditor.通过单击主菜单中的 Create -> Effect -> Particle system 创建 Particle system 效果统一编辑器.
  2. Go to the Parameters window.转到 Parameters 窗口。
  3. In the Dynamic section, choose the Spark Emitter to spawn particles by selecting Emitter -> Spark.Dynamic 部分,选择火花发射器通过选择 Emitter -> Spark 来生成粒子。
  4. Make Particle system a child of the Water Mesh object.使 Particle system 成为孩子Water Mesh 对象。

Particles will be generated only when the object first contacts the water surface, while already submerged bodies will float without generating them.只有当物体第一次接触水面时才会生成粒子,而已经淹没的物体将漂浮而不生成它们。

Effect of water splashes水溅效果

Water Boundaries水边界#

The following parameters relating to water boundaries make it possible to create different types of basins in the game environment. These parameters provide flexibility in setting up physical behavior of water for big natural lakes and small pools.以下与水边界相关的参数可以在游戏环境中创建不同类型的盆地。这些参数为设置大型天然湖泊和小型水池的水的物理行为提供了灵活性。

Depth深度#

Depth determines the size of waves: high waves are formed in deep waters (e.g. a sea), while only a slight ripple is generated in shallow waters (e.g. a pool):Depth 决定了波浪的大小:在深水(如大海)中会形成大浪,而在浅水(如水池)中只会产生轻微的波纹:

  • With the minimum value of 0, the objects raise no waves in the water.最小值为 0 时,对象不会在水中产生波浪。
  • Higher values result in higher waves generated by moving objects.较高的值会导致移动对象产生较高的波。

Intersection with the Ground与地面的交叉点#

Intersection of water with the underlying terrain can be necessary, for example, to estimate the actual depth of the water basin. To enable ground intersection perform the following steps:Intersection 的水与底层地形可能是必要的,例如,估计实际深度的水盆。 要启用地面交叉,请执行以下步骤:

  1. Make Water Mesh or Dynamic Mesh object a child node of the Terrain or Static Mesh使 Water MeshDynamic Mesh 对象成为 TerrainStatic Mesh节点
  2. Check the Intersection box in the Parameters window -> Physics tab -> Body section.选中 Parameters 窗口 → Physics 选项卡 → Body 部分中的 Intersection 框。

Intersection is implemented in the following way: the rays are traced downwards from the water mesh surface, as far as the Depth distance. If a ray intersects the parent node, the obtained depth is used in calculations; otherwise the preset depth value is used.相交以下列方式实现:光线从水网格表面向下追踪,直到 Depth 距离。如果一条射线与父节点相交,则将获得的深度用于计算;否则预设深度值用来。

Intersection is also traced upward to check if the water is under terrain and there is no need to render it.交叉点也向上追踪以检查水是否在地形下并且不需要渲染它。

Absorption吸收#

Absorption is an option that creates either an effect of a limited basin or, on the contrary, of an open water surface that does not have marked boundaries.Absorption 是一个选项,可以创建有限盆地的效果,或者相反,创建没有明显边界的开放水面。

  • If Absorption is enabled, the waves are dispersed along the mesh perimeter. In this case the water level at mesh edges will gradually fall down to zero level.如果启用Absorption ,则波浪沿网格周长分散。在这种情况下,网格边缘的水位将逐渐下降到零水位。
  • If disabled, the backwash from the wall is simulated: the wave when reaching the brink of the water is reflected and returns in the reversed direction.如果禁用,则模拟来自墙壁的反冲:到达水边时的波浪被反射并以相反的方向返回。

Water body absorption: enabled(left) and disabled(right)Water body 吸收:启用(左)和禁用(右)

Optimizing Simulation优化仿真#

Updating each frame a huge number of objects located far away from the camera that are hardly distinguishable or observed as a mass is a waste of resources.更新每一帧远离相机的大量物体,这些物体几乎无法区分或观察为质量是一种资源浪费。

To improve performance and avoid the excessive load, water simulation can be updated with a reduced framerate. When the Water body is out of the area specified by the Update Distance Limit parameter, physical calculations are not performed, though objects preserve their buoyancy.为了提高性能并避免过度负载,可以进行水模拟更新了降低的帧率.当 Water body 超出 Update Distance Limit 参数指定的区域时,不执行物理计算,但对象保留其浮力。

The set of frame rates given below enables you to specify how often the water simulation should be updated when the object is visible, when only its shadow is visible, or when it is not visible at all.下面给出的一组帧速率使您能够指定在对象可见、仅其阴影可见或根本不可见时应更新水模拟的频率。

Parameters -> Physics tab -> Periodic Update sectionParameters -> Physics 选项卡 → Periodic Update 部分
FPS When Object Is Rendered To Viewport Update rate value for the case when the object is rendered to viewport.对象渲染到视口时的更新速率值。
FPS When Only Object Shadows Are Rendered Update rate value when the object itself is outside the viewing frustum, and only its shadow is rendered to viewport.当对象本身在视锥体之外时更新速率值,并且只有它的阴影被渲染到视口。
FPS When Object Is Not Rendered At All Update rate value when both the object and its shadow are not rendered to the viewport.当对象及其阴影都未渲染到视口时更新速率值。
Update Distance Limit Distance from the camera up to which the object should be updated.对象应更新到的距离相机的距离。
注意
These values are not fixed and can be adjusted by the Engine at any time to ensure best performance.这些值不是固定的,引擎可以随时调整以确保最佳性能。

This feature is enabled with default settings ensuring optimum performance and can be adjusted per-object in the UnigineEditor or via API at run time.此功能使用默认设置启用,可确保最佳性能,并且可以在 UnigineEditor 中或通过 API 在运行时针对每个对象进行调整。

警告
Be aware that using reduced update frame rate for an object should be carefully considered in your application's logic, as it may lead to various issues with rendering Skinned Mesh and Dynamic Mesh (flickering due to misalignment of objects inside the Water body).请注意,应在应用程序的逻辑中仔细考虑对对象使用降低的更新帧速率,因为这可能会导致渲染 Skinned MeshDynamic Mesh(由于 Water body 内的对象未对齐而导致闪烁)的各种问题。

Assigning a Water Body指定水体#

To assign a Water body to an object via UnigineEditor perform the following steps:通过将 Water body 分配给对象统一编辑器执行以下步骤:

  1. Open the World Hierarchy window.打开 World Hierarchy 窗口。
  2. Select a Water Mesh or a Dynamic Mesh object to assign the Water body to.选择 Water MeshDynamic Mesh 对象以将 Water body 分配给。

    注意
    Make sure that the object's mesh meets requirements!确保对象的网格满足要求
  3. Go to the Physics tab in the Parameters window and assign a physical body to the selected object by selecting Body -> Water.转到 Parameters 窗口中的 Physics 选项卡并分配一个物理身体通过选择 Body -> Water 到选定的对象。

    Adding a body

  4. Set the body name and change other parameters, if necessary.如有必要,设置主体名称并更改其他参数。
最新更新: 2021-07-09
Build: ()