Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Poor Performance In VR
#1
Greetings,


We are using ObiFluids to generate vomit inside a human's mouth. The liquid is then "sucked" using a tool that makes the particles disappear.
The fluid is generated once with a long lifespan and then the particles are killed using collision with 3 sphere primitives. The liquid is held in the mouth using cube primitives to create a mouth-like facet. Unity is set to run 1 physics step per frame. The fluid, mouth colliders and suction tool are all in a separate layer and are set not to collide with anything but themselves. 


profiler:
[Image: ak0_dSs_8RlN2pQZLcyWjFMr9f3w2jHFjhFiMP5y...P6W3dU8ps2]
Obi profiler(although forgive me for not really understanding what do I see here):


[Image: fuQ_xgkWqORwrnBf23zIaiLmxOihXoUz-CWud250...kiecs0htjt]
Solver:
[Image: IJOi14MChtysQxRQgEOvgIkeyMfMORj7CVCsBbFZ...00w7P-g0Eh]


Emitter:
[Image: UYCLO-3ZcdQUgIy8DeJOhRtpwU4PwNx5Xl5wh1Wh...p-jKfhPFpd]


Blueprint:
[Image: V58jZzD00Ir0UAsnaH5C7mBoMQSPX-SbrOds5sLr...N4ozIRBT0D]


Render(there are two identical ones):
[Image: d2QzqFyCVhCcSaz9QzOWKedoBA1A9BnFvaUdbqo9..._QbFcdkQ_U]

Time settings:

I'm kind of clueless of where to look for why is this happening because even before I do anything with the liquid (besides emitting it) the performance is like mentioned above.

Hardware:
Intel Core i7 8700
Nvidia GTX 1080
32GB Ram
Win 10 x64
Reply
#2
Both profiler pics clearly show 5 (!) physics steps per frame.

In Unity, you can tell because next to the FixedUpdate.ScriptRunBehaviourFixedUpdateCall, in the "Calls" column, it says '5'.

The Oni profiler shows 5 separate physics updates per frame. (5 columns of spaced apart stuff).

This is typical a case of death spiraling. Reduce your max fixed timestep setting, or optimize the simulation (by reducing the amount of iterations, using a larger timestep, using a smaller neighborhood radius...) until the spiral is no longer triggered.

If this happens without fluid present in the scene, it means your game is just too heavy for the device it is running on. Frames take too long to render, and this forces the physics engine(s) to run several times per frame in order to catch up with rendering, which further worsens performance.
Reply
#3
(11-11-2020, 08:49 AM)josemendez Wrote: Both profiler pics clearly show 5 (!) physics steps per frame.

In Unity, you can tell because next to the FixedUpdate.ScriptRunBehaviourFixedUpdateCall, in the "Calls" column, it says '5'.

The Oni profiler shows 5 separate physics updates per frame. (5 columns of spaced apart stuff).

This is typical a case of death spiraling. Reduce your max fixed timestep setting, or optimize the simulation (by reducing the amount of iterations, using a larger timestep, using a smaller neighborhood radius...) until the spiral is no longer triggered.

If this happens without fluid present in the scene, it means your game is just too heavy for the device it is running on. Frames take too long to render, and this forces the physics engine(s) to run several times per frame in order to catch up with rendering, which further worsens performance.

I just noticed the time settings photo wasn't uploaded. The VR headset runs on 90 fps thus fixed timestep is 0.011;
[Image: Screenshot-2020-11-11-114552.jpg]

I've tried playing with these settings, however, nothing seemed to make things better. Obi is also set to 1 physics step per frame with no substeps. 
I'm not entirely sure what do you mean by "using a smaller neighborhood radius", could you elaborate?
Reply
#4
(11-11-2020, 10:45 AM)SyDRoX Wrote: I just noticed the time settings photo wasn't uploaded. The VR headset runs on 90 fps thus fixed timestep is 0.011;
[Image: Screenshot-2020-11-11-114552.jpg]

I've tried playing with these settings, however, nothing seemed to make things better. Obi is also set to 1 physics step per frame with no substeps. 
I'm not entirely sure what do you mean by "using a smaller neighborhood radius", could you elaborate?

I think there's a big misunderstanding here: in a fixed-timestep scheme like Unity's, you have no direct control over how many physics steps per frame are taken.

This is entirely decided by the engine, based on 3 factors:

- How much "wall-clock" time the last frame took to render.
- How much "game time" is simulated by a single timestep.
- How much "game time" we're allowed to simulate in a single frame.

Physics steps have a fixed duration in seconds (the "fixed timestep" value in your Time settings). If a frame takes a long time to render for whatever reason (including physics calculation itself), to keep up with rendering it might not be enough to simulate physics just once during the next frame. Two, three or more physics steps might be necessary in a single frame.

Updating physics isn't free though, so taking more than 1 step might make the current frame to take even longer to render than the previous one, worsening the situation. This causes a downwards performance loop that will only stop once you reach Unity's max allowed timestep setting. However the game might not be able to recover from it at this point. So you can't conclude that having a refresh rate of 90 fps and a step duration of 0.01 (which is quite small), only one step will be taken. This situation is known as death spiraling (aka well of despair, timestep crunch, and many others).

The hallmark of death spiraling is FixedUpdate() appearing more than once per frame in the profiler. In your case, max fixed timestep is set to 0.055, and fixed timestep to 0.011, so under performance stress your game is taking: 0.055 / 0.011 = 5 steps per frame. The profiler isn't lying Guiño.

Long story short: use a longer timestep or reduce your max timestep.
Reply