Obi Official Forum
Help CPU time-slice rope rendering/physics? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help CPU time-slice rope rendering/physics? (/thread-2043.html)



CPU time-slice rope rendering/physics? - TheMunk - 13-02-2020

I'm constantly trying to optimize the 500-800 particle ropes in my experience on Oculus Quest. I've tried most of the suggestions regarding unity time steps, sub steps, etc.

Reading this https://thegamedev.guru/unity-performance/cpu-slicing-secrets/, I was wondering if it would be possible to slice the simulation of my ropes in half by updating (both physics and mesh) at half the frame rate. Many of my ropes do not interact with each other so it wouldn't be a problem if they where updated on different frames. 

Is this even possible with Obi? How could i implement this? 
Can I just set up multiple solvers (one for each group of ropes) and enable/disable them for every other frame or will there be startup/cleanup tasks taking up performance?


RE: CPU time-slice rope rendering/physics? - josemendez - 13-02-2020

(13-02-2020, 10:27 AM)TheMunk Wrote: I'm constantly trying to optimize the 500-800 particle ropes in my experience on Oculus Quest. I've tried most of the suggestions regarding unity time steps, sub steps, etc.

Reading this https://thegamedev.guru/unity-performance/cpu-slicing-secrets/, I was wondering if it would be possible to slice the simulation of my ropes in half by updating (both physics and mesh) at half the frame rate. Many of my ropes do not interact with each other so it wouldn't be a problem if they where updated on different frames. 

Is this even possible with Obi? How could i implement this? 
Can I just set up multiple solvers (one for each group of ropes) and enable/disable them for every other frame or will there be startup/cleanup tasks taking up performance?

Hi there,

I think you don't understand the concept of fixed timestepping: physics are entirely decoupled from the framerate, that's the whole point of having a separate physics update cycle!. Physics are 'sliced' by design. In fact, the same article you reference mentions this:

"But this is the key I realized back at that point: rendering at 72 FPS doesn't mean you must execute everything at 72 FPS. In fact, physics already execute at a different pace."

Most engines (Obi being no exception) even include a interpolation mechanism to achieve smooth transitions between physics states, during frames where the physics engine hasn't been updated. Simply updating the state some frames (enabling/disabling the engine every other frame) and reusing the same state until the next physics update would make the simulation to look like it is happening in "stop-motion", causing stuttering.

So the answer for your question would be: increase your fixed timestep. This will cause the physics engine to update less often. As result, the simulation will be lower-quality, though.

Note: rendering can't be sliced, because even if physics weren't updated during a frame, you still need to draw something to the screen.


RE: CPU time-slice rope rendering/physics? - TheMunk - 13-02-2020

(13-02-2020, 01:27 PM)josemendez Wrote: Hi there,

I think you don't understand the concept of fixed timestepping: physics are entirely decoupled from the framerate, that's the whole point of having a separate physics update cycle!. Physics are 'sliced' by design. In fact, the same article you reference mentions this:

"But this is the key I realized back at that point: rendering at 72 FPS doesn't mean you must execute everything at 72 FPS. In fact, physics already execute at a different pace."

Most engines (Obi being no exception) even include a interpolation mechanism to achieve smooth transitions between physics states, during frames where the physics engine hasn't been updated. Simply updating the state some frames (enabling/disabling the engine every other frame) and reusing the same state until the next physics update would make the simulation to look like it is happening in "stop-motion", causing stuttering.

So the answer for your question would be: increase your fixed timestep. This will cause the physics engine to update less often. As result, the simulation will be lower-quality, though.

Note: rendering can't be sliced, because even if physics weren't updated during a frame, you still need to draw something to the screen.

Alright thanks - i surely have a lot to learn and understand regarding physics!