Enabling GPU scene should be very easy, there is just need to load PhysX3Gpu_x64.dll’s & Dynamically GPULOADHOOK them… ( i did sucessfuly from thirdparty module) .
–>here is physxscene creation in PhysScene_Physx::InitPhysScene()
bool GPUPhysxSucess = false;
//There should be some global settings bool variable “AllowGPUPhysx” & then
Then there is needto create CudaContextManager & get GpuDispatcher from it and add it to SceneDesc same as CpuDispatcher
//means you have sucessfuly loaded GPULOADHOOK dlls //if not ? skip
//there we can check if cudadevice is avaliable
// Then enable ENABLE_GPU_DYNAMICS;
PSceneDesc.GpuDispatcher = CudaContextManager->GetGpuDispatcher();
PSceneDesc.flags |= PxSceneFlag::ENABLE_GPU_DYNAMICS;
GPUPhysxSucess = true
////no dlls loaded
For each rigidbody&joints also set flag to (PxConstraintFlag::eGPUCompatible, GPUPhysxSucess) ;
Add FPxSceneDescriptorModifyCallback to allow modify PxSceneDesc on scene creation;
Problem is that there is not yet alowwed to create customScene descriptor for PhysxScene on MapLoad or use customPhysxSceneCreation class;
Also important should be (#define PX_SUPPORT_GPU_PHYSX 1 ) in engine source.
Please allow us to make it easier & use UEphysx scene with GPU power with official Engine Release without need to full recompile Engine Source everytime
- Convex hulls require PxCookingParam::buildGRBData to be set to true to build data required to perform contact generation on the GPU. If a hull with more than 64 vertices or more than 32 vertices per-face is used, it will be processed on the CPU. If the PxConvexFlag::eGPU_COMPATIBLE flag is used when the convex hull is created the limits are applied to ensure the resulting hull can be used on GPU.
- Triangle meshes require PxCookingParam::buildGRBData to be set to true to build data required to process the mesh on the GPU. If this flag is not set during cooking, the GPU data for the mesh will be absent and any contact generation involving this mesh will be processed on CPU.
- Any pairs requesting contact modification will be processed on the CPU.
it has also some limitations →
- PxSceneFlag::eENABLE_PCM must be enabled for GPU contact generation to be performed. This is the only form of contact generation implemented on the GPU. If eENABLE_PCM is not raised, contact generation will be processed on CPU for all pairs using the non distance-based legacy contact generation