Posts: 5
Threads: 1
Joined: Aug 2022
Reputation:
0
27-08-2022, 01:23 AM
(This post was last modified: 27-08-2022, 05:07 PM by RhodokSniper.)
Hi,
We are currently using Obi Cloth on our mobile project, and having obi cloth more than 10 is seems unplayable on mobile
Clothes has 20-30 vertices right now since we had to squeeze performance but performance is not just bad when particles are intersecting or touching, its also bad when they are just free falling without touching anything
I feel like I ve done possible optimizations and just wanted to make sure if this is just too expensive for mobile or am I just missing something ? Right now I am using 3 substeps and 1 iterations on constraints and made them all sequential
I also want to ask if there is any way to prevent different cloth's particles intersecting getting inside one and other, I guess you achieve this by using surface collisions but there is also problem there since I get 10 fps on editor and weird fast jittery movement on clothes when surface collision is enabled
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
29-08-2022, 09:09 AM
(This post was last modified: 29-08-2022, 09:09 AM by josemendez.)
Hi there,
300 vertices total in mobile seems like a small amount of particles, should run pretty fast even in mobile devices. Have you tried profiling the scene, to see what's taking up so much time?
Just as a sanity check: how many solvers are you using in the scene? It there a single ObiUpdater component in charge of advancing the simulation?
(27-08-2022, 01:23 AM)RhodokSniper Wrote: I also want to ask if there is any way to prevent different cloth's particles intersecting getting inside one and other, I guess you achieve this by using surface collisions but there is also problem there since I get 10 fps on editor and weird fast jittery movement on clothes when surface collision is enabled
Surface collisions won't prevent particle intersection, it will allow for denser sampling of the cloth surface (think of more particles distributed in the surface of the cloth, used for collision detection). Interpenetration can be minimized by using more agressive CCD, more collision constraint iterations, and larger particle radii.
kind regards,
Posts: 5
Threads: 1
Joined: Aug 2022
Reputation:
0
(29-08-2022, 09:09 AM)josemendez Wrote: 300 vertices total in mobile seems like a small amount of particles, should run pretty fast even in mobile devices. Have you tried profiling the scene, to see what's taking up so much time?
Obi Fixed Updater is taking the most of the time
(29-08-2022, 09:09 AM)josemendez Wrote: Just as a sanity check: how many solvers are you using in the scene? It there a single ObiUpdater component in charge of advancing the simulation?
I am using single obi updater already attached onto single obi solver and instantiating obi clothes into the solver from script
(29-08-2022, 09:09 AM)josemendez Wrote: Surface collisions won't prevent particle intersection, it will allow for denser sampling of the cloth surface (think of more particles distributed in the surface of the cloth, used for collision detection). Interpenetration can be minimized by using more agressive CCD, more collision constraint iterations, and larger particle radii.
Thank you for the clarification and the tip.
I appraciate for your help.
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
29-08-2022, 10:10 AM
(This post was last modified: 29-08-2022, 10:11 AM by josemendez.)
(29-08-2022, 09:47 AM)RhodokSniper Wrote: Obi Fixed Updater is taking the most of the time
Yes, that's to be expected since that's the simulation itself.
However physics are being updated twice per frame: 2 FixedUpdate() calls per frame, usually should be 1 at most. So 50% of your performance is going down the drain right away. This is a symptom of death spiraling, which means your fixed timestep value is too low, or your max fixed timestep too high (both found in Unity's Time settings). What values are you using?
Your profiler shows 4 ms being spent on collision detection, and 3 ms being spent on each substep. So 13 ms per physics update, and 2 physics updates per frame -> 26 ms spent on physics, plus 2 ms to update cloth meshes = 28 ms/frame which is roughly 35 fps.
4ms for collision detection is a lot. What kind of colliders are you using in your scene?
3ms substep is also a lot. What are your constraint settings? How many iterations being spent on particle collision, particle friction, distance and bend constraints?
I also see that your cloth pieces have aerodynamic, volume and tether constraints enabled, you should disable these if not using them as they incur in a slight overhead.
As a side note, I see you're using Burst, so make sure the jobs debugger is disabled as that will take up quite a lot of time in-editor.
kind regards,
Posts: 5
Threads: 1
Joined: Aug 2022
Reputation:
0
(29-08-2022, 10:10 AM)josemendez Wrote: However physics are being updated twice per frame: 2 FixedUpdate() calls per frame, usually should be 1 at most. So 50% of your performance is going down the drain right away. This is a symptom of death spiraling, which means your fixed timestep value is too low, or your max fixed timestep too high (both found in Unity's Time settings). What values are you using?
Fixed timestep is at 0.02 and max fixed timestep is 0.3, I can tweak fixed timestep a little but at some level Its gonna feel a little slow as expected, I guess your recommendation gonna be profiling and finding the best value for my project
(29-08-2022, 10:10 AM)josemendez Wrote: Your profiler shows 4 ms being spent on collision detection, and 3 ms being spent on each substep. So 13 ms per physics update, and 2 physics updates per frame -> 26 ms spent on physics, plus 2 ms to update cloth meshes = 28 ms/frame which is roughly 35 fps.
4ms for collision detection is a lot. What kind of colliders are you using in your scene?
3ms substep is also a lot. What are your constraint settings? How many iterations being spent on particle collision, particle friction, distance and bend constraints?
I am using mulltiple box colliders attached to obi colliders for my walls and ground, all constrains are set to 1 iteration and all of them are sequential, I use all constraints except Chain, Stretch & Shear, Shape matching and Skin.
(29-08-2022, 10:10 AM)josemendez Wrote: As a side note, I see you're using Burst, so make sure the jobs debugger is disabled as that will take up quite a lot of time in-editor.
Yes, I ve already disabled debugger and safety checks.
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
29-08-2022, 11:21 AM
(This post was last modified: 29-08-2022, 11:35 AM by josemendez.)
(29-08-2022, 11:02 AM)RhodokSniper Wrote: Fixed timestep is at 0.02 and max fixed timestep is 0.3, I can tweak fixed timestep a little but at some level Its gonna feel a little slow as expected, I guess your recommendation gonna be profiling and finding the best value for my project
Those values are the defaults, fine for pretty much all cases. Would recommend lowering max fix timestep to a small multiple of the fixed timestep (0.06 or 0.08) to prevent issues, but otherwise they should work fine.
(29-08-2022, 11:02 AM)RhodokSniper Wrote: I am using mulltiple box colliders attached to obi colliders for my walls and ground, all constrains are set to 1 iteration and all of them are sequential, I use all constraints except Chain, Stretch & Shear, Shape matching and Skin.
Yes, I ve already disabled debugger and safety checks.
Something doesn't quite add up then, performance should be much better that it currently is. I've tried a setup similar to yours (10 cloth items with 30 particles each, for a total of 300 particles), using the exact same settings on a Core i5 CPU (which is fairly weak by today's standards) I get around 220 fps. This is how my profiler looks like:
What's the size of your cloth, in world-space? Only culprit I can think of at this point is them being very small relative to the solver's default collision margin value (0.02 meters). This will force all particles to collide against pretty much all other particles in the scene, causing both collision detection and contact constraint resolution to do a lot of unnecessary work. If this is the case, either make your cloth objects larger or reduce the collision margin value.
Another possible culprit is that you're using surface collisions together with large particles, this will result in a lot of self-contacts and will drastically reduce performance as warned in the manual.
If neither is the case, would it be possible for you to share your project by sending it to support(at)virtualmethodstudio.com so that I can take a closer look?
kind regards,
Posts: 5
Threads: 1
Joined: Aug 2022
Reputation:
0
(29-08-2022, 11:21 AM)josemendez Wrote: Those values are the defaults, fine for pretty much all cases. Would recommend lowering max fix timestep to a small multiple of the fixed timestep (0.06 or 0.08) to prevent issues, but otherwise they should work fine.
Something doesn't quite add up then, performance should be much better that it currently is. I've tried a setup similar to yours (10 cloth items with 30 particles each, for a total of 300 particles), using the exact same settings on a Core i5 CPU (which is fairly weak by today's standards) I get around 220 fps. This is how my profiler looks like:
I ve tweaked fixed timestep values and I got the same profiler result as yours. 70 vertice 20 clothes on the scene I get 40-50 fps on Xperia XZ which is really good actually considering the phone being so bad.
(29-08-2022, 11:21 AM)josemendez Wrote: What's the size of your cloth, in world-space? Only culprit I can think of at this point is them being very small relative to the solver's default collision margin value (0.02 meters). This will force all particles to collide against pretty much all other particles in the scene, causing both collision detection and contact constraint resolution to do a lot of unnecessary work. If this is the case, either make your cloth objects larger or reduce the collision margin value.
Another possible culprit is that you're using surface collisions together with large particles, this will result in a lot of self-contacts and will drastically reduce performance as warned in the manual.
Just for the sake of answering, size was the twice the size of a primitive cube and surface collisions is disabled.
Still tho the problem I am having is interpenetration, I think there isnt much to do since I have to use low vertice meshes for performance so there will be low amount of particles but how can I change the size of the particles, I couldnt really figure that out if it is possible and also that might be too much to ask but wanted to know if I can also change the positions of the particles from the blueprint aswell, because ccd and iterations didnt really work for me and that is expected I guess since my particles look like this
I am gonna align all the vertices equally for all the meshes.
Thank you for all the help.
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(29-08-2022, 02:12 PM)RhodokSniper Wrote: Still tho the problem I am having is interpenetration, I think there isnt much to do since I have to use low vertice meshes for performance so there will be low amount of particles but how can I change the size of the particles, I couldnt really figure that out if it is possible and also that might be too much to ask but wanted to know if I can also change the positions of the particles from the blueprint aswell, because ccd and iterations didnt really work for me and that is expected I guess since my particles look like this
You can set particle sizes in the blueprint editor, either by selecting them and hand-writing a new radius value, or by painting it using a brush in paint mode. See:
http://obi.virtualmethodstudio.com/manua...setup.html
Steps:
- Enter blueprint edit mode.
- Set the particle property dropdown to "radius".
- Select all particles.
- Enter a new radius value in the radius text field.
You can't however place particles at positions other than the vertices, at least not currently. This will be possible in Obi 7 though.
Posts: 5
Threads: 1
Joined: Aug 2022
Reputation:
0
29-08-2022, 06:11 PM
(This post was last modified: 29-08-2022, 06:12 PM by RhodokSniper.)
(29-08-2022, 04:02 PM)josemendez Wrote: You can set particle sizes in the blueprint editor, either by selecting them and hand-writing a new radius value, or by painting it using a brush in paint mode. See:
http://obi.virtualmethodstudio.com/manua...setup.html
Steps:
- Enter blueprint edit mode.
- Set the particle property dropdown to "radius".
- Select all particles.
- Enter a new radius value in the radius text field.
You can't however place particles at positions other than the vertices, at least not currently. This will be possible in Obi 7 though.
Thank you for everything, I am appreciated by your great support
|