Creating Wave Simulations with Blender's Flip Fluids
Events
Subscribe:  iCal  |  Google Calendar
Los Angeles US   27, Sep — 1, Oct
Moscow RU   4, Oct — 8, Oct
Prague CZ   5, Oct — 7, Oct
São Paulo BR   10, Oct — 15, Oct
Latest comments

I feel like you can shoot this after printing it out...

by Oneiros
44 min ago

And yes, these video are made using the standard unity pipeline but we will release soon also the HDRP version. Stay tuned!

by Oneiros
49 min ago

Hi khiree.taylan, the projects could run in multiplatform. The graphics showed in these videos are made using a gtx 1070 but soon we will release also the mobile version :)

Creating Wave Simulations with Blender's Flip Fluids
17 July, 2018
Animation
Interview

Lucas Veber described in close detail the process of creating Wave simulations in Blender and its particular addon Flip Fluids. Water, foam, bubbles, rendering and more!

Introduction

My name is Lucas Veber, I’m 29 and I am currently working as a freelance 3D artist for various studios and individuals. I’ve previously worked for movie productions as an animator (Minions, Despicable Me 3, Secret Life of Pets). I obviously love animating and rigging, and lately, I’ve been spending more and more time on technical things such as python addons development for rigging, and game development with Unity. Also, I’ve worked on fluid simulations with Realflow for a short student film (Contre-Temps), and with Blender for a Vietnamese animation studio. Later, as a personal project, I decided to create a beach scene with breaking waves in Blender.

Get the scene here

Water Simulations

There are two types of fluid simulations in Blender: SPH (Smooth Particles Hydrodynamics) and LBM (Lattice Boltzmann Methods). While both tools are very interesting, I will only talk about the second one here, which fits better for a large-scale simulation since it’s possible to generate additional splash/foam particles, while the first one is used more for small-scale simulations, such as filling a glass of water. 

It works this way: first, a “Domain” object must be added in the scene. This is generally a cube that must surround the whole simulation. It’s used to define the simulation resolution, and all global parameters (viscosity, scale, etc.) Then, the fluid itself can be added from any mesh by flagging it as a “Fluid” one, or it can be generated from an “Inflow” object, that constantly adds new fluid particles in the scene (such as water pouring out from a tap). There are also many other object types to remove fluid (Outflow), force fields an so on.

LBM fluids (Blender internal, oldest method):

Specs: CPU: Intel i7 2600, 8 threads GPU: GTX 980

Sim: Fluid: 400 frames simulated, at a resolution of 697, 60 sec/frame, about 7 hours Splash particles: ~300K

Rendering: 150 frames rendered on GPU, fluid passes (diffuse, glossy, vector): ~35 sec/frame Splash pass: ~25 sec/frame 

To achieve this result, 4 passes were composited together: watercolor (combined, on the top left), vector (top right), additional reflexion and splashes (foam) particles.

I initially had no specific idea of the strengths and weaknesses of the Blender internal fluid simulation. That’s why I started this beach wave project. Even though I was quite happy with the final result, I came up with this conclusion:

Pros:

  • All simulations’ data is inside Blender, no need to export it to other software solutions;
  • There is an interesting vector pass from the fluid surface for motion blur and other effects

Cons:

  • The parameters are not easy to understand for the beginners;
  • There are not enough parameters to control the foam particles generation and lifetime, and the physic behavior of these particles is generally inaccurate;
  • No way to pause/resume baking;
  • The program is unstable, may crash and the mesh surface may contain holes at specific frames;
  • The mesh surface is jagged by the obstacle contacts, even at high resolution

Flip Fluids

The Flip Fluids addon definitely solves all of the issues mentioned above! This is frankly a godsend that I was waiting for a long time. Simply watching the 2 versions of the beach waves scene side by side (internal fluid sim/ flip fluids) clearly shows the difference. The funny thing is that I actually sent a message about one year ago to the Blender fluid simulation developer, Nils Thürey, to ask him if there were any plans to improve the current fluid system, mentioning the issues above. He implemented it in 2006, for the Google Summer of Code, and even though it was great at that time, it was getting quite obsolete. Of course, the main problem was getting funds for the improvement, so I suggested a crowd-funding campaign. I waited but got no reply. But a few months after, the Flip Fluids addon popped up providentially, so many thanks to Ryan Guy and Dennis Fassbaender.

