Houdini 19.5 Fluids

Point variable density

On this page

Houdini’s SOP FLIP fluids allow for the simulation of fluids with multiple densities or spatial variable density. Typical applications are water and oil or water and foam. For a multi-density or variable density simulation you have to create a custom attribute-field pair and define the density values through appropriate nodes. The following example scene guides you through the entire process.

Fluid setup

The following example demonstrates how to use attribute-field pairs. The goal is to create a simulation with a water surface with a density of 1000 and two sources with density values of 100 and 500. Additionally, the particles should have different colors, represented through a Cd attribute.

  1. On obj level, create a Geometry SOP node and dive into it.

  2. Inside the node, create a FLIP Container SOP.

  3. Add a downstream FLIP Source: Velocity node and connect the first three inputs with the container’s outputs.

  4. Add another FLIP Source: Velocity and connect it.

  5. Finally, add FLIP Solver SOP node, and wire the first three inputs to the outputs of the second source.

  6. In the solver’s Waterline tab, turn on Waterline to create a water surface.

  7. Under Visualization, turn off Color By Speed.

  8. Go to Advanced and turn off Solve Pressure With Adaptivity. This is essential, because we’ll work with variable densities.

The water source objects can be any object, e.g. a Sphere SOP.

  1. Add two Sphere nodes.

  2. Connect sphere1 to the fourth input of the first source.

  3. Do the same for sphere2 and the second source.

  4. Select sphere1 and change Center to 2,3,0.

  5. Repeat step 4 for sphere2 and enter -2,3,0.

  6. You can stop sourcing in the source nodes by adding an expression to the Activation parameter. For the first source, enter $FF<50 to stop emission at frame 50. For the second source, use $FF<75.

With this setup you get a narrow band water surface and two velocity sources, adding particles to the simulation. In the next step, you create the attributes.

Attribute-field pairs

The first stop is the FLIP Container. There, the attribute-field pairs are created. In contrast to DOP FLIP fluids, those pairs are maintained automatically throughout the chain.

In this simulation, the surface water’s density should be 1000 - the value of water under standard conditions. This value is also called background value and used for the background grid.

  1. In the Attributes sub-pane go to Custom Attributes and click the + button twice to create two point attributes.

  2. For the first Point Attribute Name, enter density.

  3. Here you also define the background value. Set Value to 1000.

  4. With density you also have to turn on Custom Volume Name.

  5. For Volume Name, enter massdensity. Step 4 and 5 signal the solver that density is not fixed.

  6. The second Point Attribute Name is Cd and represents the fluid’s color.

  7. Color consists of three values for R, G, and B. To get the correct format, change Rank to Vector. Three Value fields appear.

  8. The surface water in this simulation should be blue (the background value/color). Set the 3rd Value to 1.

Source attributes

At this stage, all fluid particles share the same density and Cd values, defined in the FLIP Container, but each source should have different values.

  1. Add an Attribute Create SOP node and wire it between sphere1 and its connected source.

  2. Change Group Type to Points.

  3. Under Number of Attributes, click the + to create a second attribute.

  4. Go to Name and enter density.

  5. Look for the Value parameter and enter 100 for the first value. This is the first source’s density and makes the particles float on the water surface.

  6. In the second attribute, set Name to Cd.

  7. A Size of 3 stands for a color’s RGB values.

  8. Under Value enter 1 to create pure red.

  9. Copy the Attribute Create node with ⌃ Ctrl + C and paste it with ⌃ Ctrl + V.

  10. Wire the copied node between sphere2 and its connected source.

  11. Go to the first attribute (density). For Value enter 500.

  12. The Cd Value fields are 1,1,0 to create yellow particles.

The video shows how the red fluid floats on top of the surface like foam. The yellow, slightly heavier fluid, goes beneath the surface, but rises up and creates a boiling effect. The heavier fluid displaces the red particles.

With this setup it’s possible to simulate typical oil-in-water scenarios. You can also add a viscosity attribute and create simulations like liquid chocolate in milk or cream and caramel.

See also Caching, compressing, surfacing, previews for more information.


For beginners


Particle Fluids (SOP)

Viscous fluids (SOP)

FLIP Configure tools (SOP)

Optimization (SOP)

Particle Fluids (DOP)

Viscous Fluids (DOP)

Oceans (DOP)