【更新】FluXY - 2.5D fluid simulator 1.4 GPU高性能流体模拟
FluXY simulates 2D fluids that look 3D, using your GPU. Can be used to simulate fire, smoke, paint, water, trails, and a variety of VFX.
FluXY is a GPU, grid-based, 2.5D fluid simulator. It's lightweight, fast, robust, and easy to use. You can use it for simulating fluid effects in realtime, as well as generating flipbook textures.
Includes shaders for:
Opaque fluid surface (URP/HDRP, 2019.4 and up)
Transparent fluid surface (URP, 2019.4 and up)
Volumetrics, new in 1.3 (URP/HDRP, 2021.2 and up)
You can use the included shaders on your project right out of the box, or as inspiration for your own simulation-driven shaders.
Expand 2D fluids into the 3D realm.
FluXY fluids live in containers. A container can either be a custom mesh or a flat rectangular area. Containers can face the camera, and objects in the scene can splat density and velocity data onto containers. All 3D data coming from the outside world such as forces, velocities, is projected to 2D. This gives the impression of a full 3D simulation, but orders of magnitude cheaper.
(NEW in 1.4) Record simulations to flipbook textures
Select any container and record a flipbook animation from it! These are cheap to play anywhere in your scene, and will look smooth even if they have few frames thanks to motion-vector based interpolation.
Turbulence, pressure, buoyancy, surface tension, external forces...
Take full control of the simulation: make swirly fluid by increasing turbulence, make it expand by reducing pressure, rise to the sky by increasing buoyancy, use adhesion and surface tension to make dripping paint, let it be affected by wind...
Inertial effects
Fluids can inherit the movement of their container. Put a torch in a character's hand, and the flames will be affected by running, jumping, waving and any other movement. You have full control over how much acceleration/velocity is transferred to the fluid.
Simulate fire, smoke, ink, water, paint, and other VFX.
Make your players traverse oily water, unleash magic spells, add smoke to destructible/crumbling objects, and more.
Dynamic Level of Detail (LOD)
Integrated with Unity's LOD components, distant simulations are performed at lower-resolution. Transition between levels of detail is smooth as butter.
Fast separable pressure solver
Calculating pressure usually is the most expensive part of fluid simulation, as the same basic math operation has to be repeated many times per frame. FluXY offers you a fast, separable pressure solver that achieves results comparable to traditional methods in a fraction of time. And, you can still choose to use the traditional way if you wish.
Waves
When using the traditonal pressure solver, pressure values can double up as a cheap wave simulation.
100% GPU
The entirety of the fluid simulation happens in your GPU, using fragment and vertex shaders.
Parallel simulation of multiple fluid containers.
Simulating one fluid container is fast, but simulating up to 16 at the same time is even faster. FluXY uses automatic dynamic atlasing to put multiple simulations into the same texture, for maximum performance.
Full source code included. Fast support and regular updates.
If you want to modify FluXY, add custom features to it, or just take a look under the hood, you'll be happy to know that every script and shader is included and easily editable. If you need assistance or have a question, drop us a line and we'll do our best to help.
What do I need to know to be able to use FluXY?
For basic use cases, very little experience is needed. Some basic Unity skills and understanding 3D concepts such as world/local space, raycasts, velocities/accelerations... will get you far. No C# scripting needed.
As you get into more elaborate effects, some shader knowledge is useful. FluXY outputs fluid density and velocity values as textures, you can use these as input in your own shaders to create some seriously cool stuff.
Things FluXY isn't / doesn't do:
Not a full 3D fluid simulator, no volumetric effects. Simulation takes place on a 2D plane.
No free-surface fluid simulation (can't simulate pouring fluids on containers, for instance).
Not a fluid renderer. A basic unlit shader compatible with all SRPs is included (used in most store videos/images), and sample shaders for fluid surfaces and volumetrics, however you must use your own shaders for anything fancy. Fluid simulation outputs two textures (density and velocity) that you can easily use in your own shaders/materials to match your game's look.
Can't simulate large water bodies like oceans, rivers, etc.
Does not support two-way rigidbody coupling. Rigidbodies can either drive the fluid flow, or be driven by it, but not both at once.
Limitations for custom meshes
FluXY performs simulation in texture space, so meshes must be UV unwrapped with this in mind: uvs must be non-overlapping, and texture seams minimized since fluid cannot flow across seams.
FluXY使用你的GPU模拟2D流体,看起来是3D的。可用于模拟火、烟、油漆、水、轨迹和各种视觉效果。
FluXY是一个基于GPU、网格的2.5D流体仿真器。它是轻量级的,快速的,强大的,易于使用的。你可以用它来模拟实时的流体效果,以及生成翻书的纹理。
包括以下的着色器。
不透明的流体表面(URP/HDRP,2019.4及以上)。
透明流体表面(URP,2019.4及以上)。
Volumetrics,1.3版中的新内容(URP/HDRP,2021.2及以上)。
你可以在你的项目中直接使用所包含的着色器,或者作为你自己模拟驱动的着色器的灵感。
将2D流体扩展到3D领域。
FluXY流体生活在容器中。容器可以是一个自定义的网格,也可以是一个扁平的矩形区域。容器可以面对摄像机,场景中的物体可以将密度和速度数据溅到容器上。所有来自外部世界的三维数据,如力、速度,都被投射到二维。这给人的印象是一个完整的三维模拟,但成本却低得多。
(1.4版中的新功能) 将模拟结果记录到翻书纹理上
选择任何容器,并从中录制一个翻页动画 这些动画很便宜,可以在你的场景中的任何地方播放,而且由于基于运动矢量的插值,即使它们的帧数很少,也会看起来很流畅。
湍流、压力、浮力、表面张力、外力...。
完全控制模拟:通过增加湍流使流体旋转,通过减少压力使其膨胀,通过增加浮力使其上升到天空,利用粘附力和表面张力使涂料滴落,让其受到风的影响......
惯性效应
流体可以继承其容器的运动。把火把放在角色的手里,火焰就会受到跑步、跳跃、挥舞和其他任何运动的影响。你可以完全控制有多少加速度/速度被转移到液体中。
模拟火、烟、墨水、水、油漆和其他视觉特效。
让你的玩家穿越油腻的水面,释放魔法,为可破坏/崩溃的物体添加烟雾,以及更多。
动态细节水平(LOD)
与Unity的LOD组件集成,以较低的分辨率进行远距离模拟。详细程度之间的过渡是平滑的,像黄油一样。
快速可分离的压力求解器
计算压力通常是流体模拟中最昂贵的部分,因为同样的基本数学运算必须在每一帧中重复许多次。FluXY为您提供了一个快速的、可分离的压力求解器,可以在一小部分时间内达到与传统方法相当的结果。而且,如果你愿意,你仍然可以选择使用传统的方式。
波浪
当使用传统的压力求解器时,压力值可以兼作廉价的波浪模拟。
100%的GPU
整个流体模拟发生在你的GPU上,使用片段和顶点着色器。
多个流体容器的并行模拟。
仿真一个流体容器是很快的,但是同时仿真多达16个流体容器就更快了。FluXY使用自动动态贴图,将多个模拟放在同一个纹理中,以获得最大的性能。
包括完整的源代码。快速支持和定期更新。
如果你想修改FluXY,为它添加自定义功能,或者只是看看引擎盖下面,你会很高兴地知道,每一个脚本和着色器都包括在内,并且可以轻松地编辑。如果你需要帮助或有问题,请给我们留言,我们会尽力帮助你。
我需要知道什么才能使用FluXY?
对于基本的使用情况,不需要什么经验。一些基本的Unity技能和对3D概念的理解,如世界/本地空间、光线投射、速度/加速度......会让你走得更远。不需要使用C#脚本。
当你进入更复杂的效果时,一些着色器知识是有用的。FluXY将流体密度和速度值作为纹理输出,你可以在你自己的着色器中使用这些输入,创造一些非常酷的东西。
FluXY不是/不能做的事情。
不是一个完整的三维流体模拟器,没有体积效应。仿真发生在一个2D平面上。
没有自由表面的流体模拟(例如,不能模拟在容器上浇注流体)。
不是一个流体渲染器。包括一个与所有SRP兼容的基本的非照明着色器(在大多数商店的视频/图像中使用),以及用于流体表面和体积的示例着色器,但是你必须使用自己的着色器来实现任何花哨的效果。流体模拟输出两个纹理(密度和速度),你可以很容易地在你自己的着色器/材料中使用,以配合你的游戏外观。
不能模拟大型水体,如海洋、河流等。
不支持双向的刚体耦合。刚体既可以驱动流体流动,也可以被流体驱动,但不能同时进行。
对自定义网格的限制
FluXY在纹理空间中进行模拟,所以网格的UV解包必须考虑到这一点:UV必须是不重叠的,并且尽量减少纹理接缝,因为流体不能跨越接缝流动。
页:
[1]