Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
prefabs of clothes
#1
In the 

Samples > Cloth > CharacterCloth 

you only use one piece of clothes, the "Trenchcoat", what about prefabs of say shirts, trousers, skirt that can be turned off and on.

What is the setup for the above?
Reply
#2
(15-06-2020, 02:38 PM)renderlux Wrote: In the 

Samples > Cloth > CharacterCloth 

you only use one piece of clothes, the "Trenchcoat", what about prefabs of say shirts, trousers, skirt that can be turned off and on.

What is the setup for the above?

What do you mean? You're supposed to provide your own meshes (shirts, trousers, or any other mesh you may want to apply cloth physics to) and make blueprints out of them. Obi is a physics engine, it does not include any art resources.

If what you're asking is how to add multiple cloth actors to a single solver, it is done in exactly the same way as you do for just one: make a blueprint out of the mesh, add another ObiSkinnedCloth/Renderer components, and done.
Reply
#3
(15-06-2020, 03:46 PM)josemendez Wrote: What do you mean? You're supposed to provide your own meshes (shirts, trousers, or any other mesh you may want to apply cloth physics to) and make blueprints out of them. Obi is a physics engine, it does not include any art resources.

If what you're asking is how to add multiple cloth actors to a single solver, it is done in exactly the same way as you do for just one: make a blueprint out of the mesh, add another ObiSkinnedCloth/Renderer components, and done.

Thanks for reply Sonrisa
Quote:If what you're asking is how to add multiple cloth actors to a single solver, it is done in exactly the same way as you do for just one: make a blueprint out of the mesh, add another ObiSkinnedCloth/Renderer components, and done.


I'm doing that Sonrisa

the shirt has physics but the trouser has no physics, both have "Skinned Cloth Renderer" and "SkinnedCloth" and the root model as "Solver" and "Fixed Updater"
Reply
#4
(15-06-2020, 04:07 PM)renderlux Wrote: Thanks for reply Sonrisa


I'm doing that Sonrisa

the shirt has physics but the trouser has no physics, both have "Skinned Cloth Renderer" and "SkinnedCloth" and the root model as "Solver" and "Fixed Updater"

Hi, can't reproduce this issue. What Obi version are you using?
Reply
#5
(15-06-2020, 04:24 PM)josemendez Wrote: Hi, can't reproduce this issue. What Obi version are you using?


5.1 is the only one I can use because 5.3 as issues with iOS (linking)

Is there documentation or sample (CharacterCloth) with multiple clothing?
Reply
#6
(15-06-2020, 04:37 PM)renderlux Wrote: 5.1 is the only one I can use because 5.3 as issues with iOS (linking)

Is there documentation or sample (CharacterCloth) with multiple clothing?

Hi,

There was a bug related to this, fixed in 5.2.

open up Obi/Scripts/Cloth/Actors/ObiSkinnedCloth.cs, and replace the SetTargetSkin method with the following one. That should allow multiple skinned cloth actors to be rendered correctly.

Code:
private void SetTargetSkin()
        {
            using (m_SetTargetSkinPerfMarker.Auto())
            {

                var skinConstraints = GetConstraintsByType(Oni.ConstraintType.Skin) as ObiConstraints<ObiSkinConstraintsBatch>;
                var batch = skinConstraints.batches[0] as ObiSkinConstraintsBatch;

                using (m_SortSkinInputsPerfMarker.Auto())
                {
                    int pointCount = bakedVertices.Count;
                    for (int i = 0; i < pointCount; ++i)
                    {
                        int welded = m_SkinnedClothBlueprint.topology.rawToWelded[i];
                        sortedPoints[welded] = bakedVertices[i];
                        sortedNormals[welded] = bakedNormals[i];
                    }
                }

                using (m_SetSkinInputsPerfMarker.Auto())
                {
                    Matrix4x4 skinToSolver = actorLocalToSolverMatrix;
                    for (int i = 0; i < batch.activeConstraintCount; ++i)
                    {
                        int solverIndex = batch.particleIndices[i];
                        int actorIndex = solver.particleToActor[solverIndex].indexInActor;

                        batch.skinPoints[i] = skinToSolver.MultiplyPoint3x4(sortedPoints[actorIndex]);
                        batch.skinNormals[i] = skinToSolver.MultiplyVector(sortedNormals[actorIndex]);

                        // Rigidly transform particles with zero skin radius and zero compliance:
                        if (Mathf.Approximately(batch.skinRadiiBackstop[i * 3], 0) & Mathf.Approximately(batch.skinCompliance[i], 0))
                        {
                            solver.invMasses[solverIndex] = 0;
                            solver.positions[solverIndex] = batch.skinPoints[i];
                        }
                    }
                }

            }
        }
Reply
#7
(15-06-2020, 05:16 PM)josemendez Wrote: Hi,

There was a bug related to this, fixed in 5.2.

open up Obi/Scripts/Cloth/Actors/ObiSkinnedCloth.cs, and replace the SetTargetSkin method with the following one. That should allow multiple skinned cloth actors to be rendered correctly.

Code:
private void SetTargetSkin()
        {
            using (m_SetTargetSkinPerfMarker.Auto())
            {

                var skinConstraints = GetConstraintsByType(Oni.ConstraintType.Skin) as ObiConstraints<ObiSkinConstraintsBatch>;
                var batch = skinConstraints.batches[0] as ObiSkinConstraintsBatch;

                using (m_SortSkinInputsPerfMarker.Auto())
                {
                    int pointCount = bakedVertices.Count;
                    for (int i = 0; i < pointCount; ++i)
                    {
                        int welded = m_SkinnedClothBlueprint.topology.rawToWelded[i];
                        sortedPoints[welded] = bakedVertices[i];
                        sortedNormals[welded] = bakedNormals[i];
                    }
                }

                using (m_SetSkinInputsPerfMarker.Auto())
                {
                    Matrix4x4 skinToSolver = actorLocalToSolverMatrix;
                    for (int i = 0; i < batch.activeConstraintCount; ++i)
                    {
                        int solverIndex = batch.particleIndices[i];
                        int actorIndex = solver.particleToActor[solverIndex].indexInActor;

                        batch.skinPoints[i] = skinToSolver.MultiplyPoint3x4(sortedPoints[actorIndex]);
                        batch.skinNormals[i] = skinToSolver.MultiplyVector(sortedNormals[actorIndex]);

                        // Rigidly transform particles with zero skin radius and zero compliance:
                        if (Mathf.Approximately(batch.skinRadiiBackstop[i * 3], 0) & Mathf.Approximately(batch.skinCompliance[i], 0))
                        {
                            solver.invMasses[solverIndex] = 0;
                            solver.positions[solverIndex] = batch.skinPoints[i];
                        }
                    }
                }

            }
        }


Hi 

Ok will try that Sonrisa
Reply
#8
(15-06-2020, 05:59 PM)renderlux Wrote: Hi 

Ok will try that Sonrisa


--


Yay it worked Sonrisa
Reply