FLIP Fluids Addon: A liquid fluid simulation tool for Blender

Hey Olof,

Sorry for the delay, There it is ;

1 Like

WIP

Just wanted to share a test video sequence I just finished. There still much to do, but I find the result very encouraging. Also , I wanted to take the time to elaborate more on the blending method I use (node tree + description below). Feel free to ask question or propose workflow improvement!

To do :

  • Ship motion
  • Camera motion
  • Flip surface / ocean displace mask
  • White water / ocean displace mask
  • Wetmap on ship hull
  • Propeller white water trail
  • Kelvion wake
  • White Water fade away

Ocean info

Ocean Shader Node
The 2 generated ocean displacement are masked by a noise texture to try to eliminate the tiles repetitions. The noise texture location is animated and scaled uniformely to mimic wind direction influence.

Ocean Plane Modifier stack
Need to be using experimental cycle render to be able to use the adaptive subdivision option. See ocean youtube video of dylan neil for more in depth information. Youtube - Dylan Neil


Flip Surface info

Flip surface shader node (enlarged screen shot below) :
The node tree is similar to the ocean shader , only exception , the feather edge mask nodes and the speed attribute node that change transmission/ss scattering color.

Zoom (Flip surface shader node)
the Opacity of the fluid is greater when the speed is greater. It does mimic foamy water at high speed area. I think that vorticity would make more sense in this case (to be tested).

Zoom (Flip surface shader node)
Same as the ocean displacement

Flip Surface modifier stack
I do not use adaptive subdivision on the Flip surface , as seen on the ocean modifiers. Adaptive subdivision doesnt support custom vertex attributes yet (e.g. speed) T92622 . Notes that, it does eat a ton of ram using it on high polycount mesh ( like the surface generated by Flip). To keep the displacement detail constant between the ocean and the flip surface, i need to add some subdivision to it. Make sure the subdivision is at the bottom on the stack, it greatly improve render speed (as of blender 3.1, Optix & Cuda only).

Regarding the Lattice modifier, refer to this Twitter - Francis Jasmin


White Water Geometry node
The white water is displaced by the same displacement map combination as the ocean & Flip surface. it is only a conversion of the shader node displacement to geometry nodes displacement.

22 Likes

Hi @ArchiCraig

Thx for the detailed explanation of the shaders and every other parts !

That is quite interesting :slight_smile:

I wonder if you could provide your scene eventually so that others can look at it ?

I think you could export an Alembic (.abc) file of just one frame of your sim so that we could have the whole scene, without the 15 gigabite of the whole simulation !

I would love to play around and see how you have setup your scene.

How did you made the simulation ? Just a very long flip liquid with the boat ?

Have a nice day !

ps : thx for the link to my twitter !

This is a great post, thanks for sharing!!

Hi! I am doing some test with flip fluid and I was trying to check the flip_velocity attribute out, but something’s not working properly.

As you can see the attribute seems empty… any help please?
I am using flip fluids 1.3.1 on blender 3.1, win 10

Hi, would you be able to attach the .blend file (or send to [email protected]) so we can take a look at the set up?

Some things to check are:

Here is a basic example .blend:
velocity_attribute_example.blend (1.2 MB)

1 Like

thank you! I thought they were being generated automatically, but I had to turn on the experimental stuff! :slight_smile:

Hi! I have a question how to get something done in FLIP fluids (amazing add on btw, truly).

I’m trying to demonstrate how a culvert system works. In this case, there is a lake that represents an inflow, then there is a culvert with sliders controlling the water flow, and then there is an outflow which is also a lake with a constant water level.

How do I make an inflow such that it keeps a constant water level that is equal to the level of the lake? See picture below, now I have this step down which does not give me the accurate flow rate and it looks weird…

You would expect the water level to remain more horizontal until it hits the culvert.

Same goes for the outflow, but I managed to fix it there by adding an additional inflow with the same level as the lake, just before the outflow (if not, the water stays super critical and there is no hydraulic jump, no there is, which is really nice).

Thank you!!

Hi! By default, inflows will not emit liquid in parts where the object is submerged. They will only emit liquid into empty air. This is what would be causing the level drop after the inflow because they can only emit when it is partially above the water level.

The Inflow Constrain Fluid Velocity option may be something to try. Then this is enabled, the inflow can push submerged liquid forward if a velocity is set. This option can be useful for enforcing a constant inflow rate.

Note: The constrain fluid velocity option may not work correctly if the inflow is emitting in a direction opposite of a domain wall that it is touching (the suction force against the wall will negate the inflows ability to push liquid forward). In this case, a thin outflow against the wall can be used to create an airgap so the inflow can emit freely.

