Compute Geometry Penetrations#
Compute penetration depth and direction between geometries (currently supports meshes prims)
Compute Geometry Penetrations is an Immediate Node that tests if intersection exists on prims at corresponding indexes into the overlap pairs arrays.
In addition to Compute Geometry Overlaps this node will return also penetration depth and penetration vector.
For example given the following overlap pairs arrays:
overlapPairs0
= ['/Prim1'
,'/Prim2'
]overlapPairs1
= ['/Prim3'
,'/Prim4'
]
This node will test:
'/Prim1'
<–>'/Prim3'
'/Prim2'
<–>'/Prim4'
Such prims must exist in the prims bundle that passed to the primsBundle
input, otherwise an error will be thrown.
Prims can be supplied to primsBundle
connecting the output of a Read Prims node or Compute Geometry Bounds node.
The output is an array of booleans where every boolean at a given index returns true if the two prims at the same corresponding index in the overlapPairs0
and overlapPairs1
arrays do actually intersect.
So looking at the previous example if only '/Prim2'
overlaps with '/Prim4'
then the overlaps will be:
overlaps
= [false
,true
]
Penetration specific outputs could be for example:
penetrationDepths
= [0
,0.5
]penetrationVectors
= [[0, 0, 0]
,[0, 0, 1.0]
]
Installation#
To use this Node, you must enable omni.physx.graph
in the Extension Manager.
Inputs#
Name |
Type |
Description |
Default |
---|---|---|---|
execIn |
|
Input execution |
|
primsBundle |
|
The prims of interest. It must be a bundle with one or more prim children. Currently only meshes prim are supported (sourcePrimType == ‘Mesh’). Penetration vectors are not computed when both sides of a pair use triangle mesh approximation. Penetration computation only works if the (optional) ‘physics:approximation’ of one of the two overlap pair to check is not ‘triangle mesh’ (can be ‘convex mesh’). From each Mesh prim child reads: - ‘sourecePrimPath’ - ‘sourcePrimType’ - ‘points’ - ‘faceVertexIndices’ - ‘faceVertexCounts’ - ‘worldMatrix’ - ‘sourcePrimPath’ (and optionally ‘holeIndices’, ‘orientation’, ‘meshKey’ and ‘physics:approximation’) attributes |
|
overlapsPair0 |
|
Path of the first geometry from the Prims Bundle to check for penetration with corresponding item at same index in overlapsPair1 input attribute. |
|
overlapsPair1 |
|
Path of the second geometry from the Prims Bundle to check for penetration with corresponding item at same index in overlapsPair0 input attribute |
Outputs#
Name |
Type |
Description |
Default |
---|---|---|---|
execOut |
|
Output execution |
|
overlaps |
|
Array of booleans where ‘True’ value signals that a corresponding pair of meshes in overlapsPair0 and overlapsPair1 input arrays at the same index do actually overlap. |
|
penetrationVectors |
|
Array of penetration normals of the corresponding pair of meshes in overlapsPair0 and overlapsPair1 input arrays at the same index. |
|
penetrationDepths |
|
Array of penetration depths values of the corresponding pair of meshes in overlapsPair0 and overlapsPair1 input arrays at the same index. |
Note
Connecting the output of Compute Geometry Bounds node is often a better choice because that node allows precompute mesh hash and cooking data structures at the start of a graph, avoiding such computation at every invocation of this node.
Compute Geometry Bounds#
Computes bounding boxes for the input geometries (and cache cooking for future intersection tests)
Compute Geometry Bounds is an Immediate Node that takes all Prims in the input bundle and computes their Axis Aligned Bounding Boxes (or AABB).
The output bundle will contain a pass-through copy of the input bundle with new attributes added (or overwriting them if they already exists with the same name).
The new bboxMinCorner
and bboxMaxCorner
are world space corners of the bounding box for each prim.
This node will also compute the hash of mesh data and cooking data structures needed for most intersection queries, like the ones done by:
Installation#
To use this Node, you must enable omni.physx.graph
in the Extension Manager.
Inputs#
Name |
Type |
Description |
Default |
---|---|---|---|
execIn |
|
Input execution |
|
primsBundle |
|
The prims of interest. It must be a bundle with one or more prim children. Currently only meshes prim are supported (sourcePrimType == ‘Mesh’). From each Mesh prim child reads: - ‘sourecePrimPath’ - ‘sourcePrimType’ - ‘points’ - ‘faceVertexIndices’ - ‘faceVertexCounts’ - ‘worldMatrix’ and (optionally) ‘meshHash’, ‘physics:approximation’ |
Outputs#
Name |
Type |
Description |
Default |
---|---|---|---|
execOut |
|
Output execution |
|
primsBundle |
|
The same bundle passed as input with the following attributes added: - bboxMaxCorner - bboxMinCorner - meshHash |
Note
Computation is done in parallel so it’s better feeding all needed prims to a single node than creating many nodes with a single prim input if possible.
Cooking data is cached in memory and on disk to avoid expensive re-computation, by checking the mesh hash.
This approach improves performance of all other Compute and Generate Immediate nodes, if this node is executed at the very start of a longer multi-step OmniGraph computation.
Important
Immediate nodes currently only support Mesh Prims, and not Shape prims.
Demos:
Several demo scenes can be accessed through the physics demo scenes menu option (Window > Simulation > Physics / Demo Scenes
).
This will enable a Physics Demo Scenes window.
A demo using this node is labeled Objects de-penetration: