PhysX Fluid operator

The PhysX Fluid operator allows you to simulate two-way interactions between PhysX Shape particle rigidbodies and a PhoenixFD fluid simulation.

The PhysX Fluid operator does not rely on PhoenixFD active bodies (available in PhoenixFD v4.x). Instead, it uses a custom PhysX force implementation that is compatible with both PhoenixFD 3.x and PhoenixFD 4.x.

Due to the fact that this operator only uses grid data available in standard PhoenixFD output channels (it does not have access to PhoenixFD’s internal FLIP sim data), certain concessions regarding the overall quality of results must be accepted. Influence values will need to be carefully adjusted on a case-by-case basis and may require a decent amount of experimentation to get right.

The PhysX Fluid operator calculates forces by sampling interaction points from locations on particle meshes within the specified PhoenixFD fluid grid. When in bounding box mode, the quality of the interaction is affected by how tightly the particle’s bounding box conforms to its shape. When in convex hull mode, the quality of the interaction is affected by the number of points sampled on the hull.

In order to simulate two-way interactions as closely as possible, this operator is designed to run in lock-step with a running PhoenixFD simulation. That means that the flow should not be evaluated before or after the entire PhoenixFD simulation is run, but instead during the PhoenixFD simulation process. The easiest way to achieve this is to place the time slider at the starting frame of your PhoenixFD simulation, reset the flow, and then run the PhoenixFD simulation by pressing the “Start” button in the PhoenixFD interface (make sure your tyFlow has been added to the list of scene interaction objects within PhoenixFD if the interaction mode is set to “include”, and that the particles you wish to interact with PhoenixFD have a proper non-render-only Mesh operator assigned). Alternatively, if you press the “auto-setup” button in the PhysX Fluid operator, the flow will automatically be reset when the PhoenixFD simulation is run (requiring no extra user input in order for the flow to update in lock-step with a running simulation).

If you need to restore a PhoenixFD simulation, move the time slider to the restore frame, reset the simulation manually (letting it re-evaluate up until the restore frame), and then press the “Restore” button in the PhoenixFD interface.

Overall, the basic concept is to simply ensure that the flow updates on a per-frame basis while the PhoenixFD simulation is calculated. Since a running PhoenixFD simulation updates the time slider as it progresses, this will trigger the flow to update at each new frame as well.

The PhysX Fluid operator applies forces to PhysX particles that take their mass into consideration. Particles with more mass will require higher fluid density or influence values in order to be affected. For better results, ensure particle mass values are proportional to their volumes (this can be done inside a PhysX Shape or Mass operator).

Furthermore, it may be necessary to reduce the tyFlow’s velocity influence on the PhoenixFD simulation, in order to prevent velocity feedback loops from introducing unwanted motion to the simulation. This can be achieved by reducing the “Motion Velocity Effect” value in the PhoenixFD Properties window for the tyFlow object.


PhysX Fluid

  • PhoenixFD container name: The name of the PhoenixFD liquid container object in the scene which will be used to derive fluid forces.

To avoid a circular dependency between tyFlow and PhoenixFD, the PhysX Fluid operator does not hold onto a direct reference to the PhoenixFD node, but instead references it at simulation-type by its name.

  • Fluid density: the density of the fluid. Higher values will increase the overall influence of the fluid on PhysX particles.

By default, the PhysX Shape operator assigns volume-relative mass values to particles. If your particle are large, this could mean they are assigned very large mass values. You can think of the “fluid density” parameter as a parameter which controls the fluid’s overall mass. If your particles have a large mass, this value may need to be greatly increased, or you may need to manually assign smaller masses to your PhysX particles in order for the PhoenixFD fluid to influence them.

Influence
  • Velocity: a multiplier applied to velocity values sampled from the PhoenixFD grid.

  • Pressure: a multiplier applied to pressure values sampled from the PhoenixFD grid.

Pressure values are taken from a PhoenixFD’s “inject” data (listed under “special” in a PhoenixFD’s output rollout), which are assigned to the smoke channel of a grid. If other data is assigned to the smoke channel of a grid, the pressure setting will not work as intended.

  • Buoyancy: a multiplier applied to a velocity vector pointing straight up, for particle interaction points that are submerged in liquid.

  • Clamp magnitude: the maximum influence a combined velocity/pressure/buoyancy vector can have on a fully submerged particle. Decrease this value in order to prevent fluid forces from accelerating particles too quickly.

  • Drag: the amount of drag to apply to submerged particles, prior to applying fluid forces.

Interaction Points
  • On bounding box: fluid interaction points will be generated on the bounding boxes of particle meshes.

  • On convex hull: fluid interaction points will be uniformly distributed on the convex hulls of particle meshes.

  • Count: the number of interaction points to generate on each particle’s convex hull.

  • Offset: the distance from the bounds/hull that the interaction points will be offset.

Adding a slight offset can help ensure interaction points remain submerged in surrounding fluid, when grid cell size is large.

  • Display submerged interaction points: displays interaction points that are submerged in fluid.

  • Display inactive interaction points: displays interaction points that are not submerged in fluid, and are therefore not affected by the grid.

Feedback
  • Save submersion percent: controls whether the submersion level of a particle (the percentage of its interaction points that are inside of a liquid cell) will be saved to a custom float data channel.

The submersion percent value ranges from 0-1, depending on how submerged a particle is. 1 means fully submerged.

  • Channel: the custom float data channel where the submersion percent will be saved.