The filter shader in PhysX is used for collision filtering, and to customize the collection of flags describing the actions to take on a collision pair, such as whether to report the collision of rigid bodies or not. PhysX 3 also provides a default implementation of the filter shader using the PxDefaultSimulationFilterShader
class, which basically emulates the PhysX 2.8.x collision filtering. The PhysX filter shader basically customizes the collection of flags defined in the PxPairFlag
structure. We can use it to customize the callback events of the PhysX simulation that we are interested in.
The code snippet of a user-defined filter shader is as follows:
PxFilterFlags contactReportFilterShader(PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) { // all initial and persisting reports for //everything, with per-point...