Posts: 10
Threads: 3
Joined: Jun 2020
Reputation:
0
15-06-2020, 02:38 PM
(This post was last modified: 15-06-2020, 02:38 PM by renderlux.)
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?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
15-06-2020, 03:46 PM
(This post was last modified: 15-06-2020, 03:48 PM by josemendez.)
(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.
Posts: 10
Threads: 3
Joined: Jun 2020
Reputation:
0
15-06-2020, 04:07 PM
(This post was last modified: 15-06-2020, 04:21 PM by renderlux.)
(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
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
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"
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(15-06-2020, 04:07 PM)renderlux Wrote: Thanks for reply
I'm doing that
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?
Posts: 10
Threads: 3
Joined: Jun 2020
Reputation:
0
(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?
Posts: 6,326
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(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];
}
}
}
}
}
Posts: 10
Threads: 3
Joined: Jun 2020
Reputation:
0
(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
Posts: 10
Threads: 3
Joined: Jun 2020
Reputation:
0
(15-06-2020, 05:59 PM)renderlux Wrote: Hi
Ok will try that
--
Yay it worked
|