Could Unity PhysX be accelerate on GPU’s?
No, Unity doesn’t support GPU acceleration for the physics unfortunately.
Here is a in-depth discussion about it that has some solid arguments as for why it is not and won’t be (possible ever) accelerated. It’s a bit dated though, but the idea remains.
Bring data back from the GPU would arrive 1 frame late, whereas physics runs at least twice before each visual frame is rendered. GPU code runs best with the const
variable type, which is not actually variable. Physics code needs to store new data in actual variable variables. And possibly depend on giant chunks of code accessible to the CPU. There is a game that does it: they have 100,000 fully 3D characters in play I forget the name of it. But you’d need to treat each character as a pixel.
Unity has already looked into this many times and has chosen not to use GPU acceleration, and it’s not for performance reasons. It’s actually possible on any GPU these days. I think it’s more of a staffing problem for this area of Unity, plus DOTS is on the way, so it’s not just a technical reason.
And I think you’d get a few frames delay from game loop which would make some people unhappy, so that would be an option and we all know how much devs love to maintain extra code path.
Why is it a a problem? I know of few options that will optimize physics. Physics matrix, excluding anything that should not matter from it. Playing with the values in Project Settings> Time, so physics calculations occur less often and just right for what you intend to do. Usage of more simple version of the mesh for physics where possible. And the best option over all is to upgrade account and use the alternative physics system Unity provides that runs at least 2 times more efficiently. If you limit the usage of Rigidbodies you’ll have better performance.
Locking this thread as it is very old. Please create a new one if you’d like to continue the conversation.