On this page

With phases, Vellum will solve for viscosity and surface tension separately to simulate different types of fluids. This option is only available for fluids and you can’t combine grains and water through phases, for example. You're also not limited to two phases. You can find the parameter in the Vellum Constraints Grain SOP node’s Physical Attributes subpane. Note that Type has to be set to Fluid. It is, of course, possible to set up two fluids and ignore phases, but the results might not meet your expectations. Fluids with

In the following example you create a scene with three fluids, pouring into a bowl: the first fluid behaves similar to slightly whipped cream, the second one is liquid chocolate, and the third liquid is comparable to caramel. To make everything more interesting, a blender stirs the ingredients. Note, that the fluids don’t have to be physically correct. The project’s main purpose is to demonstrate the concept and show, how various substances interact. You can therefore use other parameter combinations.

The project is subdivided into several main parts:

  1. The bowl’s geometry

  2. Source objects

  3. Creation of a fluid network template

  4. Solver settings

  5. Connecting fluids and solver

Note

At the end of this page you can find two files available for download. The first file contains only the bowl and blender objects; the second file is the complete project for reference. The following descriptions are all based on the first file’s nodes.

Bowl and blender

The bowl is an object of revolution and acts as a collision object for the fluids.

  1. Load the file and double click the fluid Geometry SOP node to dive into it.

  2. There, you can see five nodes, describing the bowl’s shape.

  3. The blender is just a Box SOP.

  4. Click the Box node and go to Rotate.Y. There, enter $FF*15. This expression makes the object spin around its Y axis. $FF stands for the exact frame and the value is multiplied with a factor of 15. By changing the factor, you can make the blender slower or faster.

Source objects

The fluid sources are three identical spheres, rotating around the bowls' center. Instead of keyframing the spheres' positions, you can use expressions. This makes it much easier to apply changes to rotation speed, start position, and radius.

  1. Add a Sphere SOP.

  2. Set Uniform Scale parameter to 0.1.

  3. Change Center.Y to 0.2

  4. Use ⌃ Ctrl + C and ⌃ Ctrl + V twice to copy and paste the Sphere node. You now have three spheres.

  5. Rename the objects to source_cream, source_chocolate, and source_caramel.

Motion expressions

A circular motion can be described through sine and cosine functions. The parametric formulas for this scene are sin($FF*speed+offset)*distance and cos($FF*speed+offset)*distance

  • speed is a factor and higher values make the sphere faster.

  • offset shifts the sphere’s starting position.

  • distance is the distance to the scene’s midpoint and measured in meters.

Add the sine function to a sphere’s Center.X, the cosine function to Center.Z. Together, the expressions describe a circle with a clockwise motion. For a counterclockwise motion, one of the expressions has to start with a - (negative) sign. For

  1. source_cream use sin/cos($FF*7+160)*0.2

  2. source_chocolate use sin/cos($FF*6)*0.3

  3. source_caramel use sin/cos($FF*4+100)*0.1.

Fluid template

The scene contains three different types of fluid and each material has to be defined separately. A fast way is to create a network for the first fluid, copy/paste it, and make the individual settings.

  1. From the TAB menu, add a Vellum Configure Fluid SOP. When you look at the node, you can see that this element is a Vellum Configure Grain SOP, but preconfigured for fluids.

  2. For testing, Particle Size can be rather large. Enter a value of 0.01. In the final simulation, this parameter will be decreased to 0.005. This value creates a final particle count of roughly 530,000. A sufficient number of particles is essential if you want to create fine structures and drops.

  3. The parameters in the Physical Attributes subpane define, which type of fluid you want to create. The settings will made later.

Even with relatively large Particle Size values you get a good approximation of the final simulation. Drag the slider to compare the images:

