Temitope FALADE's profile

HOUDINI - FLIP SIMULATION PART 3 (WHITEWATER)

HOUDINI - FLIP SIMULATION PART 3
(WHITEWATER)
INTRODUCTION
When water flows in a direction without any disturbance to it, it do so with a certain velocity v. Because there are no disturbances, there would be no change in the path of the water, that is, no vorticity. So by definition, Vorticity is simply the change in the direction (or path) and velocity of flowing water due to disturbances to it's movement resulting in a churning of the water. This disturbance could also result from the water colliding with a surface or an external force acting on the water. During this change in direction, many air bubbles will try to escape from the water, and these escaped bubbles forming on the surface of the water are called whitewater (or foams). So that means foams are only formed when there is churning or vorticity in the water.
HOUDINI SETUP
We can setup our flip simulation to generate whitewater. There are several ways we can do this, and we are going to look at two ways that we can create whitewater in our flip simulation.
Let us start by first creating our basic flip setup like we learnt in the earlier module. We should have a setup like below:
If we play the simulation, the flip particles splash around inside the container, but currently, we do not have any foams or whitewater present.
To add the whitewater, we will first need to enable 'vorticity' in the flip solver under the vorticity subtab of the particle motion tab. This will now allow our flip setup to calculate the vorticity in the water at points of disturbances.
Next, let us cache out the simulation using the techniques we learnt in the basic setup module.
WHITEWATER SOURCE
After caching out the simulation, we will now create the whitewater source. We are going to look at two methods to create the whitewater source:
1. Using Whitewater Source Node
The first method is to create a 'whitewater source' node right inside the cache SOP level. We will connect the output from the file cache node into the 'liquid simulation' input of this whitewater source node.
If we playback, we should see some volume clouds created at the points of disturbance in the flip simulation. There are three parameters responsible for generating the whitewater source, namely: Curvature, Acceleration, and Vorticity. Depending on our needs, we can determine which parameter should generate the whitewater. For now, we are going to keep the three parameters.
2. Using Group Expression
The second method we can use to create whitewater source is the group expression method. We need to select some points in the flip simulation with a certain vorticity magnitude range to serve as the source of our whitewater, and this is exactly what the group expression node does for us.

Let us create a 'group expression' node and connect the output from the particle fluid surface node to it's first input. 

In the 'group name' field, let us write 'vorticity', and change the group type to 'points'

In the VEXpression, let us write the expression: @vorticity > V, where V is a vorticity magnitude. For example, if we type: @vorticity > 15, this means the points in our flip simulation with a vorticity greater than 15 would be selected. By varying the vorticity magnitude, we can control the total number of whitewater particles generated. For instance, if we need more whitewater, we will simply reduce the V-value, and if we need less whitewater, we will simply increase the V-value.
Next we will separate these points from the flip simulation. To do this, let us connect a 'blast' node to the output of the group expression node. In the group dropdown, choose 'vorticity' (the one we created earlier in the group expression), and enable 'delete non-selected'. What this basically does is to delete every other points that are not part of the 'vorticity' group. We should have something like this now:
Next, we are going to convert these vorticity points into volume clouds (similar to what we saw in the first method). To do that we will connect a 'vdb from particles' node. Reduce the 'minimum radius in voxel' to 0.1; disable 'distance vdb' and enable 'fog vdb' instead. We see that 'density' is written in the fog vdb field. We will change this to 'emit' instead. This is to ensure that when we simulate the whitewater, it emits the whitewater particles for us.

Now the vorticity points should now be converted into volumes. For house-keeping sake, we will connect a null output node named "ww_source_out" to the setup.
These are the two methods we can use to generate whitewater sources. We can use either of the two methods depending on what we are trying to do, both method works.
WHITEWATER SIMULATION
At this stage, we should now be seeing the pattern of how Houdini simulation works. In flip simulation, we generated some points which served as the source of the flip particles. Same way, in whitewater simulation, we need to generate some points to serve as the source of the whitewater particles (which we have done with the two methods above).
In the same way we simulated flip particles, we are going to simulate the whitewater as well. We will start by creating a new dopnet renamed as "whitewater" for the whitewater simulation and then go into it's SOP level.
Just like flip simulation, we need whitewater object node and whitewater solver node setup as shown below. We don't need a gravity node since the movement of the whitewater is already dependent on the movement of the flip particles which is already influenced by gravity already.
To ensure consistency, we can match the size and position of the bounding box (Limits) of the whitewater to that of the flip bounding box via relative referencing. 

