Obi Official Forum
Help Performance Spikes in Fixed Update and MeshSkinning - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Help Performance Spikes in Fixed Update and MeshSkinning (/thread-1484.html)



Performance Spikes in Fixed Update and MeshSkinning - jp715 - 19-11-2019

Hi! Really enjoying using Obi Cloth so far, and I'm hoping to learn more about optimizing it to use in our game. It's a VR game, but right now I'm working on a scene where a character's clothes moves in response to wind. Right now, all I have in the scene is the character's shirt. I'm using a cloth proxy, where the source cloth uses a mesh of about 400 vertices and 200 clothing particles, and the target is a mesh of about 2300 vertices. The solver is only using distance, skin and aerodynamic constraints, with 1 iteration each for distance and skin constraints. Wind is being simulated with a spherical force zone that rotates around the player, with intensity and turbulence of 25.

On average, performance is pretty good, but there are a lot of irregular spikes when I profile it. On average obi will run about 1-2 ms per frame (if I add up ObiSolver.FixedUpdate(), ObiExternalForce.FixedUpdate() and ObiSolver.LateUpdate() ), but it'll randomly spike to anywhere between 5 and 20 ms.

I've seen other posts that recommend lowering the max timestep but that doesn't seem to help. I've lowered it down to 0.011 with a fixed timestep of 0.011 (set by SteamVR), and there are still spikes. Also things start to slow down and look weird, and other parts of the game depend on physics so I don't want to mess with global time settings too much.

Screenshot of a spike with maximum allowed timestep set to 0.011:
[attachment=471]

Another spike, while maximum allowed timestep is 0.02:
[attachment=476][attachment=475]

Similar spikes occur when I have the solver in after fixed update and late update mode.

After Fixed Update:
[attachment=474]

Late Update:
[attachment=472]

In addition, there seems to be quite a performance draw in general from MeshSkinning.Update(). When I disable the skinned mesh renderer, there is an almost identical performance cost from VSync, if that is relevant. If you have any suggestions for how to improve this or the spikes, that would be great!