Stride Physics behaviour and performance

I’ve got a beta patch that has a bunch of boxes influenced by a force (basically the intro of @u7angel’s Node17 bullet workshop). It runs at a stable 60 FPS with 2500 boxes on an Intel Core i7- 8700 / Nvidia GTX 1070 TI.
Now I am trying to replicate that patch in gamma - starting out with the Instanced Drawing example.
Unfortunately I just can’t arrive at a similiar behaviour. But what’s more important even with a lot less boxes the framerate doesn’t reach stable 60 FPS.
Patches attached:
Cubes.7z (18.5 KB)

1 Like

tl:dr: My feeling is that Gamma/VL.Stride performs much better than beta (and has nicer shading, ofc). See patch below.

The performance of the physics engine depends highly on how many objects are close together since they do a lot of spatial optimization. You can see that in both patches at the start, when basically all objects collide with each other and the FPS is like 0.1 or so…

So unless you create exactly the same conditions, you cannot compare performance objectively.

Another factor is the size of the objects matters, it influences how the optimizations and forces work. A bit like ants have different physical challenges than bears.

So the first thing I did was scale the boxes to unit size, as they are in the beta example patch.

Then I’ve changed the ApplyForces patch a bit to work directly with the bodies, instead of searching them in the scene graph. The node GetComponent, for example, shouldn’t be used every frame in update. It should only be called once and the result cached in a field, because it basically does a search in the components. This was a lot of overhead in your patch. So I’ve changed that to direct getters.

But in the end, the main performance factor is how many objects are close to each other, so just design your apply forces logic wisely:

ApplyForceTriaI3.vl (68.4 KB)

With that, I could even run 5000 instances at about 30-40 fps on my old laptop…


Thanks for the patch and the explantions. Having played around a bit more I am unfortunately still not able to arríve at a similar result, even though the parameters are set to the same values (to the best of my knowlegde). While the beta simulation always reaches a nice state of equilibrium between repulsion and attraction, gamma sooner or later ends up with the cubes clumped together and the framerate drops.

It works if Restitution is >1.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.