Posts: 5
Threads: 1
Joined: Jun 2017
Reputation:
0
Hi Jose,
I think this is my first time posting on this forum, but you might remember me from a while ago on Unity.
I just upgraded my Obi from 3.1 to 3.5 and I can see that a lot has changed! I was having some problems in the old version, so I thought I'd upgrade to the latest version before trying to address them. Unfortunately for me it seems like I have much worse problems now after the upgrade
I have attached some screen shots demonstrating my new problem. This is a character running around a test area with an Obi Cloth skirt. Her upper clothing is turned off so you can see the problem more easily.
The Obi Solver is attached to her pelvis bone, is set to "Simulate in Local Space" and all four Velocity / Inertia Scales are set to 0. This should mean that no influance can come from world space movement. The solver is set to "Late Update", and the character's Animator has Update Mode of Normal. (I have tried using Fixed Update and Animate Physics, but it is much worse).
The top two rows of verticies are Pinned in place (which is working), and then you can see all the vertices bellow that are offset backwards while she is moving forwards, as if they are taking the world space possitions that they should have had in the previous frame. You can see in the second shot, that her legs and body poke through the front while this is happening. Screen shot 3 shows that this effect is more pronounced when she is sprinting (moving through world space faster).
The final screen shot is just to show that the colliders in her legs work correctly when she is not moving fast, as she hangs on the ledge the cloth works nicely.
I didn't have any of these problems while using 3.1. Do you have any idea what's happened here?
Posts: 6,347
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(22-09-2018, 10:23 PM)Zomby138 Wrote: Hi Jose,
I think this is my first time posting on this forum, but you might remember me from a while ago on Unity.
I just upgraded my Obi from 3.1 to 3.5 and I can see that a lot has changed! I was having some problems in the old version, so I thought I'd upgrade to the latest version before trying to address them. Unfortunately for me it seems like I have much worse problems now after the upgrade
I have attached some screen shots demonstrating my new problem. This is a character running around a test area with an Obi Cloth skirt. Her upper clothing is turned off so you can see the problem more easily.
The Obi Solver is attached to her pelvis bone, is set to "Simulate in Local Space" and all four Velocity / Inertia Scales are set to 0. This should mean that no influance can come from world space movement. The solver is set to "Late Update", and the character's Animator has Update Mode of Normal. (I have tried using Fixed Update and Animate Physics, but it is much worse).
The top two rows of verticies are Pinned in place (which is working), and then you can see all the vertices bellow that are offset backwards while she is moving forwards, as if they are taking the world space possitions that they should have had in the previous frame. You can see in the second shot, that her legs and body poke through the front while this is happening. Screen shot 3 shows that this effect is more pronounced when she is sprinting (moving through world space faster).
The final screen shot is just to show that the colliders in her legs work correctly when she is not moving fast, as she hangs on the ledge the cloth works nicely.
I didn't have any of these problems while using 3.1. Do you have any idea what's happened here?
Hi Zomby,
Cannot reproduce it here, but try the following:
In ObiSolver.cs, LateUpdate() method, add:
right after the "AccumulateSimulationTime(lateUpdateDelta);" line.
This is to make sure collider state is up to date right before solving cloth. Let me know how it goes.
Posts: 5
Threads: 1
Joined: Jun 2017
Reputation:
0
That seems to fix it! Interesting.
I'm a little worried about performance. In 3.1 the LateUpdate was taking about 13 milliseconds, with 678 particles being simulated. In 3.5 that is down to about 10 milliseconds, which is still an aweful lot, by far the most time consuming thing in my game.
Is that slower than you would expect? I may have something set up badly.
Posts: 6,347
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
23-09-2018, 07:40 PM
(This post was last modified: 23-09-2018, 07:41 PM by josemendez.)
(23-09-2018, 06:36 PM)Zomby138 Wrote: That seems to fix it! Interesting.
I'm a little worried about performance. In 3.1 the LateUpdate was taking about 13 milliseconds, with 678 particles being simulated. In 3.5 that is down to about 10 milliseconds, which is still an aweful lot, by far the most time consuming thing in my game.
Is that slower than you would expect? I may have something set up badly.
Hi,
Yes, 10 ms is a lot. I get 6 ms using 2500 particles, with triangle skinning. What are your solver settings? (amount of substeps, enabled constraint types, amount of iterations for each one, etc).
Also, I assume you're profiling inside the editor. First thing I'd try is profiling a standalone, getting rid of editor overhead usually improves performance a lot as more CPU room is left for Obi.
Posts: 5
Threads: 1
Joined: Jun 2017
Reputation:
0
I should have said, I've tested the performance in standalone and it is exactely the same.
As I understand it, all "Substeps" does is change the fixed timestep in unity? So it shouldn't have any effect when using "Late Update" Simulation Order. (it's set to 1)
I have these constraint with #iterations
Distance
24
Bending
12
Particle Collision
6
Collision
24
Skin
6
Tether
6
Pin
3
I also have 13 sphere / capsules with the "Obi collider" script on them.
My processor is i7 6700 4GHz, and my graphics card is a GTX 1080.
Posts: 6,347
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(23-09-2018, 08:45 PM)Zomby138 Wrote: I should have said, I've tested the performance in standalone and it is exactely the same.
As I understand it, all "Substeps" does is change the fixed timestep in unity? So it shouldn't have any effect when using "Late Update" Simulation Order. (it's set to 1)
I have these constraint with #iterations
Distance
24
Bending
12
Particle Collision
6
Collision
24
Skin
6
Tether
6
Pin
3
I also have 13 sphere / capsules with the "Obi collider" script on them.
My processor is i7 6700 4GHz, and my graphics card is a GTX 1080.
Wow, that's a lot of iterations. I rarely go over 2-3 collision iterations, almost never over 5 distance iterations, and use a single iteration of tether constraints if overstitching is an issue. Disable those constraints you're not using (probably pin and particle collision, which are pretty expensive).
Substepping does not affect the fixed timestep at all, it works basically the same as it does in most engines. It increases the amount of internal integration steps taken, kinda like subdividing each Unity fixed timestep into smaller steps. This can improve accuracy a lot and can reduce the need for iterations greatly. Try using a couple substeps, and very few iterations (max 3-4 per constraint type)
Posts: 5
Threads: 1
Joined: Jun 2017
Reputation:
0
23-09-2018, 09:45 PM
(This post was last modified: 23-09-2018, 09:50 PM by Zomby138.)
Will substeps work with character animation? Surely the character is only updated once per frame? (because they are not driven by the physics Fixed Update)
Edit:
Hold on what is the pin constraint? I thought it was what kept the top two rows of vertices pinned to their skinned positions. I just turned it off (expecting the skirt to just fall off) and it didn't make much difference. What's it do?
Posts: 6,347
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
23-09-2018, 10:28 PM
(This post was last modified: 23-09-2018, 10:29 PM by josemendez.)
(23-09-2018, 09:45 PM)Zomby138 Wrote: Will substeps work with character animation? Surely the character is only updated once per frame? (because they are not driven by the physics Fixed Update)
Edit:
Hold on what is the pin constraint? I thought it was what kept the top two rows of vertices pinned to their skinned positions. I just turned it off (expecting the skirt to just fall off) and it didn't make much difference. What's it do?
Yes, substeps will work with characters. Even though only one step is performed per frame, that step will be composed of multiple substeps, improving convergence speed and simulation quality.
Pin constraints are meant to attach particles to rigidbodies enabling two-way coupling. Essentially useless for character clothing, see:
http://obi.virtualmethodstudio.com/tutor...aints.html
The top row of vertices are fixed, rather than pinned.
http://obi.virtualmethodstudio.com/tutor...ments.html
Posts: 5
Threads: 1
Joined: Jun 2017
Reputation:
0
I tried using some substeps but it just made the cloth glitch around unpredicably for some reason.
I have to say that now it's working properly, 4.5 seems much more reliable than 4.1.
I used to feel like I needed that many iterations to get a reasonable result, but now it seems to work much better overall. I'm mostely talking about the collider constraint I guess. I used to get a lot more problems with cloth going through legs while the legs were moving fast.
|