How to get the maximum performance from DOTS Physics?

Hello everyone,

the last couple of weeks I had the enjoy of diving deep into the Unity ECS World. Recently I installed the lastest 1.0.0-exp-8 of Unity Physics, Entities, Entities Graphics, Unity Jobs 0.70.0-preview.7 and Burst Compiler 1.7.3

My first tries resulted into 10.000 physic objects that are spawned at the same time. At first I was amazed to see 10k physic objects spawing, however I got addicted and want to push the limits more.

I realized that the FPS drop for 10.000 is ok but it drops significantly when I reach the count of 20.000 physic object at the same spot. I guess under the hood, all the calculated contact points between the physic objects make the calculation very intensive.

I was wondering, whether there is a way to create a kind of “light weight” physic object or as an alternative, is it possible to parallize the physic calculation manually with the Unity Job System?

Unity physics fails, when it comes to too many physics collisions in same spot.

If collisions are spread in the scene, all is fine. But if you try to make something like pile of rocks, one on other, you may hit bottle neck very fast.

Many thanks for the reply.

I think I have chosen the wrong path then. I could well imagine that it might work better with Compute Shaders. I will try it out.

Currently, I don’t think you could easily “lightweight” physics objects, but in the future, and if you can use Havok physic (might be only if you are pro or Enterprise, as it is currently planned), there will be a Havok lightweight rigidbody, that can run significantly faster and thus with more rigidbody count, although sacrificing a bit of physic quality (8x cpu performance, see the presentation video). See the Havok roadmap (Roadmap | Havok Physics for Unity | 0.51.1-preview.21 (unity3d.com)) :

More options for trading rigid body quality vs performance. In particular we expect to add a super fast, low quality, type of rigid body designed for secondary effects with large numbers of dynamic objects – such as particle or debris systems that need to interact with the physics world.

The video of presentation of the lightweight rigidbody by Steve Ewart (steveeHavok) (presentation at 35:03) : Overview of Havok Physics in Unity - Unite Copenhagen - YouTube

2 Likes

Hey @Tigrian many thanks for the valuable sources!
I think I still have to wait until the new DOTS 1.0.0-exp8 will be compatible with Havok Physics.
Havok Physics seems promising!

1 Like