Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a gap in the skirt, how to solve it? #65

Open
binzi56 opened this issue Nov 22, 2022 · 2 comments
Open

There is a gap in the skirt, how to solve it? #65

binzi56 opened this issue Nov 22, 2022 · 2 comments

Comments

@binzi56
Copy link

binzi56 commented Nov 22, 2022

The cloth I created through InitializeFromData() has added motion constraints, but the skirt seems to be stretched, and I don’t know where the problem is; if it is a simple piece of cloth, it will not be stretched without adding a distance constraint; Is it because of the skirt? How to set it up?

截屏2022-11-22 15 58 26

The above is what it should look like, The following is what it looks like after I pass in the vertices after the simulation operation, and it is stretched a bit seriously.

截屏2022-11-22 15 57 35

@mtamis-NV
Copy link
Contributor

Adding tether constraints, or gradually reducing the particle mass at lower parts of the skirt can both help reduce stretching.

@binzi56
Copy link
Author

binzi56 commented Jan 6, 2023

Thanks for the answer, I still have a problem here, the dress seems to be torn, there are gaps, how to solve it?
Looking at the official document, it may be a constraint problem. The following is my code, including Fabric and Motion constraints. Other constraints are gone, so I don’t know where the problem is. After I remove the Motion constraints and the effect is the same.

        nv::cloth::BoundedData positions = nv::cloth::ClothMeshData::ToBoundedData(verticesXYZ);
        nv::cloth::BoundedData indices = nv::cloth::ClothMeshData::ToBoundedData(indexs);

        ClothMeshData cloth_mesh;
        PxVec3 originPoint = PxVec3(originData->x, originData->y, originData->z);
        originPoint = PxVec3(0, 0, 0);
        PxMat44 transform =  PxTransform(originPoint, PxQuat(0, PxVec3(1.f, 0.f, 0.f)));
        cloth_mesh.InitializeFromData(positions, indices, transform);
        cloth_mesh.AttachClothUsingTopVertices(0.1);

        nv::cloth::ClothMeshDesc mesh_desc = cloth_mesh.GetClothMeshDesc();
        nv::cloth::Vector<int32_t>::Type phaseTypeInfo;
        app.mFabric = NvClothCookFabricFromMesh(factory, mesh_desc, PxVec3(0.0f, -4.f, 0.0f), &phaseTypeInfo, false);
       
        ...
        
        // MARK: - Set distance constraints
        nv::cloth::Range<physx::PxVec4> distance_constraints = app.cloth->getMotionConstraints();
        for (int i = 0; i < (int)distance_constraints.size(); i++) {
            distance_constraints[i] = physx::PxVec4(particlesCopy[i].getXYZ(), 0.002f * (i % 800) * 0.002f * (i % 800));
        }

截屏2023-01-06 11 18 01

Tether constraint scale = 1.0

截屏2023-02-03 15 18 52

Tether constraint scale = 0.8

@mtamis-NV When the Tether constraint scale is 0.8 below, the gap can be clearly seen. I guess that the positions and indices passed in by the constraint or cloth_mesh initialization are not enough. The official room is another initialization method.

@binzi56 binzi56 changed the title The skirt is stretched, how to set it? There is a gap in the skirt, how to solve it? Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants