HySPH - Displacement Tools

In the “Liquid – Hybrido” shelf you can find two tools for synchronizing your foam simulations with the core fluid's displacement (“Ocean Statistical Spectrum”), and the Hybrido mesh. When we talk about “foam” here, we are referring to the following HySPH emitters: “Foam”, “Splash & Foam”, “Bubbles”, “Wet & Foam”, “Waterline”. In the combined emitters, only the foam particles are affected by these tools. They replace the graphs which have been used in the previous version, although these graphs are still available under RealFlow's “Demo scenes”.

The idea behind these tools is that the basic secondary simulations do not take the core fluid's displacement into account and you will see an offset between the HySPH particles and the fluid's surface respectively in the Hybrid mesh. To close this gap, the tools evaluate the displacement structure and reposition the particles to match the surface waves. This is a non-destructive process where the original files will be kept and not overwritten.

On the first look it seems as if both tools are doing more or less the same, but there is an important difference. The “Displace Foam Particles” tool is very fast, because all it does is to evaluate the core fluid's displacement and to reposition the particles. When you create a mesh this process might not be accurate enough, because it does not consider all the parameters you can apply to the mesh's displacement structure, e.g. velocity or height attenuation.

When you use “Snap Foam Particles” the tool will evaluate the mesh's geometry and place the particles on top of the mesh. This is a very nice and convenient feature in cases where you want to render all elements (mesh and secondaries) together. But, it is much slower, because it is a computationally expensive process..


For both, “Displace Foam Particles” and “Snap Foam Particles”, the workflow is very similar.

Displace Foam Particles

“Displace Foam Particles” requires a cached (= existing) simulation of a secondary foam-type emitter. The domain, on the other hand, doesn't require any cached particle data – only the “Ocean Statistical Spectrum” feature has to be active, because this information is used to displace the particles.

Before you use this tool, please select one domain node, and all the foam-type emitters you want to process. Then, click on the icon in the “Liquid – Hybrido” shelf. Now, the tool will create an appropriate number of emitter nodes with a “_Displaced” suffix, e.g. “HY_Foam01_Displaced”. You will recognize that the new emitters have different settings than their parent nodes, but as they are only used to collect the displaced particles, it does not make any difference.

Now, the tool will go through the particle sequences and process them. The progress can be monitored in the “Messages” window:

Executed "Displace Foam Particles Tool" for frame 18 in 0 hour(s), 0 minute(s) and 0.2500 second(s).


If you are not happy with the results, for example when you changed the ocean statistical spectrum, and want to repeat this process then the already existing “_Displacement” nodes will be reused and their data will be overwritten. The original simulation files will be kept though.


In simulations without an ocean statistical spectrum applied, this tool do not have to be used.


Snap Foam Particles

The mode of operation of this tool is almost the same as for “Displace Foam Particles”, but here a “Hybrido Mesh” node is used instead of a domain. First, select the mesh node and the foam-type emitters. Now, click on the icon in the “Liquid – Hybrido” shelf, and new emitters will be created wearing “_Snapped” suffix, e.g. “HY_Foam01_Snapped”.

The tool will process the particles and align them with the mesh's geometry – they're snapped to the mesh's surface. This process can be monitored in the “Messages” window:

Executed "Snap Foam Particles Tool" for frame 32 in 0 hour(s), 0 minute(s) and 0.0640 second(s).


As with the other tool, existing “_Snapped” nodes will be reused when the snapping process is repeated. Existing files will be overwritten, but the original sequence is not affected.

Using the Tools with RealFlow's Command Line Version

Both tools can be used with the Command Line version as well, and also with RealFlow Nodes. Here, a few preparations are necessary. Create an empty text file and enter the following lines of Python code:




For “Displace Foam Particles” append one additional line:



For “Snap Foam Particles” append these two commands:




Save the file and assign a name, e.g. foam_processing.rfs

To use the script with the command line version, open a terminal application (Command Prompt, Terminal, Bash, etc.) and type in:

realflow -nogui -script path_to_scrip_file/foam_processing.rfs


With a RealFlow Node it is very similar:

realflownode -script path_to_scrip_file/foam_processing.rfs


Related content:
Showing first 15 of 22 results