Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
prefabs of clothes
#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


Messages In This Thread
prefabs of clothes - by renderlux - 15-06-2020, 02:38 PM
RE: prefabs of clothes - by josemendez - 15-06-2020, 03:46 PM
RE: prefabs of clothes - by renderlux - 15-06-2020, 04:07 PM
RE: prefabs of clothes - by josemendez - 15-06-2020, 04:24 PM
RE: prefabs of clothes - by renderlux - 15-06-2020, 04:37 PM
RE: prefabs of clothes - by josemendez - 15-06-2020, 05:16 PM
RE: prefabs of clothes - by renderlux - 15-06-2020, 05:59 PM
RE: prefabs of clothes - by renderlux - 16-06-2020, 09:17 AM