In X-Particles 3.5 this object was part of the SPH Fluids object. In X-Particles 4that has now been replaced by the PBD Fluids object and the Foam settings in the SPH Fluids object have been given their own object.
This object allows you to add foam, trapped air and spray to the fluids. A simple setup using a PBD Fluids object and a cube to act as a collider to contain the fluid particles can give this sort of result. The blue particles are the main fluid particles and the white particles are the foam, generated by a separate emitter:
Note that you can use the Foam object with both PBD Fluids and Fluid FX.
However, if you are using Fluid FX, any collision object the fluid particles are to collide with will have a Fluid FX Collider tag. This tag will NOT work with foam particles; for those, you need a standard X-Particles collider tag. But if you add one of those make sure that you exclude the emitter used by Fluid FX from it, as if you don't it may cause collisions to fail for the fluid particles.
The object's interface looks like this:
For the 'Groups Affected' and 'Falloff' tabs, and for the buttons at the bottom of the interface, please see the 'Common interface elements' page.
Drag the emitter to use to spawn foam particles into this link.
Click this button to create a new spawning emitter and add it to the 'Emitter' link field. This emitter will be used to create the foam particles.
This is the spawn rate (can be fractional) for particles created at the crest of waves (using the 'Min Crest' and 'Max Crest' settings).
This is the spawn rate for foam particles created as trapped air between colliding fluid particles (controlled with the 'Min Impact' and 'Max Impact' settings)'
Only those fluid particles which are older than this setting will create foam particles. This enables an emitter to fill or flow before creating the foam particles (otherwise on emission foam particles would be created immediately).
The maximum lifespan of the foam particles. Their actual lifespan depends on how they were created (potential of creation/velocity of particles).
Min Speed and Max Speed
This is the speed range needed by the fluid particles to create the foam particles. The highest speed (most energetic) fluid particles of your simulation should be set to create foam particles.
Min Crest and Max Crest
These settings represent the curvature of the wave crest needed to create foam particles. A low value implies something flat (which would not realistically create spray) and high values mean something like a wave curving right back on itself (again not realistic) so mid-range value are more natural.
Min Impact and Max Impact
These are the impact speeds between particles needed to trap air and generate foam.
The lifespan the foam particles are given if the surrounding fluid density is below the 'Foam Density' setting.
This controls how much the fluid drags the foam/air particles, but does not affect spray.
Drag a Gravity modifier into this link to specify which modifier to use. Otherwise the fluid object will use the first gravity modifier it finds when evaluating modifiers for this emitter (used for buoyancy, opposite to gravity direction).
On creation of the foam particles this controls how much random velocity is given to them to spray them away from the creation point.
If this is set then the foam particles are given a rotation which is then aligned (Y axis) to the fluid surface (when near the surface).
Please Note: if the foam spawning emitter is emitting particles this setting will only align their rotation if 'Use Rotation' in the spawning emitter was enabled.
Foam Density and Spray Density
The surrounding fluid density below which particles are considered to be spray or foam.