FLOW


DOCUMENTATION

Thank you for using FLOW ❤️

If you haven't already, please consider writing a review. They really help me out!



How do I upgrade?

First, make sure you back up your project files.

Next, install the latest version.

If for some reason the latest updates breaks your project (e.g. errors in the console), then try deleting the root folder for this asset, and reinstalling it.

If it still doesn't work, then let me know what the errors are so I can fix it. You can then revert to your back up, and wait for a fix to be released.



What is FLOW?

Unlike traditional fluid simulations that use 3D particles, FLOW works using columns of fluid that extend out from the ground. This means large areas of your scene can be covered in fluid using very little data, which leads to incredible performance. However, this difference does mean there are some limitations:

Within each fluid simulation there is only one column per XZ location, and each column stores the ground height + fluid data (depth, color, etc). This means you cannot have fluid floating above the ground, or multiple layers. Another way to think of this is that the fluid simulation is a heightmap running on top of another heightmap (e.g. a terrain), so if the fluid scenario you have in mind couldn't be represented using a heightmap, then you wouldn't be able to directly simulate it using FLOW.

For example: You cannot have fluid flowing through pipes, because you can't represent a pipe using a heightmap. However, you could place a 3D pipe model in your scene that drains fluid from one side, and emits it from the other.

For example: You cannot have fluid fill up spherical containers, because you can't represent a sphere using a heightmap. However, you could fill up an inverted semi-circle. If you really need to fill up a sphere, then I recommend you place a disc inside your sphere and adjust its size based on the fluid height to match the sphere.

For example: You cannot have fluid spray out from a hose, because flying water cannot be represented using a depth value alone. However, FLOW does come with a simple particle system that allows you to emit particles that turn into fluid when they hit the ground or the fluid surface.

Most of these common limitations can be worked around. However, there are some hard limitations that will never be possible. For example, there is no possibility of using FLOW with a voxel terrain system. You can read more information about limitations HERE.



Getting Started


Step 1 - Create a Simulation

Before you can add fluid to your scene, you must tell FLOW where in your scene you want the fluids to appear.

METHOD 1 Create a new GameObject, and add the FlowSimulation component to it.
METHOD 2 Right click in your Hierarchy tab, and select: FLOW > Simulation
METHOD 3 From the menu bar, select: GameObject > FLOW > Simulation

You should now see the FlowSimulation component in your inspector tab.



Step 2 - Adjust the Simulation Boundary

Fluid can only appear within the boundary of a simulation. You can adjust this using the Size and Center settings.

You can also adjust the HeightMin/Max settings, which allow you specify the minimum and maximum ground height that your fluid can flow over. For example, if your scene has a terrain that has an altitude range of 0 meters to 500 meters, then you should set HeightMin to 0 or lower, and HeightMax to 500 or higher.

NOTE  You can see a preview of the simulation boundary size in the Scene tab.


Step 3 - Adjust GameObject Layers

Every object in your scene matching the HeightLayers setting will be converted into a heightmap using vertical (top down) raycasts. This heightmap is what the fluid simulation will flow over, so it's important you configure your scene layers so that it can be generated accurately.

For most projects, these layers should only include ground or wall objects. For example, you probably don't want your player character or collectible items to be considered 'ground' by the fluid simulation. Therefore, make sure these are on a different layer, or you can adjust the HeightLayers setting to exclude them.

To visualize what the simulations sees as ground, you can read the documentation HERE.



Step 4 - Adjust the Simulation Detail

The fluid is simulated using a grid of fluid columns. The distance between each column is controlled by the Separation setting, and then divided by the Resolution setting. You can use these to control the amount of columns in the whole simulation.

NOTE  The more columns your fluid uses, the slower it will be.
NOTE  Changing the simulation detail will change the way the fluid physics behaves.


Step 5 - Render the Fluid Surface

METHOD 1 Create a new child GameObject of your simulation, and add the FlowSurface component to it.
METHOD 2 Right click your fluid simulation GameObject in your Hierarchy tab, and select: FLOW > Surface
METHOD 3 Select your fluid simulation GameObject, and from the menu bar, select: GameObject > FLOW > Surface

You should now see the FlowSurface component in your inspector tab.

NOTE  This component will be pre-configured with the Surface material in the MeshRenderer component's Materials list. If you'd like to adjust the overall look of your fluid surface, then you can duplicate this material, adjust the settings, and replace its material.


Step 6 - Add Fluids!

The easiest way to add fluids to your fluid simulation is to add a modifier to your scene.

METHOD 1 Create a new GameObject, and add the FlowModifier component to it.
METHOD 2 Right click in your Hierarchy tab, and select: FLOW > Modifier
METHOD 3 From the menu bar, select: GameObject > FLOW > Modifier

You should now see the FlowModifier component in your inspector tab.

If you set the Mode setting to AddFluid, then you can drag and drop a fluid into the Fluid setting. You can find a selection of pre-made fluids in the FLOW/Examples/Fluids folder.

NOTE  If you want to create your own fluids then you can duplicate and modify an existing one, or add the FlowFluid component to your GameObject and drop it into the FlowModifier component's Fluid setting.

Your fluid should now appear in your scene!

If not, make sure the modifier is inside the boundary of your fluid. You can adjust its Size, and position it using the Transform component settings. You can see the boundary of both in the Scene tab when selected.




Do Fluids Work With Terrains and Custom Meshes?

Yes, fluids will automatically flow over and be blocked by terrains and any objects or meshes in your scene as long as they have colliders (e.g. MeshCollider).

This works by raycasting into the scene when the simulation starts, and then storing this height data with each fluid column.

You can control which objects appear using GameObject layers, and the FlowSimulation component's HeightLayers setting. The HeightMin/Max settings can also be used to control where the height cutoff is.

If the objects in your scene need to move then you can read the documentation HERE on how to make them automatically update the height data.

NOTE  If your objects move a lot or float then you should change their layer or exclude them from the FlowSimulation.HeightLayers setting.


How is the Simulation Size/Performance?