Simulating Fluids 

 

Overview 

One of Lucid's strength is its ability to help you quickly and easily create simulations of fluid objects. Water, glue, mud, and jelly are just some of the possible configurations. Create a fluid volume or emit the fluid using Particle Flow, set some parameters and quickly see it in action.

 

Using fluid volume 

The easiest way to create a fluid in Lucid is to select a mesh in the scene and use it to define the volume of liquid. Fluid particles will be generated within this mesh using our tight-packing algorithm.

For example, you can use a fluid volume to create a pool of water, a water droplet, or a jelly cake.

To create a fluid volume:

 

With Lucid toolbar 

  1. Select your object
  2. Click on the Water, Mud, or Glue preset in Lucid toolbar
 

Manually 

  1. Select your object
  2. In the modifier stack add Lucid Modifier
  3. Set the Material Type to fluid

You are ready to simulate.

 

Using Particle Flow 

To gain much control over how fluid is generated, simulated, and destroyed, you can use Particle Flow. This allows Lucid fluid particles to be created over time, different forces to be applied to them, and fluid particles can be deleted or removed from simulation arbitrarily.

For example, you can use Particle Flow Lucid fluid to create a waterfall, a hose spilling water, or a river flowing into an ocean.

To use Lucid with Particle Flow:

  1. Create a Particle Flow source object
  2. Open Particle View
  3. Find Lucid Fluid operator inside the operator depot list
  4. Drag Lucid Fluid operator icon and drop it inside a Particle Flow event between other operators

You need to manually start the simulation with an Incremental mode. Once you do this, scrubbing the timeline will produce the fluid particles. The scene will behave similarly to performing any other Particle Flow simulation from now on. If you stop Lucid simulation the particles will be glued to the Particle Flow source emitter.

Note: It helps to create a Flex Settings Helper and set Manual Radius parameter to a non-0 value since default radius of fluid particles might be too small or too big for your simulation.


Basic Particle Flow Setup (Begin at 2:55)
 

Recording Particle Flow simulations 

Just like any other place in Lucid, Particle Flow fluid particles can be recorded. It is recommended not to change birth or death parameters in Particle Flow after recording Lucid fluid because Lucid relies on the same particles to be present to restore their positions during playback. Any modifications to particle behavior will also not be reflected during playback of pre-recorded Lucid fluid particles.

 

More information 

Help on having multiple emitters and displaying the fluids can be found in Working with Particle Flow and Particle Flow Fluid Operator documentation.

 

Working with fluid mesh 

Lucid presents two ways to display simulated objects: as particles or as a mesh. In case of fluids, the displayed mesh is generated from fluid particles using our fast fluid meshing algorithm. During simulation tweaking and viewport preview it is generally advisable to show the fluids as particles. This provides quicker display feedback and requires fewer calculations. However, it is usually needed to have the fluid converted to a mesh for rendering and presentation.


Iso and Anisotropic fluid meshing (Begin at 2:35)
 

Fluid volume mesh 

If a simulation is active it is very easy to switch between particle and mesh representation of fluid volumes. To do it, go to the Lucid modifier of the object and toggle the Show as Particles option. You should see the resulting fluid change between particles and mesh right away.

If you have recorded your fluid with Show as Particles option on, then you will be able to use this option later on during recording playback to choose whether to display as particles or mesh the same way as if you were simulating. This is due to the fact that particles can be meshed at any time. It is, however, impossible to do the reverse (convert fluid mesh back to particles).

If you recorded your fluid with Show as Particles option off, you will only be able to play back the fluid as a mesh in the future. It is only beneficial to use this approach when there are too many particles and the resulting mesh will result in a smaller file size. Recording the particle mesh also has the benefit of speed during playback because particles don't have to be (re)meshed in the future.

 

Particle Flow fluid 

You can use the Particle Flow Display Operator to mesh particles displayed using Particle Flow. Similarly to fluid volumes, it provides the Show as Particles option which can be used to switch between particle and mesh display of your fluid.

 

Multiple fluids in same mesh 

Lucid provides a way to combine multiple fluids in a single mesh using the mesher object. In it you can select a combination of fluid volumes and Lucid Particle Flow fluid operators and have them be meshed together into one resulting object.

 

Meshing parameters 

Lucid shares meshing parameters between the various fluid simulation types. These parameters allow you to control the granularity of meshing, if and how texture coordinates are generated, and other useful features. The most important of these is the Granularity parameter which determines the size of voxel samples used by our meshing algorithm. The smaller the value, the better and more detailed the mesh will be at the expense of processing speed and required memory. Learn more about these parameters in Lucid modifier documentation.

 

Motion blur 

If motion blur is important for your simulation, it is advised to record it as particles (with Show as Particles option on) and use sub-sampling to generate the motion blur in your renderer. Rendering as particles allows generation of fluid mesh at sub-frame intervals later on, which in turn allows a renderer to compute the motion blur.

 

UV coordinates 

Depending on your desired effect it may be necessary to have texture coordinates support in simulated fluid. For example, you may want a texture of glowing lava, or dirty mud superimposed on top of the fluid mesh. Lucid allows this through preservation or generation of texture coordinates in the fluid mesh. When using a fluid volume texture coordinates can be sampled from the original mesh and then mapped onto the resulting fluid mass. Alternatively, new texture coordinates can be generated based on the world space position of fluid particles in their initial state.


Preserving fluid UV coordinates (Begin at 3:40)
 

Creating foam 

To add realism to water and other low-viscosity fluids you can add simulated foam particles using Lucid's foam object. Once you set up the fluid, simply click the foam button on the Lucid toolbar or use Lucid main menu to do the same. A global foam object will be created which will generate extra particles every time fluid particles in the scene meet special criteria.

Foam particles are automatically destroyed and otherwise managed by Lucid. If you have multiple fluids in the scene foam particles will be generated for all of them. You can use the mesher object to add foam particles to a new fluid mesh, or use the built-in meshing capabilities of the foam object.

The global particle count displayed by the Flex settings helper takes the current number of foam particles into account.


Simulating foam (Begin at 10sec)
 

Known limitations 

Foam object takes some adjustments to look right and might not be useful for certain scenarios. For example, foam particles will penetrate both static and animated collision objects. They might not respect external scene forces the same way other Lucid objects do.

Missing Something? Let us know if this page needs more information about the topic.