A simple alternative to modifying the set up, if it is applicable, could also be to hide the level drop by only meshing parts of the liquid further past the inflow. The Surface > Meshing Volume options can be used to selectively mesh regions of the liquid that are inside of a set object (such as only mesh liquid that is inside of some cube).

Hope this info helps!

FLIP Fluids Addon v1.4.0 is now available!

FLIP Fluids version 1.4.0 improves compatibility support for the upcoming release of Blender 3.2, adds bug fixes, improvements, and more!

This version also adds new features such as basic color attribute mixing for creating colorful liquid effects, new surface force field customization options, and expanded command line tools to improve your baking and rendering workflow while maximizing stability.

https://gfycat.com/scholarlybountifulkoodoo

Release Notes

Past release notes can be found here

  • version 1.4.0 (Jun 07 2022)
    • Blender 3.2 Compatibility: FLIP Fluids version 1.4.0 adds official compatibility support for Blender 3.2.
      • Blend File Compatibility: .blend files created in Blender 3.1 using FLIP Fluids 1.3.0 or 1.3.1 should be compatible in Blender 3.2 using FLIP Fluids 1.4.0.
    • Blender 3.3 Compatibility: At this moment there are no known compatibility issues between FLIP Fluids 1.4.0 and Blender 3.3, but this may change as Blender 3.3 develops. Issues related to Blender 3.3 compatibility can be reported and tracked in this thread: issue #581.
    • Important notes: The attribute and motion blur features contained in this release are currently considered unstable due to a bug in Blender that can cause frequent render crashes.
    • Added: Age and Color surface attribute smoothing options to the FLIP Fluid Surface > Geometry Attributes menu.
      • These options control the amount of smoothing when transferring the Age/Color attribute to the surface mesh. Higher values result in smoother attribute transitions at the cost of simulation performance. The smoothing value represents the search radius for nearby particles in number of voxels.
    • Added: Features for basic Color attribute mixing (Documentation).
      • Enable Mixing: Simulate basic color mixing. If enabled, particles will absorb color attributes from nearby particles. If disabled, particles will hold a static color value that does not change.
        • Notes: This feature mixes colors using RGB additive blending, which is not physically accurate. Due to this, colors may not mix accurately compared to real-life color mixing such as paints. For example, mixing blue and yellow paint results in a green tone, but with RGB additive mixing this results in a shade of grey. RGB mixing can still produce acceptable results if the selected colors are closer or next to each other on the color wheel, such as Red/Orange/Yellow or Blue/Light-Blue. Colors that are on opposite sides will not mix well and will average to the center of the wheel to result in a shade of grey.
        • We are looking at solutions for physically accurate color blending and this will arrive in a later update.
      • Mix Rate: Controls how quickly particles will absorb color from nearby particles. Higher values will cause colors to mix and spread more quickly. Lower values will cause colors to mix and spread more slowly.
      • Mix Radius: Radius in which a particle can absorb color from nearby particles. Increasing this value can result in smoother mixing transitions at the cost of simulation performance. This value is the search radius of nearby particles in number of voxels.
    • Added: Functionality to the Surface Force Field object for selectively generating force vector fields based on front/backfacing triangle direction as well as against planar edges (Documentation). Notes:
      • Enabled Sides: Front - Enable force field on the front-facing polygons. This is the side where face normals point outwards.
      • Enabled Sides: Back - Enable force field on the back-facing polygons. This is the side opposite of the face normal.
      • Enabled Sides: Edge - Enable force field on planar edges. These are the edges of the surface that are not connected to any other polygons. Must have either one of Back or Front sides enabled for edge attraction to be enabled. Tip: Disable this option if you want the fluid to be attracted to the surface while still being able to flow off the edges of the surface.
    • Added: Render After Bake option to the Helper > Command Line Tools sidebar to automatically start a command line animation render after the command line bake process is completed.
      • This option offers a selection between a normal command line render or to launch a frame by frame batch file render.
      • Automatically launching the command line process is supported on Windows only. For MacOS/Linux, the Copy Bake Command operator can be used to copy the command to the clipboard so that it can be manually pasted in a terminal window.
    • Added: Launch Frame Render option to the Helper > Command Line Tools sidebar to automatically launch a command line render for a single frame.
      • This operator will render the current timeline frame.
      • If the Open Image After Render option is enabled, the command line script will automatically open the image using the default image program of your OS after the render is completed.
      • If the Close CMD Window After Render option is enabled, the command line window will be automatically closed after the render is completed.
      • The .blend file should be saved before using this operator in order for render and simulation settings to take effect. However, it is not required to save the .blend file if you are only changing a frame in the timeline or if changing the two above settings.
      • This operator is supported on Windows only. For MacOS/Linux, the Copy Render Command operator can be used to copy the command to the clipboard so that it can be manually pasted in a terminal window. The above two options are not supported on MacOS/Linux.
    • Bug Fix: Fixed error messages due to compatibility issues when using the addon in Blender 3.2.
    • Bug Fix: Fixed crash that could occur when exporting animated simulation objects in Blender 3.2.
    • Bug Fix: Fixed issue where generated surface attribute data could be incorrect on the under-side of the surface mesh, or in the direction that the liquid was flowing.
    • Bug Fix: Fixed issue where surface/whitewater motion blur could be rendered incorrectly on the first frame of an animation.
    • Bug Fix: Fixed possible AttributeError that could be triggered when deleting an object when a domain is present in the scene.
    • Bug Fix: Fixed issues where cache paths saved on Windows may not load on macOS/Linux due to backslashes in filepath.
    • Bug Fix: Fixed error that could be triggered when using the Create Domain operator when a thin object is selected.
    • Bug Fix: Fixed issue where Create Domain operator could automatically adjust resolution too high for force fields that are allowed to be planar surface or points.
    • Bug Fix: Fixed issue where resuming a simulation could resume with incorrect Source ID attribute values on the fluid surface.
    • Change: The generated batch file render window will no longer close after completing the render.
    • Change: The Helper > Initialize Motion Blur sidebar operator will now generate a separate geometry node group for each whitewater particle type (foam/bubble/spray/dust) instead of a single group.
      • Note: if using this operator on a simulation set up where you had used this operator previously, you may want to check for duplicate geometry node groups in the modifiers panel and delete the old one.
    • Change: The FLIP Fluid World > Viscosity Accuracy now has a soft maximum value of 4. The value can still be manually set up to a maximum of 6, but we would in general not recommend setting this value above 4 in any case as there are greatly diminishing returns in visual accuracy.
    • Improvement: Age and Color attribute generation is now optimized and multithreaded.
    • Improvement: Added optimizations to prevent the addon from slowing down the Blender UI when the addon is not in use (issue #582).
    • UI: The Select Domain operator will now still be accessible when the Helper > Select Objects panel is collapsed.
    • UI: Added a Restart Required warning to the FLIP Fluids sidebar menu to prevent user from setting up a simulation and triggering errors before installation is complete.
    • UI: Expanded Obstacle > Inverse option tooltip to improve on explaining what this option does (Documentation).
    • UI: Updated inline UI documentation links for when the Preferences > UI Options > Display Documentation Links in UI option is enabled.
14 Likes

Just testing the flip_color attribute and color mixing stuff - very cool!

What would be great for a future iteration would be if you could transfer colors from the UVs of a mesh somehow, although I’m not sure how you’d go about it.

1 Like

Thank you! It does help. Basically if I understand you correctly, I have to calculate the flow rate myself and set the velocity of the inflow to that value. I will try some things out and I let you know if it worked out.

Follow up questions, or perhaps idea for future versions:

  1. Is it possible to connect a lower resolution domain to a higher resolution domain and have them act as one domain? Or place a higher resolution domain inside a bigger lower resolution domain? This way, it would be possible to create larger scenes where there are smaller elements that require more detail. This would save immense amount of calculation time.

  2. Is it possible to connect an ocean modifier as boundary condition, so you can render a beach with an infinite ocean with a seamless connection to it? The ocean modifier has some really accurate wave generation (JONSWAP spectrum), for which FLIP Fluids would then be able to be used to render the transition between ocean and coastline. This would create some highly realistic beach scenes in which you can see the infinite ocean.

1 Like

Also, I would like to report two bugs. Maybe they are known, maybe they are not :slight_smile:

  1. Sometimes when rendering, it misses the fluid surface and you end up with an empty frame. It’s quite labour intensive to find the missing frames and rerender those.

  2. Sometimes it’s stuck on updating the fluid surfice while rendering and then it just keeps renderig one frame… this is really annoying, especially if you’ve waited over a day to finish rendering all (1000+) frames, to find out that it got stuck after frame 200 or so…

Yep, these are things that could be considered in future development.

I’ve thought a lot about #2 and there are some difficult tasks to tackle to get this right. As an addon we only have access to the geometry data of the ocean modifier and not its internal values which is required for this type of feature. To generate the required data we would need to re-implement the ocean modifier within our simulator.

Another difficulty is that as an addon we are also not to create new modifiers and would need to implement this system separate from Blender’s modifier system. We would need implement this feature in a way that it can be flexible and easy to use by the artist while still being able to interacting with other features of Blender.

Sometimes when rendering, it misses the fluid surface and you end up with an empty frame. It’s quite labour intensive to find the missing frames and rerender those.

This is caused by a long-standing design issue in Blender where large amounts of geometry may not be synced correctly with the renderer due to conflicts with the viewport. The workaround for this issue is to render from the command line. The command line tools in the sidebar menu can be helpful for this:

image

More info:

  • This bug was originally reported here: https://developer.blender.org/T60094
  • A Blender developer made this issue as stable as they could at the time, but it cannot be perfectly stable. It was mentioned that this would be handled in regular development (Comment Here).
  • This issue seems to be random and can be dependent on the system. For example, some artists will never run into these problems while others will experience this frequently.
  • Frequency of incorrect renders (or crashes) usually increase as the amount of geometry increases.
  • I would almost always recommend rendering from the command line for large geometry scenes. There is a huge improvement in stability as well as performance and resource usage benefits.
  1. Sometimes it’s stuck on updating the fluid surfice while rendering and then it just keeps renderig one frame… this is really annoying, especially if you’ve waited over a day to finish rendering all (1000+) frames, to find out that it got stuck after frame 200 or so…
  • This could also be caused by the above issue.

  • We also have received a recent report that a conflict with the Photographer addon can cause this type of issue, so disabling this addon if it is installed may be a solution (or rendering from the cmd line as an alternative).

    It seems that an interaction with the Photographer addon can put Blender into a state where it can prevent other addons from running their frame change/update scripts. A side effect of this is that it will produce duplicate frames in our addon. I suspect that this is a bug in Blender that should be reported, but we have not been able to reproduce this conflict on our systems yet which would be required for reporting.

    In the latest version of the addon we added a workaround to attempt to bypass the error that prevents our frame change scripts from running, but I am not sure if this would solve the problem as we are not able to test this on our system.

  • This type of issue can also be caused by enabling the Render Properties > Performance > Final Render > Persistent Data option. This option should either be left off when rendering a simulation or to render from the command line.


Hope this info helps! Let us know if you have any questions or find out more information about the issues.

1 Like

*This comment uses automatic translation. Forgive me.

Thanks for the great update, RLGUY!

Regarding flip_color, we believe that there are certain colors and densities that are easier to transition to.
Is it possible to set this individually at this time?


Hi, If I’m understanding correctly I think there is a trick that can work for this to use the color attribute to mix multiple shaders.

If you set the each inflow to either pure red (1, 0, 0), green (0, 1, 0), or blue (0, 0, 1), the RGB channels can be separated in the shader and used as a mix value.

Here is a .blend file with the set up:
mixing_shaders_with_rgb_channels.blend (2.6 MB)

This should work for mixing up to 3 shaders together (1 shader for each RGB channel). I’m actually working on a feature right now that is similar to this technique for mixing more than 3 shaders and this will come in a later update.

Hope this info helps!

2 Likes

Very cool.
My questions have been answered.
Thanks for the great add-on!

1 Like

Thanks again RLGUY for the elaborate answer to my questions! I understand implementation isn’t easy, yet I think both will be of great added benefit for a wide variety of users. I will email you for an official feature request!

Another question. What part of the navier-stokes equation are you solving and what parts are you omitting? Is there some documentation on how you are solving it?

Edit: never mind, I think I found your explanation here :slight_smile:
http://rlguy.com/gridfluidsim/

Yep, that page contains the equations we’re solving/approximating for:

The last viscosity term is ignored when the viscosity solver is disabled.

The current FLIP Fluids addon simulator was originally based on that simulator, but some of the methods have advanced or changed in the current simulator. I’ll add some links to the solving methods:

And for more resources, I found these books very helpful:

  • Fluid Simulation for Computer Graphics by Robert Bridson
  • Fluid Engine Development by Doyub Kim
2 Likes

Awesome information! Thank you so much! Again, amazing add-on.

Sorry to bother you with another question / bug report… During a very long simulation it got stuck. To reset it, I cancelled the baking process. It said “DO NOT quit Blender”. I let that run, but after an hour or so, it didn’t change, so I figured that just froze as well so I did a hard quit… Did that move just break my bake? I seem to get the following error when trying to restart… Any way to save my bake, or do I have to rerun the whole thing?

Edit: if all of the bugs I’m reporting are known, would it be an idea to create a known bug page on your wiki? :slight_smile:

Edit2: managed to save my bake by overwriting the flipstats.data file and all files in the export folder from the cache folder!