The following attribute and color nodes are not absolutely necessary, but help to add more randomness and separate the fluids visually.

  1. Add an Attribute Adjust Vector SOP. This node will add some position randomness to the particles to avoid an uniform look.

  2. Link its input to the first output of the Vellum Configure Grain node.

  3. Go to Attribute Name and delete the v entry. Then type P for position.

  4. From the Adjust with dropdown menu, choose Noise.

  5. From the Range Values dropdown menu, choose Min/Max.

  6. Set Min Value to -0.02 and Max Value to 0.02. These settings displace the particles randomly at creation time.

  7. Open the Animation subpane and turn on Animate Noise.

  8. Add a Color SOP and connect it to the Attribute Adjust Vector node’s output.

  9. Add two Null SOPs.

  10. Connect one Null to the Color SOP’s output. The Null terminates the chain and stores the particles.

  11. Connect the other Null to the Vellum Configure Grain node’s second output to store the constraints.

Now, use the LMB to draw a rectangle around the template nodes (Vellum Configure Grain, Attribute Adjust Vector, Color, Nulls) and select them.

  1. Press ⌃ Ctrl + C to copy the nodes, and two times ⌃ Ctrl + V to paste them.

  2. Go to the Color SOP. Choose a brownish Color for chocolate and orange for caramel.

  3. Rearrange the networks to separate them.

You now have three networks for cream, chocolate and caramel.

Connections and node names

Connect the first inputs of the Vellum Configure Grain nodes with the outputs of their corresponding source spheres: source_cream, source_chocolate, and source_caramel.

To make the different networks distinguishable, apply names for the Nulls:

  1. The Nulls that are connected to the Color SOP should be named GEO_CREAM, GEO_CHOCOLATE, and GEO_CARAMEL.

  2. The Nulls that are connected to the Vellum Configure Grain nodes' second output should be named CON_CREAM, CON_CHOCOLATE, and CON_CARAMEL.

Your network setup should now look like this:

Fluid settings

The first network simulates slightly whipped cream.

  1. Click the first Vellum Configure Grain node (connected to source_cream) to open its parameters.

  2. Expand the Physical Attributes subpane.

  3. For Density enter 1100. This is slightly more than the density of water.

  4. Check, if Phase is set to 1. This parameter tells the solver that you want to use fluids with different physical settings and cares for better particle separation.

  5. Turn on Viscosity and enter a value of 50.

  6. Turn on Surface Tension and enter a value of 40.

Use the following settings for chocolate:

  1. Set Density to 1300.

  2. Change Phase to 2.

  3. Turn on Viscosity and enter a value of 250.

  4. Turn on Surface Tension and enter a value of 10.

Here are the values for caramel:

  1. Increase Density to 1600.

  2. Change Phase to 3.

  3. Turn on Viscosity and enter a value of 2000.

  4. Turn on Surface Tension and enter a value of 5.

Collision

The Vellum Configure Grain nodes provide a third output: Collisions. The particles should also interact with the bowl and the rotating blender.

  1. From the TAB menu, add a Merge SOP.

  2. Connect the bowl’s Transform and Box outputs with the Merge node.

  3. Connect the third outputs of the Vellum Configure Grain nodes with the Merge node. Merge should now have five incoming connections. Later, the Merge SOP is linked to the solver to establish the connection.

  4. By default, the collision geometry is visible. If you want to hide the collision geometry, go to the Vellum Solver’s Visualize tab, and urn off Show Collision.

Solver settings

The Vellum Solver SOP is the network’s centerpiece. It processes the incoming information from the GEO and CON nodes, and the collision objects.

  1. Add a Vellum Solver SOP and connect its third input (Collisions) with the Merge node’s output. Although the first two inputs are mandatory, they will remain empty here. The connection between particle geometry, constraints and solver is done a little later inside the Vellum Solver through the GEO and CON Nulls.

  2. Go the Solver tab and change Substeps to 7. The recommended minimum value for fluids is 5, but in simulations with high viscosity, Substeps should be higher to stabilize the particles.

  3. For fluids, Constraint Iterations should be around 20.

  4. Smoothing Iterations aren’t needed here and can be set to 0.

To establish the particle-constraint-solver connection, additional nodes have to be introduced. Double click the solver to dive into it.

  1. From the TAB menu, add a Vellum Source DOP and a Merge node.

  2. Connect Vellum Source and Merge; then link the Merge node’s output with the input of SOURCE.

  3. Click the Vellum Source to open its parameters.

  4. Click the SOP Path parameter’s operator chooser. From the node tree choose GEO_CREAM.

  5. Do the same for Constraint SOP Path, but choose CON_CREAM.

  6. Change Emission Type to Each Substep. This parameter is not directly accessible in Vellum SOP networks, but necessary. Therefore, the particle-constraint connection can’t be established through the solver’s inputs. Without Emission Type, fluid is only sourced at frame 1.

