OmniPVD - PhysX Visual Debugger¶
Omniverse PhysX Visual Debugger (OmniPVD) allows the recording of data of a physics simulation for later visual and quantitative inspection. For example, one can record a rigid body box falling onto a ground plane. One can then replay the recording and inspect the motion of the box frame-by-frame to spot simulation issues. Besides the body transforms, the recording contains further simulation data, such as the values of the linear and angular velocity of the box at each frame.
OmniPVD consist of a shared dynamic library and an extension (omni.physx.pvd). The shared dynamic library is used both by the PhysX SDK simulation engine for the recording and writing of OmniPVD binary files (OVD) and by the omni.physx.pvd Kit extension to read and parse OmniPVD (OVD) files.
The OmniPVD Kit extension (omni.physx.pvd) allows you to firstly transform a physics recording in OVD format, into USD or USDA formats (OmniPVD animated USD Stage). This allows you to time scrub and inspect an OVD file as a USD Stage, when re-opened as a Stage in Kit, which is good for debugging, inspecting and visualizing a recorded physics scene, but it stays a pure animation.
The OmniPVD extension secondly allows for the exportation of a single specific frame of an OmniPVD USD animated Stage recording into the Physics USD format. This allows to use the exported frame as an initial state when simulating the scene.
Thirdly OmniPVD allows for the reading of a physics recording in OVD format and the baking of the transforms of objects, onto Omniverse Physics objects in a separate Edit Layer. This makes for the replacement of the simulated objects with a set kinematic path, still allowing other physics simulated objects (added afterwards) to interact with them, but not affecting them.
Recording a Physics simulation into an OmniPVD OVD File¶
To record a physics scene in the OmniPVD (OVD) format, first make sure that the Physics Debug window is enabled and visible. Go into Window > Physics > Debug window and make sure it is marked with a check mark as below.
Then in the Physics Debug window in the OmniPVD section, we need to make sure to check “OmniPVD Enabled”, as it connects the underlying PhysX simulation engine to an OmniPVD serialization object. Just underneath is a checkbox called “OmniPVD Sampling” which you need to check each time before pressing play, as a precaution to make sure not to overwrite the previously recorded OVD file (see the image below). Each time the Physics simulation is stopped, the “OmniPVD Sampling” checkbox is unchecked automatically. If this checkbox is not enabled no file will be output. If both check boxes “OmniPVD Enabled” and “OmniPVD Sampling” are checked then the file name to record into, will be also mirrored into the OmniPVD extension’s input field. You can see that behavior in the section on transforming an OVD file into a USD animation.
If both check boxes are enabled, as soon as you press the “Play” button you are now recording OmniPVD files.
Loading the OmniPVD Extension¶
The OmniPVD extension is called omni.physx.pvd and can be found in the extension browser by searching for “pvd”. Just make sure to click on the slider next to “AUTOLOAD” to enable it.
Transforming an OmniPVD OVD File into a USD Animation¶
Once you have the OmniPVD OVD file ready you can transform it into USD or USDA format by chosing the input (.OVD) file, the up axis and the output format (USDA/USD). This will allow you to have the OVD file in a USD Stage that you can explore in Create, inspecting the recorded motion and data. USDA ASCII is the default output format as that is around 10 times faster to export and save.
The following video shows how to export the USD Stage, load it and inspect the data.
The USD hierarchy in the resulting Stage starts of with a scene, then lists the dynamic rigid bodies, static rigid bodies and then articulations of an OVD recording. For each body, you have an actor or articulation link with accompanying shapes and geometries. Each USD Prim has a set of custom USD attributes, which can be explored in detail and if they change over time, can be scrubbed through the animation and you can see how they change.
An example Stage with the above described hierarchy.
Digging into the Stage you can also explore the recorded scene and its many listed attributes.
Inside of a scene we can also inspect individual PhysX actors.
Transforming a Single OmniPVD USD Animation Keyframe into a Physics USD Stage¶
You can also transform a single keyframe of the resulting USD(A) file into a PhysX USD stage, which can then be simulated and can be useful for isolating a certain problematic frame in your simulation. It can then be fed back into physics and be simulated again so that you can tweak the parameters to your liking to get the desired effect. The next video shows you how to do that.
Overlaying an OmniPVD OVD File onto a USD Stage - Physics Baking¶
You can, as a third feature, overlay an OmniPVD simulation recording onto a USD Stage, thereby baking the physics simulation as an animation track, the purpose being repeatable motion with all render materials intact.
This is useful for amortizing the cost of a long and complex physics simulation to treat it as a time scrubbed animation, instead of a full-blown simulation. The PVD data animated bodies can still interact with other dynamic physics objects in the scene, as they are converted to kinematic rigid bodies. This is also illustrated in the following baking demo video, where the pile of kinematic bodies pushes a dynamic rigid body sphere.