PxSDFDesc

Defined in include/cooking/PxSDFDesc.h

class PxSDFDesc

A structure describing signed distance fields (SDF) for triangle meshes.

SDF colliders only work when the GPU solver is used to run the simulation. The GPU solver is enabled by setting the flag PxSceneFlag::eENABLE_GPU_DYNAMICS in the scene description.

Public Functions

inline PxSDFDesc()

Constructor.

inline bool isValid() const

Returns true if the descriptor is valid.

Returns

true if the current settings are valid

Public Members

PxBoundedData sdf

Pointer to first sdf array element.

PxDim3 dims

Dimensions of sdf.

PxVec3 meshLower

The Lower bound of the original mesh.

PxReal spacing

The spacing of each sdf voxel.

PxU32 subgridSize

The number of cells in a sparse subgrid block (full block has subgridSize^3 cells and (subgridSize+1)^3 samples).

If set to zero, this indicates that only a dense background grid SDF is used without sparse blocks

PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel

Enumeration that defines the number of bits per subgrid pixel (either 32, 16 or 8bits)

PxDim3 sdfSubgrids3DTexBlockDim

Number of subgrid blocks in the 3d texture.

The full texture dimension will be sdfSubgrids3DTexBlockDim*(subgridSize+1).

PxBoundedData sdfSubgrids

The data to create the 3d texture containg the packed subgrid blocks.

Stored as PxU8 to support multiple formats (8, 16 and 32 bits per pixel)

PxBoundedData sdfStartSlots

Array with start indices into the subgrid texture for every subgrid block.

10bits for z coordinate, 10bits for y and 10bits for x. Encoding is as follows: slot = (z << 20) | (y << 10) | x

PxReal subgridsMinSdfValue

The minimum value over all subgrid blocks.

Used if normalized textures are used which is the case for 8 and 16bit formats

PxReal subgridsMaxSdfValue

The maximum value over all subgrid blocks.

Used if normalized textures are used which is the case for 8 and 16bit formats

PxBounds3 sdfBounds

The bounds of the sdf.

If left unassigned (empty), the bounds of the mesh will be used

PxReal narrowBandThicknessRelativeToSdfBoundsDiagonal

Narrow band thickness as a fraction of the bounds diagonal length.

Every subgrid block that overlaps with the narrow band around the mesh surface will be kept providing high resolution around the mesh surface. The valid range of this parameter is (0, 1). The higher the value, the more subgrids will get created, the more memory will be required.

PxU32 numThreadsForSdfConstruction

The number of threads that are launched to compute the signed distance field.

PxSimpleTriangleMesh baseMesh

Optional pointer to the geometry of the mesh that is used to compute the SDF.

If it is not set, the geometry of the mesh, that this descriptor is passed to during cooking, will be taken. The mesh data must only be available during cooking. It can be released once cooking completed.

PxSDFBuilder *sdfBuilder

Optional pointer to an instance of a SDF builder.

This significantly speeds up the construction of the SDF since the default SDF builder will do almost all computations directly on the GPU. The user must release the instance of the SDF builder once cooking completed.