However, we do not need to link the particle separation of the flip object to the whitewater scale of the whitewater solver. We will have to control this scale independently to control the resolution of the whitewater simulation.

To generate the whitewater particles, we will need to reference-in the output null of the whitewater source into the 'Emission Source' path field.
Also, to ensure that the whitewater particles inherit the velocity of the flip particles, we will first need to connect an output null to our dopimportfield node in the cache SOP level
Then we will reference-in this null node into the 'volume source' field of the whitewater solver. This will now serve as the velocity source for the whitewater particles.
If we play the simulation now, the whitewater particles should be created.
FINE-TUNING THE LOOK OF THE WHITEWATER
Now, we are going to explore some properties that we can fine-tune to improve the behaviour and look of the whitewater.
1. Base Advection Strength:
The base advection strength is used to give patterns to the foam particles. This is basically how much the foam particles adhere to the water flip particles. We can find this setting under the 'Forces' tab of the whitewater solver:
If we increase the Base Advection Strength to a pretty high value, this will make the foams move more closely with the flip particles; and if we reduce the value, it will make the foam particles to not move much with the flip particles. Depending on the pattern we are trying to create, we can control this value.
2. Base Velocity Multiplier:
If we want to create exaggerated splash, we can increase the base velocity multiplier. Typically a value of 2 works in most cases, but we will usually set the value to 1.
3. Buoyancy:
Buoyancy is the ability of the foam particles to rise. If we want to create underwater bubbles, we can achieve that by tweaking the buoyancy.
4. Density Control:
We can use the density control to add some denseness (or volume thickness) to our foam particles. Say for instance, we are trying to create foam for a beer or a liquid with really thick foams, we can use this setting to achieve that. 

We can also combine this setting with the base advection strength to start getting interesting look and patterns for the foams.
In the advanced tab, we can adjust settings like:
- Neighborhood size to clump more (or less) foam particles together;
- Maximum neighbors to set the highest number of neighboring particles that can clump together;
- Tensile Radius to determine the force of attraction between each neighbors;
However, we should note that using this Density Control settings is going to impact our simulation time.
5. Adhesion:
This is basically how easy it is for the foam particles to detach from the water surface. Set the control range to 1, then vary the Off Velocity Angle. Increasing the Off velocity angle to 360 makes it easy for the foam particles to detach and spray around, while a value of 1 makes it difficult to detach.
6. Erosion:
Erosion basically kills isolated foam particles, and it preserves clumped foam particles. Play around with the strength and preservation values to get different results.
7. Repellants:
This is the most important setting to really tweak the look of the foams. The circular patterns that we see in foams are due to repellant forces.
To see these repellants in the viewport, select the whitewater object node, under the guides tab, enable 'repellants'. You can increase the repellant size to make them bigger.
- Feature size range: If you reduce the feature size range, it will add more repellants to the foam, creating more patterns for the foam. We can play around with this range to get different kinds of results.
- Strength range: The strength range controls how fast the patterns are created. Higher value means the patterns would be formed at a very fast speed and vice versa. Usually, a low strength range gives a more natural result.
- Noise range: This introduces some noises into the patterns being generated. A value of zero will make the patterns perfectly circular. In reality, we cannot have such, so it is a good practice to try out different ranges to see what results we can get.
- Reseed Frames: This is the interval in which the repellants are being spawned or generated. For example, setting this to 1 means repellants would be generated at every frames. This can slow down our simulation, so we may need to set it to a more higher value for better results.
CACHING THE WHITEWATER
As usual, we need to cache out the simulation. Inside the cache SOP level, we will create a new dopI/O node to import the whitewater simulation into this SOP level. In the DOP network field, we will choose whitewater. Then in the preset, we will choose 'particles'. We will then connect a fluid compress node and link it's particle separation to the whitewater scale via relative referencing.
Let us add an 'attribute delete' node after the dopimportfield node to help us delete some unwanted attributes that will make the cache size too large. Type * inside all the available attributes (that is, point, vertex, primitive, and detail attributes).
Finally, we can specify the output directory on the file cache node, name our cache file using the usual convention, and write it to disk.

If we wish to export the foam as mesh to a third-party software like Maya, we simply need to connect a particle fluid surface to first convert the foam particles into mesh, fine tune the look of the mesh, and write them out to alembic file by connecting a 'rop alembic output' node.
HOUDINI - FLIP SIMULATION PART 3 (WHITEWATER)
Published:

Owner

HOUDINI - FLIP SIMULATION PART 3 (WHITEWATER)

Published: