Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
21-10-2024, 03:25 AM
(This post was last modified: 21-10-2024, 07:52 AM by gahyun11.)
(17-10-2024, 10:55 AM)josemendez Wrote: As I just answered in the above post, it is not possible to do what you want. Obi is explicitly designed to disallow this use case. Unity generally also disallows this, except for a handful of asset types.
kind regards, Hello. Sorry for writing same question twice. I thought I didnt post a reply cause I didnt refresh webpage(My bad). Anyway, I followed your advice and it works surprisingly well! Thanks a lot! Now Im trying to give properities value on these groups with each different value in script. For example, skin radius,mass and etc. For this I keep searching obi cloth blueprint, skinnedclothblueprint, obi actor and couldnt find a way to set properties value except tether scale and tethercompliance.
At the same time, some of our t shirts clothings have narrow waist periphery size, so its particle keeps going through into any bottoms clothings. What Im thinking to solve this issue is to enlarge clothing scale ( not using stretch compliance or stretching scaling, just purely scale) then shrink the clothing back to original size in runtime. I tried to set scale bigger before runtime then set it back to orignal size in runtime but it didnt work as I thought - just like typical resizing in unity. The clothing didnt go back to original size at all. Is there any way to resize clothing during the runtime?
* I just found coat.skinConstraintsData.batches[i].constraintCount and I got batch information(I dont know if this is a right term or not) with referring to this website( Set Cloth Properties with script (virtualmethodstudio.com) ) And now I know how to get and set skin radius property value but I dont know how to get and set mass property value yet
**This is a screen shot of the issue of the t shirts clothing. As you can see, the particles of each clothings - t shirts and skirts - are going through each other. I used stretchscaling and stretchCompliance on both of clothings, and the skirt is enabled first then after few seconds, t shirts is enabled.
Posts: 6,300
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
21-10-2024, 07:53 AM
(This post was last modified: 21-10-2024, 07:55 AM by josemendez.)
(21-10-2024, 03:25 AM)gahyun11 Wrote: Now Im trying to give properities value on these groups with each different value in script.
Just like with particle groups, you should first determine whether you want to do this at runtime or store that information in the blueprint at edit time. It's two completely different concepts, and it's done in different ways. For the remainder of this answer, I'll assume you want to do this at runtime.
(21-10-2024, 03:25 AM)gahyun11 Wrote: For example, skin radius,mass and etc. For this I keep searching obi cloth blueprint, skinnedclothblueprint, obi actor and couldnt find a way to set properties value except tether scale and tethercompliance.
You're conflating particle properties and constraint properties. For instance, mass is a particle property, skin radius is a constraint property. These work in different ways, and are set in different ways.
The manual contains in-depth explanations of how to get/set both:
Particle properties: http://obi.virtualmethodstudio.com/manua...icles.html
Constraint properties: http://obi.virtualmethodstudio.com/manua...aints.html
(21-10-2024, 03:25 AM)gahyun11 Wrote: At the same time, some of our t shirts clothings have narrow waist periphery size, so its particle keeps going through into any bottoms clothings. What Im thinking to solve this issue is to enlarge clothing scale ( not using stretch compliance or stretching scaling, just purely scale) then shrink the clothing back to original size in runtime. I tried to set scale bigger before runtime then set it back to orignal size in runtime but it didnt work as I thought - just like typical resizing in unity. The clothing didnt go back to original size at all. Is there any way to resize clothing during the runtime?
Scaling only works for rigid objects, for an obvious reason: it's an affine transform.
In other words: in order to scale an object, you need to have an reference point (often, the pivot/local origin of an object). If all points in the object are always in the same position relative to the origin, scaling makes sense. As soon as points in the object can move independently of the origin and each other - like they do in any deformable object- scaling ceases to have a well-defined meaning. Same applies for all affine transformations like rotation and translation.
After all if you take a piece of cloth and stretch it: has it been stretched or scaled? if you fold it, has it been folded or rotated? if you'd say rotated, around which point?
(21-10-2024, 03:25 AM)gahyun11 Wrote: * I just found coat.skinConstraintsData.batches.constraintCount and I got batch information(I dont know if this is a right term or not) with referring to this website( Set Cloth Properties with script (virtualmethodstudio.com) ) And now I know how to get skin radius property value but I dont know how to get mass property value yet
Mass is not a property of a constraint, it's a property of the [i]particles. See:http://obi.virtualmethodstudio.com/manual/7.0/scriptingparticles.html[/i]
Posts: 6,300
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
(21-10-2024, 03:25 AM)gahyun11 Wrote: **This is a screen shot of the issue of the t shirts clothing. As you can see, the particles of each clothings - t shirts and skirts - are going through each other. I used stretchscaling and stretchCompliance on both of clothings, and the skirt is enabled first then after few seconds, t shirts is enabled.
Use one-sided collisions on both the skirt and the cloth, they rely on self-collisions so that the t-shirt is always over the skirt.
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
21-10-2024, 09:53 AM
(This post was last modified: 21-10-2024, 10:53 AM by gahyun11.)
(21-10-2024, 07:56 AM)josemendez Wrote: Use one-sided collisions on both the skirt and the cloth, they rely on self-collisions so that the t-shirt is always over the skirt. I'm sorry but where can I find that? I keep looking skinned cloth blueprint of both clothings and its obiskinnedcloth component but cant find any "one-sided" colliision. I see "Self collisions" on Obi skinned Cloth component but this is not what you are talking about, isnt it? I'm currently using obi 6.5.4 cause we need time to convert all clothings' skinnedclothblueprint from 6.5.4 to version 7.
(21-10-2024, 07:53 AM)josemendez Wrote: Just like with particle groups, you should first determine whether you want to do this at runtime or store that information in the blueprint at edit time. It's two completely different concepts, and it's done in different ways. For the remainder of this answer, I'll assume you want to do this at runtime.
You're conflating particle properties and constraint properties. For instance, mass is a particle property, skin radius is a constraint property. These work in different ways, and are set in different ways.
The manual contains in-depth explanations of how to get/set both:
Particle properties: http://obi.virtualmethodstudio.com/manua...icles.html
Constraint properties: http://obi.virtualmethodstudio.com/manua...aints.html We aren't trying to do this work in runtime anymore. We wanna edit clothing assets' blueprints now through script.
I read both of documents already and found out invMasses property in obi blueprint has inverse value of mass of each particle but I wasn't sure. I know I can use this but just wonder if I have to calculate inverse value of the invMasses to figure out original mass value every time?
And I also wonder how can i find index of particles in specific particle group, not index of the particle group, index of the particleIndice, so I can edit property value in script
Quote:Scaling only works for rigid objects, for an obvious reason: it's an affine transform.
In other words: in order to scale an object, you need to have an reference point (often, the pivot/local origin of an object). If all points in the object are always in the same position relative to the origin, scaling makes sense. As soon as points in the object can move independently of the origin and each other - like they do in any deformable object- scaling ceases to have a well-defined meaning. Same applies for all affine transformations like rotation and translation.
After all if you take a piece of cloth and stretch it: has it been stretched or scaled? if you fold it, has it been folded or rotated? if you'd say rotated, around which point?
Mass is not a property of a constraint, it's a property of the [i]particles. See:http://obi.virtualmethodstudio.com/manual/7.0/scriptingparticles.html[/i]
Hmmm. I just wanna scale only x and z, but using same pivot as a reference point while the clothing is simulating
Posts: 6,300
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
21-10-2024, 11:06 AM
(This post was last modified: 21-10-2024, 12:03 PM by josemendez.)
(21-10-2024, 09:53 AM)gahyun11 Wrote: I'm sorry but where can I find that? I keep looking skinned cloth blueprint of both clothings and its obiskinnedcloth component but cant find any "one-sided" colliision. I see "Self collisions" on Obi skinned Cloth component but this is not what you are talking about, isnt it? I'm currently using obi 6.5.4 cause we need time to convert all clothings' skinnedclothblueprint from 6.5.4 to version 7.
Code: cloth.oneSided = true;
This allows particles to only collide with the side their normal vector is pointing towards. So if another particle tries to collide with its backside, it will be projected to the front.
See the "OneSidedCollisions" sample scene.
(21-10-2024, 09:53 AM)gahyun11 Wrote: We aren't trying to do this work in runtime anymore. We wanna edit clothing assets' blueprints now through script.
In that case, you need to access the blueprint's constraint data. (blueprint.distanceConstraintsData, skinConstraintsData, and so on). These contain constraint batches, that are accessed an modified just like they are at runtime. The only difference is that these are stored in the blueprint, instead of the solver.
(21-10-2024, 09:53 AM)gahyun11 Wrote: I read both of documents already and found out invMasses property in obi blueprint has inverse value of mass of each particle but I wasn't sure. I know I can use this but just wonder if I have to calculate inverse value of the invMasses to figure out original mass value every time?
Yes, invMass is just 1/mass. You can convert between them anytime you need. Be careful with division by zero.
The reason Obi uses inverse mass internally is to avoid having to perform a division thousands of times every single frame during simulation, so using inverse mass is considerably more efficient.
(21-10-2024, 09:53 AM)gahyun11 Wrote: And I also wonder how can i find index of particles in specific particle group, not index of the particle group, index of the particleIndice, so I can edit property value in script
Code: group.particleIndices
Please check the API docs.
(21-10-2024, 09:53 AM)gahyun11 Wrote: Hmmm. I just wanna scale only x and z, but using same pivot as a reference point while the clothing is simulating
That's not possible using the transform component as I just explained. All existing cloth systems (including Unity's built-in cloth) have the same limitation, as it is simply a consequence of how matrix algebra works. Try scaling Unity's cloth at runtime and see.
The only way to do what you want is to modify is to calculate your own pivot point (could be the cloth's center of mass, a fixed point, whatever you agree on) and perform the transform yourself on particle positions directly, after simulation has been carried out.
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
(21-10-2024, 11:06 AM)josemendez Wrote: Code: cloth.oneSided = true;
This allows particles to only collide with the side their normal vector is pointing towards. So if another particle tries to collide with its backside, it will be projected to the front.
See the "OneSidedCollisions" sample scene.
In that case, you need to access the blueprint's constraint data. (blueprint.distanceConstraintsData, skinConstraintsData, and so on). These contain constraint batches, that are accessed an modified just like they are at runtime. The only difference is that these are stored in the blueprint, instead of the solver.
Yes, invMass is just 1/mass. You can convert between them anytime you need. Be careful with division by zero.
The reason Obi uses inverse mass internally is to avoid having to perform a division thousands of times every single frame during simulation, so using inverse mass is considerably more efficient.
Code: group.particleIndices
Please check the API docs.
That's not possible using the transform component as I just explained. All existing cloth systems (including Unity's built-in cloth) have the same limitation, as it is simply a consequence of how matrix algebra works. Try scaling Unity's cloth at runtime and see.
The only way to do what you want is to modify is to calculate your own pivot point (could be the cloth's center of mass, a fixed point, whatever you agree on) and perform the transform yourself on particle positions directly, after simulation has been carried out. Hello. Thank you for your explanation. Now I can get each groups' particles' actual indices easly. Now, I just created blueprint in obi 6 folliwing your trench coat blueprint of obi 7. My clothing asset keeps jittering like a video I uploaded.
video youtube link
this clothing mesh asset has inside and out side surface. I even changed all property values to particles in torso part, but arm particle and neck particles keep jittering. I also folllowed solver property in body in character cloth sample scene in obi 7
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
I tried both obi 6 and obi 7.
In obi 6, as you can see screenshots, I used original solver setting that we've used and which is different with sample scene. This solver setting works fine except two sided clothing mesh asset(which has inside and outside like obi trench coat mesh). The result is it doesnt fall but arms and collar part's particles jitter too much.
In obi 7, I just copied man_trenchcoat solver setting but I used distance field. Using distance field did work fine with trench coat but not with clothing asset that we have. The clothing asset has just disappearing as soon as I play. I tried different clothing asset too, which has only one sided mesh clothing asset, and the result was same. I editted double sided mesh clothing asset blueprint like your trench coat, and after i figured out it didnt work well(dissapearing) then I just created skiined cloth bluprint newly just it case and still the clothing assets disaapear as soon as I play.
Posts: 6,300
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
(23-10-2024, 03:39 AM)gahyun11 Wrote: I tried both obi 6 and obi 7.
In obi 6, as you can see screenshots, I used original solver setting that we've used and which is different with sample scene. This solver setting works fine except two sided clothing mesh asset(which has inside and outside like obi trench coat mesh). The result is it doesnt fall but arms and collar part's particles jitter too much.
Jitter can be caused by multiple problems. Most often, constraint fighting or concave distance fields.
Make sure your cloth isn't smaller than the body's distance fields, and make sure to use multiple convex distance fields instead of a single concave one. This is also the only way to use distance fields with a deformable object such as a skinned mesh, since SDFs cannot deform.
Keep in mind that SDFs store just the closest distance for each point in space, and this closest point may be different each frame in concave areas which leads to jittering.
(23-10-2024, 03:39 AM)gahyun11 Wrote: In obi 7, I just copied man_trenchcoat solver setting but I used distance field. Using distance field did work fine with trench coat but not with clothing asset that we have. The clothing asset has just disappearing as soon as I play. I tried different clothing asset too, which has only one sided mesh clothing asset, and the result was same. I editted double sided mesh clothing asset blueprint like your trench coat, and after i figured out it didnt work well(dissapearing) then I just created skiined cloth bluprint newly just it case and still the clothing assets disaapear as soon as I play.
Cloth should not just disappear, I've been unable to reproduce anything like this. Would it be possible to share details about your setup?
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
28-10-2024, 03:43 AM
(This post was last modified: 28-10-2024, 09:58 AM by gahyun11.)
(23-10-2024, 09:55 AM)josemendez Wrote: Jitter can be caused by multiple problems. Most often, constraint fighting or concave distance fields.
Make sure your cloth isn't smaller than the body's distance fields, and make sure to use multiple convex distance fields instead of a single concave one. This is also the only way to use distance fields with a deformable object such as a skinned mesh, since SDFs cannot deform.
Keep in mind that SDFs store just the closest distance for each point in space, and this closest point may be different each frame in concave areas which leads to jittering.
Cloth should not just disappear, I've been unable to reproduce anything like this. Would it be possible to share details about your setup? Hello! Thank you for kind explanation. Since we are using distance field created from body shaped mesh, I think cause of the jittering is body shaped mesh.
https://drive.google.com/file/d/13IpjNB5...sp=sharing
And this is the link of our project file in google drive. I set the environment scene ' Test_CharacterCloth.scene' in Assets/Test directory. and There is a body gameobject named 'female_default_mannequin_trenchCopy'(I know, it is a long name lol) with obi solver and it is wearing cloth gameobject named 'TOP_hly_oatmeal' . As soon as I start play mod, the cloth object disappears in scene...? It still exists in scene but other clothes have same situations.
These are the screenshots
|