Posts: 11
Threads: 3
Joined: Oct 2019
Reputation:
0
20-10-2019, 09:06 PM
(This post was last modified: 03-02-2020, 08:34 PM by IlyaZzz.)
Hello.
For my project, I need to simulate coins in a bag.
And when I throw coins there, the following happens:
[attachment=440]
This is inside:
[attachment=441]
The mass of the coin is equal to the mass of the particle in the bag (0.01)
These are my solver and cloth settings:
[attachment=442][attachment=443]
So, how to get rid of stretching the package?
How to make a fixed distance between particles?
Upd
And I have one more question.
How to optimize coin collision?
When I have 50 of them on scene, I have big problems with my performance...
This is the coin settings:
[attachment=445]
Posts: 11
Threads: 3
Joined: Oct 2019
Reputation:
0
(20-10-2019, 09:06 PM)IlyaZzz Wrote: Hello.
For my project, I need to simulate coins in a bag.
And when I throw coins there, the following happens:
This is inside:
The mass of the coin is equal to the mass of the particle in the bag (0.01)
These are my solver and cloth settings:
So, how to get rid of stretching the package?
How to make a fixed distance between particles?
Upd
And I have one more question.
How to optimize coin collision?
When I have 50 of them on scene, I have big problems with my performance...
This is the coin settings:
So, does anybody know how to fix it?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
27-10-2019, 04:47 PM
(This post was last modified: 27-10-2019, 04:49 PM by josemendez.)
(25-10-2019, 10:31 PM)IlyaZzz Wrote: So, does anybody know how to fix it?
Hi there,
This is caused by slow convergence. That is, the solver has not enough time budget each frame to finish solving the system perfectly, so the remaining error shows up as spurious elasticity. This is common to all physics engines, not just Obi.
So solutions are the same as in any engine:
- Increase the amount of constraint iterations (distance constraints in this case, you can find this setting in the ObiSolver component)
- Increase the amount of solver substeps (also in ObiSolver)
- Reduce Unity's fixed timestep (found in project settings->time).
- Reduce the amount of constraints (that is, use a lower-resolution mesh for the bag). This will reduce the solver's workload.
See:
http://obi.virtualmethodstudio.com/tutor...gence.html
http://obi.virtualmethodstudio.com/tutor...olver.html
To optimize coin colliders, try using a single distance field for each one instead of 4 colliders:
http://obi.virtualmethodstudio.com/tutor...ields.html
Posts: 11
Threads: 3
Joined: Oct 2019
Reputation:
0
28-10-2019, 09:27 PM
(This post was last modified: 28-10-2019, 09:33 PM by IlyaZzz.)
(27-10-2019, 04:47 PM)josemendez Wrote: Hi there,
This is caused by slow convergence. That is, the solver has not enough time budget each frame to finish solving the system perfectly, so the remaining error shows up as spurious elasticity. This is common to all physics engines, not just Obi.
So solutions are the same as in any engine:
- Increase the amount of constraint iterations (distance constraints in this case, you can find this setting in the ObiSolver component)
- Increase the amount of solver substeps (also in ObiSolver)
- Reduce Unity's fixed timestep (found in project settings->time).
- Reduce the amount of constraints (that is, use a lower-resolution mesh for the bag). This will reduce the solver's workload.
See:
http://obi.virtualmethodstudio.com/tutor...gence.html
http://obi.virtualmethodstudio.com/tutor...olver.html
To optimize coin colliders, try using a single distance field for each one instead of 4 colliders:
http://obi.virtualmethodstudio.com/tutor...ields.html
Thank You! I reduced Unity's fixed timestep to 0.009 and it helped.
I made few tests and I got that particle collision takes 90% of my resources. But I already had particle collision constraint iterations to 1 and solver substeps to 2.
Do you have any ideas how to fix it?
I can't turn off particle collision...
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
29-10-2019, 10:33 AM
(This post was last modified: 29-10-2019, 10:36 AM by josemendez.)
(28-10-2019, 09:27 PM)IlyaZzz Wrote: Thank You! I reduced Unity's fixed timestep to 0.009 and it helped.
I made few tests and I got that particle collision takes 90% of my resources. But I already had particle collision constraint iterations to 1 and solver substeps to 2.
Do you have any ideas how to fix it?
I can't turn off particle collision...
In Obi 4.x, each substep also performs collision detection (generating contacts, that are later solved by the solver). So having 2 substeps and 0.009 ms timestep, means you might be calculating contacts maxFixedTimestep/timestep*substeps times per frame. Assuming your maxFixedTimestep is Unity's default (0.1) this can mean collision detection is performed 22 (!!!) times per frame.
Try lowering your max fixed Timestep a bit, something like 0.02.
FYI, In Obi 5.x, we have implemented this paper:
http://matthias-mueller-fischer.ch/publi...lsteps.pdf
Which means collision detection is calculated only once per step, and amortized over all substeps. This improves convergence speed without paying any additional cost for collision detection. In this case, you could just increase the amount of substeps to 6-8, leave the timestep untouched and call it a day.
Posts: 11
Threads: 3
Joined: Oct 2019
Reputation:
0
29-10-2019, 01:19 PM
(This post was last modified: 29-10-2019, 01:26 PM by IlyaZzz.)
(29-10-2019, 10:33 AM)josemendez Wrote: In Obi 4.x, each substep also performs collision detection (generating contacts, that are later solved by the solver). So having 2 substeps and 0.009 ms timestep, means you might be calculating contacts maxFixedTimestep/timestep*substeps times per frame. Assuming your maxFixedTimestep is Unity's default (0.1) this can mean collision detection is performed 22 (!!!) times per frame.
Try lowering your max fixed Timestep a bit, something like 0.02.
FYI, In Obi 5.x, we have implemented this paper:
http://matthias-mueller-fischer.ch/publi...lsteps.pdf
Which means collision detection is calculated only once per step, and amortized over all substeps. This improves convergence speed without paying any additional cost for collision detection. In this case, you could just increase the amount of substeps to 6-8, leave the timestep untouched and call it a day. Thank you for your reply! I'll try it later.
When are you going to release obi 5?
|