Posts: 3
Threads: 1
Joined: Jul 2024
Reputation:
0
10-07-2024, 02:48 PM
Hi everyone,
I'm having trouble with the Obi Cloth asset in Unity. I'm trying to fit a 3D shirt model onto a 3D human model, but the shirt behaves unpredictably and appears to explode.
Details:
- Unity Version: 2022.3.3f1
- Obi Cloth Version: 6.5.4
Setup:
- A human model with MeshCollider and ObiCollider
- A shirt model with ObiCloth, ObiClothRenderer, and a correctly assigned blueprint
- ObiSolver with 8 substeps and Max Depenetration set to 10
Problems:
The shirt tears and looks like it's exploding, even when initially not colliding with the body.
Error Message when Generating Blueprint:
NullReferenceException: Object reference not set to an instance of an object
Obi.ObiActorBlueprintEditor.Refresh () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:416)
...
(But I can click on Edit and see the particles of the shirt).
I've tried adjusting physical parameters like Stretch Compliance and Bend Compliance, but without success. Does anyone have any idea how I can fix this issue?
Thanks in advance for your help!
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(10-07-2024, 02:48 PM)gunmec Wrote: Hi everyone,
I'm having trouble with the Obi Cloth asset in Unity. I'm trying to fit a 3D shirt model onto a 3D human model, but the shirt behaves unpredictably and appears to explode.
Details:
- Unity Version: 2022.3.3f1
- Obi Cloth Version: 6.5.4
Setup:
- A human model with MeshCollider and ObiCollider
- A shirt model with ObiCloth, ObiClothRenderer, and a correctly assigned blueprint
- ObiSolver with 8 substeps and Max Depenetration set to 10
Problems:
The shirt tears and looks like it's exploding, even when initially not colliding with the body.
Error Message when Generating Blueprint:
NullReferenceException: Object reference not set to an instance of an object
Obi.ObiActorBlueprintEditor.Refresh () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:416)
...
(But I can click on Edit and see the particles of the shirt).
I've tried adjusting physical parameters like Stretch Compliance and Bend Compliance, but without success. Does anyone have any idea how I can fix this issue?
Thanks in advance for your help!
Hi!
Without taking a look at your setup it’s very difficult to diagnose this. If I had to guess, I would say scaling problems in your mesh’s transform (since you mention it happens even when the cloth doesn’t collide with anything) but this is just a shot in the dark.
Would it be possible for you to share a small project that exhibits this issue by sending it to support(at)virtualmethodstudio.com, so we can take a closer look? Thanks!
Posts: 3
Threads: 1
Joined: Jul 2024
Reputation:
0
(10-07-2024, 04:01 PM)josemendez Wrote: Hi!
Without taking a look at your setup it’s very difficult to diagnose this. If I had to guess, I would say scaling problems in your mesh’s transform (since you mention it happens even when the cloth doesn’t collide with anything) but this is just a shot in the dark.
Would it be possible for you to share a small project that exhibits this issue by sending it to support(at)virtualmethodstudio.com, so we can take a closer look? Thanks! Hi!
Thank you! Thats very kind of you. I've sent an email now.
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
11-07-2024, 09:25 AM
(This post was last modified: 11-07-2024, 10:37 AM by josemendez.)
(10-07-2024, 07:48 PM)gunmec Wrote: Hi!
Thank you! Thats very kind of you. I've sent an email now.
Hi!
There's quite a few issues with your project:
-Transform scale values are all over the place: your cloth has a scale of 1.0778, and its parent transform has a scale of 0.16547. Your cloth blueprint's scale is 1 however, this is causing the cloth to "explode" right away as it expands towards its target size: 1/(0.16547*1.0788) = 5.6 times larger than its rest size.
While you could tweak the blueprint's scale to compensate for the transform's scale, the simplest solution for this is to ensure all your scale values are 1. Re-export your mesh using proper scaling, ensuring your transform scales are all 1. This will also simplify reasoning about vector spaces later down the development process.
- All constraint compliance values are set to 0.001 m/N, which is close to that of elastic rubber. You should use the default value (0) unless you're simulating very elastic fabric.
- You're using a proxy component with a skinmap that's unrelated to the mesh you're using.
- Your mesh is non-manifold, which might cause the simulation to fail as explained in the manual. It's also extremely dense, specially around the neck/sleeves and near the seam lines. If you want real-time performance, my advice would be to bring the poly count significantly down.
I guess you're trying to do a virtual try-on kind of app, where cloth is placed on a character relying purely on collision detection between the body and the cloth. I would advise against using MeshColliders (they're not very robust and extremely expensive) and use distance fields instead.
let me know if I can be of further help,
kind regards
Posts: 3
Threads: 1
Joined: Jul 2024
Reputation:
0
(11-07-2024, 09:25 AM)josemendez Wrote: Hi!
There's quite a few issues with your project:
-Transform scale values are all over the place: your cloth has a scale of 1.0778, and its parent transform has a scale of 0.16547. Your cloth blueprint's scale is 1 however, this is causing the cloth to "explode" right away as it expands towards its target size: 1/(0.16547*1.0788) = 5.6 times larger than its rest size.
While you could tweak the blueprint's scale to compensate for the transform's scale, the simplest solution for this is to ensure all your scale values are 1. Re-export your mesh using proper scaling, ensuring your transform scales are all 1. This will also simplify reasoning about vector spaces later down the development process.
- All constraint compliance values are set to 0.001 m/N, which is close to that of elastic rubber. You should use the default value (0) unless you're simulating very elastic fabric.
- You're using a proxy component with a skinmap that's unrelated to the mesh you're using.
- Your mesh is non-manifold, which might cause the simulation to fail as explained in the manual. It's also extremely dense, specially around the neck/sleeves and near the seam lines. If you want real-time performance, my advice would be to bring the poly count significantly down.
I guess you're trying to do a virtual try-on kind of app, where cloth is placed on a character relying purely on collision detection between the body and the cloth. I would advise against using MeshColliders (they're not very robust and extremely expensive) and use distance fields instead.
let me know if I can be of further help,
kind regards Hi,
It works! I have now set all scales to 1 and adjusted the constraints.
Instead of MeshCollider, I now use the distancefields that I assigned to the ObiCollider. But is it normal that I can't delete the MeshCollider? I get the message that it cannot be deleted because the ObiCollider depends on it.
I have now taken a different shirt with fewer poly counts, but the simulation is still very slow. I tried turning down the substeps, but it doesn't do much. With distancefields I played around with the “MaxError” and “MaxDepth” settings, but unfortunately it is no longer so precise. Do you have any other tips?
Thank you for your help!
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
17-07-2024, 07:50 AM
(This post was last modified: 17-07-2024, 07:51 AM by josemendez.)
(12-07-2024, 01:32 PM)gunmec Wrote: Instead of MeshCollider, I now use the distancefields that I assigned to the ObiCollider. But is it normal that I can't delete the MeshCollider? I get the message that it cannot be deleted because the ObiCollider depends on it.
Yes, the MeshCollider is still used since other objects in the scene will need it for collision detection. Distance fields only affect Obi particles, but as far as regular objects in Unity goes they don't exist so they need a regular collider to collide with. See: http://obi.virtualmethodstudio.com/manua...ields.html
Quote:Distance fields will only generate collisions against Obi particles. They will not collide with other objects, for this you need to use Unity's own colliders.
(12-07-2024, 01:32 PM)gunmec Wrote: I have now taken a different shirt with fewer poly counts, but the simulation is still very slow. I tried turning down the substeps, but it doesn't do much.
Use the profiler. It will tell you exactly what's taking up the most time so you can focus on that instead of randomly changing settings. Let me know if you need help interpreting the profiling results.
(12-07-2024, 01:32 PM)gunmec Wrote: With distancefields I played around with the “MaxError” and “MaxDepth” settings, but unfortunately it is no longer so precise. Do you have any other tips?
These settings affect the SDF's memory consumption, but have a very modest impact on performance. Use the values that yield the best approximation of your mesh that you can afford.
kind regards,
|