PhysX features GPU-accelerated position-based-dynamics (PBD) particle simulation that allows you to add fluids, granular media, and cloth to a scene. The particle objects can interact with all other simulation objects such as articulations, and rigid/deformable bodies. This video shows the Paint Ball Emitter demo where particle fluid balls are launched onto collider plane. It is available in the Window > Simulation > Demo Scenes window.
The particles schema is not finalized and may change in the future.
CPU simulation of particles is not supported, so you must have GPU simulation enabled in the Physics Scene (it is enabled by default).
For more technical background of the underlying simulation, refer to Position Based Fluids by Macklin and Müller.
A particle simulation consists of a few key components:
Particle objects to simulate, which are sets or cloths; see below for steps to create the objects.
A particle system prim that you may create with Create > Physics > Particle System.
A PBD Particle Material that you may create with Create > Physics > Physics Material, or add to an existing material using Add > Physics > PBD Material (in this menu, you may also find parameter presets for water and viscous fluid). See also the Physics Material section for general physics material information.
The particle objects are associated with a particle system, which has attributes that define simulation behavior that is common across all its objects. Additional simulation parameters are provided by the PBD Particle Material that is bound to the particle system as a physics material. The PBD material attributes are also shared between all objects associated with the particle system. Some material attributes only apply to specific object types: For example, the material drag parameter only applies to cloth objects, while cohesion only applies to fluid particles.
Multiple particle systems per stage are supported; however, particles in different systems cannot collide with each other.
In a future version of this feature, per-object materials will be supported.
Particle System Configuration¶
Many simulation parameters are attributes of the particle system or its bound PBD particle material. For information about most of these attributes, we refer to their Tool Tips. However, the various contact and rest offsets that the user should configure can be difficult to grasp from the descriptions alone, so we add further information here. First, we consider
For solid particles, the parameters can be sketched (in 2D) as follows:
First, the size of solid particles is governed by the Solid Rest Offset parameter: Two solid particles are touching when their centers are two times Solid Rest Offset apart. The same distance also defines when fluid and solid particles are touching. In particular, the Fluid Rest Offset only affects fluid particle-particle interaction as follows:
The Fluid Rest Offset cannot be considered to be the radius of a fluid particle as with solid particles. However, the radius is used together with the particle mass to determine the rest density of the fluid that the solver uses as a target density (i.e. constraint density).
The simulation generates a neighborhood for each (fluid and solid) particle, and two particles are neighbors if their distance is less than two times the Particle Contact Offset. The solver limits the number of particles that can be in a given particle’s neighborhood via the maxNeighborhood parameter (defaults to 96). In the neighborhood of a particle, constraints are evaluated by the solver, e.g. contact constraints for solid particles, or density constraints for fluid particles.
Particle-Non Particle Interaction¶
The Contact Offset and Rest Offset parameters of the particle system work analogously to the rigid- and deformable-body parameters:
When a particle (its center) is closer to a collision geometry than the sum of the particle system’s plus the collider’s Contact Offset, contacts are generated and processed by the solver. The particle and the collider are in contact when the distance of the particle center to the collider geometry surface is equal to the sum of their Rest Offsets. Note that the Solid Rest Offset only applies to particle-particle interactions, see above, and is irrelevant for contacts with non-particle-object interactions.
By default, the particle system offsets are computed from the Particle Contact Offset which defaults to 0.05 meters scaled to scene units. Therefore, you best change the resolution of a particle set by adjusting the Particle Contact Offset, as the other offsets follow. Since we cannot currently display the autocomputed values to the user in the UI, here are the formulas we use under the hood to compute the offsets:
1.0 * Particle Contact Offset
0.99 * Particle Contact Offset
Fluid Rest Offset
0.99 * 0.6 * Particle Contact Offset
Solid Rest Offset
0.99 * Particle Contact Offset
Creating Particle Sets¶
You can setup the particle positions in the Points or PointInstancer using Python code, for example running a script in the Window > Script Editor, and you may refer to the Isosurface Fluid Demo for sample code. Another option is to use the Particle Sampler to create particles from meshes, see below.
After setting up the Points or PointInstancer, select Add > Physics > Particle Set in its Property Window, and configure the set in the new particle-set rollout. In particular, setup the relationship to the particle system that the set belongs to. Most parameters defining particle behavior (i.e. dynamics) are attributes of the particle system and the PBD particle material bound to it, see Particle System Configuration.
You may create Points-based particle sets by sampling the surface and volume of a source mesh. Select the source mesh, and do Add > Physics > Particle Sampler. See the note below about a current visibility issue with the created particles.
The sampler then performs the following steps:
If there is no particle system on the current stage, creates a new particle system with default settings.
Auto-computes a suitable (sampling) Particle Distance from the Fluid Rest Offset in the particle system offset values.
Creates a Points prim that stores the sampled points, and applies a particle set component (fluid default) to the Points.
Listens to changes that may affect the sampling result and re-samples the generated points. Resampling triggers include:
setting a specific Particle Distance, or toggling Sample Inside Volume on the source-mesh Particle Sampler properties
unchecking the Fluid checkbox in the generated Points’ Particle Set properties (because the Fluid Rest Offset and Solid Rest Offset may result in different values for the auto-computed Particle Distance)
transform changes on the source mesh
You may stop the automatic resampling by either deleting the source mesh or its sampler component, or removing the relationship to the created Points in the sampler component.
Due to an issue with the rendering pipeline (to be fixed), the sampled particles are not visible until you trigger an update by toggling a render-related setting of the created Points, e.g. toggle the Cast Shadows checkbox in the Geometry/Mesh rollout of the Points.
The particle debug visualization is available in the viewport show/hide options (the eye) and allows inspecting particle sets, and the various offsets of the associated particle system in particular.
Here is a slideshow of the particle-set visualization options on the Fluid Isosurface demo available in the Demo Scenes which uses Isosurface postprocessing to visualize the fluid as a solid mesh:
The particles shown in the slideshow are set to have a radius of Fluid Rest Offset, but you may change the debug-visualization particle radius to another offset in the Physics Debug Window (Window > Simulation > Debug):
Note that Particle Rest Offset will automatically choose the correct offset (i.e. Fluid or Solid Rest Offset) based on the particle object.
Creating Particle Cloth¶
The video shows the Particle Cloth tutorial that you may find in Window > Simulation > Demo Scenes > Tutorials. Particle-cloth is simulated as solid particles placed at the mesh vertices that are connected to nearby particles by spring-damper elements. The spring-dampers can be placed by the user, or automatically by the simulation. The automatic placement results in a spring-damper setup that stretching, bending, and shearing.
In order to create a cloth, follow these steps:
Select a target mesh and do Add > Physics > Particle Cloth
The mesh will now have the two components Particle Cloth and Compute Springs for Cloth
Setup the spring-damper stiffness and damping parameters in the Compute Springs for Cloth rollout
Setup the offsets, and the Solid Rest Offset in particular to an appropriate value given the mesh. For example, in the Particle Cloth tutorial shown above, we set the Solid Rest Offset to one-half of the vertex spacing of the uniform plane mesh.
The debug visualization and the particle radii for Cloth work analogously to the particle-set visualization. In order to display the cloth wireframe, make sure to check the corresponding box in the Debug settings shown above.
The video shows the Particle Inflatable tutorial that you may find in Window > Simulation > Demo Scenes > Tutorials. Start with a target mesh that has a well-defined volume, e.g. a sphere or cube mesh, and make sure that it has sufficient resolution to capture deformation. Then, follow the steps to create a cloth, and set a nonzero pressure in the Particle Cloth rollout to get an inflatable.
A particle cloth can be attached to primitives which have either a Collider or Rigid Body component. For an introduction to attachments, see Attachments.
Particle Cloth Attachments can be created as follows:
Move both the cloth and the other primitive into an overlapping pose
Create the attachment with Create > Physics > Attachment
The attachment can be visualized using the show/hide menu in the Viewport:
The attachment debug visualization can be scaled: Viewport Settings > Gizmo Constant Scale or Gizmo Global Scale.
The debug visualization shows two elements of an attachment:
Attachment points (Pink)
Filtered points (Cyan)
For particle-cloth attachments, attachment points and filtering always correspond to vertices of the particle cloth. The filtering is needed to prevent collisions between vertices of the particle cloth and the collider, and omitting filtering might result in jittering. All attached vertices are automatically also filtered, but it can be useful to further filter some non-attached vertices in the vicinity.
Both attachment-points and filtering parameters can be adjusted in the Compute Auto Attachment rollout of the attachment properties:
Both Attach Rigid Surface and Surface Sampling Distance are not supported.
Advanced/Enable Deformable Collision Filtering Pairs is not supported.
Post-Processing for Fluid Rendering¶
There are several particle-set post-processing features that can improve the appearance of fluid particle sets. The features only affect the render output, and have no effect on the underlying simulation, i.e. particle dynamics. You can add each component through the Add > Physics menu in the property window of the particle system:
As the name implies, this step smoothens the particle positions depending on the user-set strength.
Anisotropy uses data computed by the solver to stretch the particle spheres into ellipsoids such that the fluid surface appears smoother. Note that only the PointInstancer prim supports nonuniform scaling, and, therefore, a Points prim is auto-converted to a PointInstancer if you add anisotropy to the particle system of a Points-based set.
The isosurface post-processing component extracts a render mesh from the (fluid) particles in the particle system:
In addition to configuring the isosurface extraction in the rollout added to the particle system’s properties, you may add a render material to the particle system to control the appearance of the extracted mesh.
The diffuse particle component uses simulation data and the user-set parameters to spawn diffuse particles that can be used to visualize, for example, sea spray at a wave’s crest.
Render diffuse particles as follows:
Make sure the Flow extension (omni.usdflow) is enabled
Setup a fluid particle set
Apply the Diffuse Particles component to the fluid set’s particle system
Select the particle system prim, right-click it, and create a Flow Point Emitter with Create > Flow > Point Emitter (such that the emitter is a direct child of the system in the USD hierarchy)
Add Flow render and simulation parameter prims, and configure them to achieve the desired render effect