FLIP Fluids addon:

While the first scene was using a very clear, Carribean-like ocean shader, I’ve changed it a little to something darker to emphasize the bright foam contrast with the watercolor. It’s rendered in a single pass, it’s way more detailed, sharper.

Specs:

CPU: AMD Ryzen 1800x, 16 threads

GPU: 2x GTX 980

Flip Fluid Simulation:

Fluid: 400 frames simulated at a resolution a 500, ~90 sec per frame, Total: 10 hours

Subdivision: 1, Particle Size; 1.10

Whitewater particles: ~300.000

Rendering:

150 frames rendered on GPU, ~38 sec per frame, Total: 90 minutes

Fast ocean shader (no SSS)

Full blend file (does not include the baked data)

Creating Waves

After trying the force fields objects to “magnetize” the fluid, and failing at it (it gave exploding fluid and other random results) I finally generated waves by an underwater moving obstacle, going up and down. This works for both internal fluids and flip fluids. To get proper waves scale and frequency, many tests were run starting at a low resolution for faster results, then I progressively increased the resolution as it was more and more satisfying. 

Foam

The foam particles are generated automatically, they are named “whitewater particles” in Flip Fluids. I’ve increased the “Wavecrest emission rate” and “Turbulence emission rate” to ensure that enough foam is added when the waves are rolling and crashing. And tweaked a little the lifetime. Also, I’ve removed manually some foam particles in the back area to make it look better, using a mesh object (not rendered) that is used to mask particles’ vertices based on the distance between the mesh faces and particles. So all particles nearby this mesh are removed. During the render time, each particle is replaced by a tiny white sphere to create an illusion of coagulated foam bubbles when seen from far.

Textures

I used the same ocean shader that I had built for the first beach wave scene. This shader is relatively fast to render, and simulates the water absorption effect that is a physical property of water: as the water gets deeper and deeper, it turns to a dark blue color. This feature can also be simulated with subsurface scattering, at the cost of longer render times. The reflexion (using fresnel) and refraction parameters don’t need too many tweaks, it generally works fine as long as the fluid simulation itself is good.

Nodal view of the water shader:
 

Bubbles

The bubbles are actually just whitewater particles located underwater, that go up to the surface because they virtually contain air. I’m not an expert at this, but I’d explain the phenomena by an example from the real world: bubbles can be generated from high fluid turbulence, for example, an underwater propeller emits little bubbles because the water molecules are kind of split by the local turbulence. Once these bubbles particles reach the surface, they are considered as “foam” by the solver, and if they are thrown into the air (e.g. after colliding with an obstacle) they are called “spray” and will gradually fall down because of the gravity and air resistance. So it’s one unique “whitewater” system in the Flip Fluid method, that handles the whole bubbles/foam/spray particles behavior. Disabling the bubbles particles leads to less foam generation obviously, since the bubbles are responsible for a large part of the foam amount. But more whitewater particles also mean greater render time.

Rendering

The main artifacts are caused by low resolution, increasing it generally gives good results. However as mentioned earlier, I had issues with foam particles being generated in unwanted areas, that looked like weird white powder on the water surface. Manually removing particles (that are actually vertices in the scene) based on the proximity with a dedicated mesh helped a lot, but I guess there are also ways to fix that using the foam simulation parameters (Wavecrest angle, Preserve foam, foam lifetime, etc.)

One issue that came when rendering though: Blender crashed at certain frames, I guess because of the massive amount of polygons, particles to render. Rendering from the command line completely fixed that, fortunately!

More screenshots of the simulation:

 
 

I’ve been in touch with the developer that provided very good support. I’m very confident about the future of this addon, “decoupled baking” is on the roadmap, which will allow baking separately the particles/mesh/fluid data for the better control over the simulation!

Lucas Veber, 3D Artist

Interview conducted by Kirill Tokarev

 
Comments

Leave a Reply

1 Comment on "Creating Wave Simulations with Blender’s Flip Fluids"

avatar
Seth
Guest
Seth

Did you use a solid object as the fluid to start?

wpDiscuz
Related