Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  High variance in ObiFixedUpdate performance impact
#3
(14-04-2020, 03:00 PM)josemendez Wrote: Performance can vary depending on what's in the scene, how close the rope is to potential colliders, even the speed of the rope particles. Obi's broad phase works using two multilevel grids: one for colliders, another for particles.

- Each step, Obi checks whether any collider has changed its bounding box. Any colliders that have changed are removed from the collider grid and reinserted in any cells it overlaps. Colliders that do not move are not updated.

- Each step, a list of particles that have moved from one cell of the grid to another one is constructed. They are removed from their old cell and inserted in the new cell. Particles that haven't moved between cells are not updated.

This way, both broad phase structures (grids) are updated incrementally, but the cost increases with the amount of moving particles/colliders. Once both structures have been updated:

- For each cell in the particle grid, a bounding box is calculated that envelopes the particles and their velocity vector. Then, this bounding box is tested against the colliders grid. Contacts are generated between the particles and All colliders in the cells overlapped by this velocity-bounding box.
So, fast moving particles generate more contacts (as they can potentially have more collisions in a single step), and are smore costly.

With this in mind, imagine a scene full of colliders around a swinging pendulum-like rope: When the pendulum swings from left to right, the velocity of the particles is higher, and more speculative contacts will be generated against the surrounding colliders. At its lowest kinetic energy point (maximum potential energy), the pendulum has very little to no velocity, and almost no contacts will be generated.

Also, timestep length has an impact on this: lower timesteps result in smaller position deltas, so less performance variance.

Do you get the same variance if you disable collision constraints completely?

So the rope is not moving at all, and I only have static colliders in the scene (using the static physics material).

In the editor Obi seems to run more stable as you can see from this image:
Timestep 0.0138 (red circle indicates when I turned of collision constraints)
[Image: build-no-colission-test.png]
There's no difference at all. 
I'm doing a build now, but IL2CPP takes time - will edit this post.

[EDIT] Build version - with no collision detection
[Image: no-colission-build.png]
Reply


Messages In This Thread
RE: High variance in ObiFixedUpdate performance impact - by TheMunk - 14-04-2020, 03:53 PM