Particle-Based Meshing

If you went through "Foam with Standard Particles" tutorial you might have been missing one thing: mesh creation. In this workshop you will learn how to mesh the results from this lesson.




Here is the nodes list:

  • 1 “Particle mesh” node (not the “legacy” engine)

All scene elements can be added from RealFlow's shelves:

  • Mesh

  • RealFlow nodes can be moved, scaled, and rotated with the WR, and E keys.

  • Viewport perspective is changed with the 123, and 4 keys.

  • Shading modes are toggled with the 789, and 0 keys.

Overview

This scene contains two emitters, but only the “Square01” node will be meshed, while the fluid from “Container01” should be rendered as particles. Choose a frame with lots of details, and follow these instructions:

  • Edit > Add > Mesh > Particle mesh

  • Nodes > ParticleMesh01 > right-click > Insert particles source > 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”.

Now click on the emitter alias and you will find two more panels: when you create a mesh, the engine puts small spheres at the particles' positions and blends them to create a coherent surface. The radius of these spheres is adjusted with the emitter-related settings:

 

 

  • 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 Settings

A very good and reliable way to start with RealFlow's “Particle mesh” is to use very similar settings for “Polygon size” and “Radius”:

 

  • 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 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 > 16

  • 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).

Channels

Channels are essential for realistic rendering and they help you to visualize changes in speed, age, or density – to name but a few. With a velocity channel, for example, it is possible to create the whitening effect of a rapidly moving fluid. RealFlow's “Particle mesh” engine provides a wide variety of attributes to save with the mesh:

  • 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.

  • 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”.

Build Mesh Sequence

Now, the mesh sequence can be created:

 

 

  • 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.

You will see a warning in the "Messages" panel, telling you that RealFlow did not find any meshes. This warning can be ignored, because during the mesh creation process RealFlow is playing back the simulation and looks for already existing mesh files.