If you went through the fluid tutorials you might have been missing one thing: mesh creation. In this workshop you will learn how to mesh the results from the “Foam with SPH Fluids” and “Shattered Glass” lessons.
A mesh with particles from the "Foam with SPH Fluids" tutorial.
Here is the nodes list:
1 “Particle mesh” node (not the “legacy” engine)
...
Edit > Add > Mesh > Particle mesh
Nodes > ParticleMesh01 > right-click > Insert emitters > choose “Square01”
The mesh node now has an alias of “Square01” attached.
A click on the mesh node itself reveals a wide variety of settings under “Node Params”, but not all of them are relevant for a good mesh. The most important settings are located under “Mesh”.
...
Click on the mesh node's “Square01” alias.
Go to Field > Radius
If “Radius” is too small then the spheres might not interpenetrate and you will see a torn fluid with holes. If it is too big the fluid's borders become thick and you will lose detail.
...
Mesh > Polygon size > 0.02
Field > Radius > 0.03
Now, make one more adjustment to get a better representation of the particle cloud
Mesh > Weight normalization > Yes
Click on the “Build Mesh” button from the “Mesh” shelf to create the mesh for the current frame. As you can see, the result is already very good. If If you need a higher level of detail just decrease “Polygon size”.
The mesh's borders are a little too round, and this is something that can be fixed with the entries from “Filters”:
Filters > Filter > Yes
@ Relaxation > 0.1
@ Steps > 1216
Recreate the mesh
...
“Steps” tells the engine how often the relaxation filter will be applied. With higher settings the borders become sharper. With settings greater than 100 you can often observe the look of liquid metal which completely destroys the impression of a watery or milky fluid. Always start with moderate values between 8 and 32. In this case, "Steps" should not be too high, because otherwise the mesh will shrink, and you might lose the connection between the mesh and the foam particles. This results in visible gaps in the final render (see "Foam with SPH Particles" for more information about the simulation's foam pass).
Foam with SPH Fluids - Channels
...
Open “Particle Channels”.
Enable/disable the appropriate channels with “Yes” and “No”.
For the second step, the channels have to be exported with the mesh files:
Export > Export Central
Open the “PARTICLE MESHES” branch. There you will find several file formats to choose from.
BIN is the standard format and supports only a few basic channels.
ABC (Alembic) can store the entire range of channels.
MD provides the most sophisticated method, because here you can also decide which channels you want to include. Of course the channels have to be activated under “Particle Channels” before – otherwise they remain empty.
Enable “Mesh sequence (.md)” and leave “Mesh cache (.bin)” activated, because it is required by RealFlow.
Uncheck the unused channels, but leave “normal” and “texture” active in any case.
Click on “Done”.
Foam with SPH – Build Mesh Sequence
...
Select the “ParticleMesh01” node.
Shelves > Mesh > Build Mesh Sequence
This action can be stopped with the Esc key, but it might take a short while until the process is interrupted, because the current mesh will be finished first. All files will be written to the project's “mesh” folder.
...
Again, start with Polygon size = 0.02, Radius = 0.03, Weight normalization = Yes
Shelves > Mesh > Mesh interactive mode
The mesh is created automatically every time you change one of its parameters.
Since it is hard to see and evaluate the live changes when the mesh is selected go to View > Show > Selection highlighting. With this action you will have a better view of the mesh.
When you alter parameters like “Polygon size”, “Field”, or “Weight normalization” it takes longer to update the mesh, because the entire geometry has to be rebuilt. Filtering and optimization, on the other hand, is performed very fast.
If the mesh does not represent all the fine drops decrease “Polygon size”, e.g. to 0.015. “Radius” can also be slightly decreased.
Once you are happy it is time to work on the fluid's borders:
Filters > Filter > Yes
Adjust the “Steps” parameter to taper the borders, but avoid high values. With each new value the mesh will be updated.
In order to get thinner splashes, activate “@ Thinning”. This parameter is not influenced by the “Steps” parameter. A value between 0.2 and 0.3 should produce good results.
At the moment all settings are temporary due to the interactive mode. In the last step, bake the mesh:
Shelves > Mesh > disable “Mesh interactive mode”.
Shelves > Mesh > Build mesh
...
Now, the channels and export formats can be specified. Create the mesh sequence for the entire simulation.