Connections are also required for the chocolate and caramel networks.

  1. Press ⌃ Ctrl + C to copy the Vellum Source, and ⌃ Ctrl + V to create two copies.

  2. Connect the copies to the Merge node.

  3. Change the SOP parameters of the first copy to /obj/fluid/GEO_CHOCOLATE and /obj/fluid/CON_CHOCOLATE.

  4. The entries for the second copy are /obj/fluid/GEO_CARAMEL and /obj/fluid/CON_CARAMEL.

Activating the sources

By default, particle sourcing starts at frame 1 for all three fluids. However, the simulation looks more interesting with different start and stop frames. Expressions are a fast way to animate the Activation parameter and control sourcing.

Note

If you want to learn more about how to control sourcing, please read the Emission methods page. There you can find many examples and setups.

  1. The Vellum Source for cream should create particles between frame 42 and 120. Go to the Activation parameter and enter if($FF>42 && $FF<120,1,0). This expression switches the parameter from 0 to 1 in the specified frame range.

  2. For the chocolate source, use $FF<131. Here, sourcing starts a frame 1 and ends at 130.

  3. The caramel source’s expression is if($FF>24 && $FF<122,1,0).

  4. Return to fluid level.

Deleting stray particles

Some particles are highly accelerated and leave the bowl. You can remove stray particles with a POP Kill DOP inside the Vellum Solver.

  1. Double click the Vellum Solver to dive into it.

  2. From the TAB menu, add a POP Kill DOP and connect it to the FORCE node.

  3. In the Rule tab, turn on Enable to make the VEXpression field editable.

  4. Type the following expression:

if (length(@v) > 1.7) {
    dead = 1;
}

This short expression calculates the length (= speed) from the velocity vector v for each particle and compares it against a threshold. When a particle’s speed is greater than 1.7, the condition is fulfilled and the particle removed. The threshold is the result of several test simulations.

Friction

To make the fluids stick on the bowl’s surface, you can add friction. Vellum provides two methods: per-particle friction and object friction. When you take a look at the vellumfluid1 node’s parameters, you can see Friction and Dynamic Friction. The parameters are multiplied with the corresponding Vellum Solver’s Static Threshold and Dynamic Scale. In this scene, object-based friction is used.

  1. Add an Attribute Create SOP.

  2. Place the new node between Revolve and Transform to connect them.

  3. The attribute’s Name is dynamicfriction.

  4. Make sure that Class is set to Point, because with friction, Vellum interprets geometry also as points.

  5. Go to the first Value field and enter 4.

Caching

The scene takes a while to simulate and the results should be saved to disk. Vellum provides a dedicated node to cache geometry, constraints, and collisions in one pass.

  1. On fluid level, add a Vellum I/O SOP and connect its inputs to the three corresponding Vellum Solver outputs.

  2. You can go on with the I/O node’s default settings and click Save to Disk or Save to Disk in Background. The difference between both methods is that Houdini’s UI remains responsive with the latter method.

Here is the complete network setup:

You are now ready to start the simulation. Go to the the playbar and press the button. If everything works as expected, the result should be similar to the video below. You can see that the particles are sourced at different positions and times. Friction makes the fluids stick on the bowl’s surface and creates a more natural look. Cream, the fluid with lowest Density, floats on top of chocolate and caramel. The video below shows the simulation with Particle Size set to 0.002.

In this clip, all Phase parameters are 1. The fluid mixes more and most surface structures have vanished. Especially the white cream particles behave completely different.

Files

Vellum Fluid Phases Start

This example contains the necessary objects to create interacting Vellum fluids with different Viscosity and Surface Tension settings through the Phase parameter.

Vellum Fluid Phases Reference

This example contains is a complete setup for creating interacting Vellum fluids with different Viscosity and Surface Tension settings through the Phase parameter.

Vellum

Cloth

Softbody

Fluid

Constraints

Collisions

Other

Advanced