Weekly Development Notes #44 – Turbulence With Curl Noise

Covering the week of January 11th – 15th, 2021.

Hello, welcome to our 44th update for the FLIP Fluids liquid simulation addon for Blender! It has been a productive last week. I have finished prototyping an idea for implementing curl noise as part of our in-progress turbulence force field feature, as well as implementing these noise methods into our FLIP Fluids simulation engine.

Curl Noise

In a previous post I had mentioned I was using Catlike Coding’s Noise Derivatives, going with the flow tutorial as a reference for how noise generation works, and it has been an excellent resource. The example code is in C# and uses the Unity engine, but I ended up using Python and some parts of our engine for prototyping and visualization.

Here’s an example of curl noise in action:

There’s no fluid physics in these examples, this animation just involves simple particles following a curl noise vector field. The noise grids were generated in Python for prototyping, which is quick for programming, but very slow for performance. After making sure the noise methods functioned correctly, the prototyped Python code was then translated into C++ for use in our FLIP Fluids engine.

We’ll need to add some feature to make our turbulence force field more useful and usable:

Noise Preview Visualization

The turbulence force will be able to be visualized by using the force field debug tools after starting to bake the simulation.

A problem with only being able to visualize after baking, is that noise settings can be difficult to understand how the noise will turn out when you’re setting up your simulation before baking. Mainly, it can be difficult the size and scale of the noise.

Blender’s texture panel has a noise visualization, but this is internal to Blender and we do no have access to this as an addon.

Due to this limitation, we’ll be adding our own preview visualization tool directly inside of the viewport within the domain. Unlike other force fields we have implemented, the turbulence generation is very quick to compute, so we should be able to generate a 2D sliced visualization in real-time as you change the settings.

Particle Lifetime Attribute

Some turbulence effects will spread the fluid out through the domain and you may not want it to reach the domain edges. Or you may want particles to disappear after a certain amount of time for other situations.

We’ll need to add a particle lifetime attribute to the fluid so that fluid decays over time. Inflows/fluid objects will need to have a setting to control the starting particle lifetime as well as a randomness setting. This is a somewhat popular request we have received over the course of our development, and this would be a good time to add this feature.

Having a framework implemented for particle attributes opens up the possibility for making it easier to add other attributes for interesting features. Such as particle attributes for color that can be transferred to the vertex colors of the surface mesh.