Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(SOLVED) "ERROR: Vertex has zero weights" when scaling softbody skinner
#1
Pregunta 
When changing the scale of a softbody skinner, I get the following error:



[Error] console:Mesh.SetBoneWeights() failed: Vertex [...] has zero weights.

The skinner appears fine in the editor, but when I press "Play", the skinner snaps back to it's original, unscaled size and the error appears (See attached GIF.)


.gif   SoftBodyScaleIssue.gif (Size: 634.4 KB / Downloads: 61)

My Obi Solver is set up as the RedDragon example, with the Softbody and Softbody skinner attached to different GameObjects.




BTW, if I set the skinner scale back to '1', re-bind and press "Play", the error message goes away.


Is this a bug or might I be doing something wrong?



Thanks,

David

Using Obi Softbody 6.4 with Unity 2020.3.30f1



BTW, here's the full stack trace:



Code:
ObiSoftbodySkinner.SetBoneWeights() at /Obi/Scripts/Softbody/Rendering/ObiSoftbodySkinner.cs:386
384:  {
385:      if (m_BoneWeights != null && m_BoneWeights.count > 0)
-->386:          m_SoftMesh.SetBoneWeights(m_BonesPerVertex.AsNativeArray<byte>(), m_BoneWeights.AsNativeArray<BoneWeight1>());
387:  }

ObiSoftbodySkinner.Setup() at /Obi/Scripts/Softbody/Rendering/ObiSoftbodySkinner.cs:135
133:  m_SoftMesh = Instantiate(m_Target.sharedMesh);
-->135:  SetBoneWeights();
136:  AppendBindposes();
137:  AppendSoftBones();

ObiSoftbodySkinner.UpdateSoftBones() at /Obi/Scripts/Softbody/Rendering/ObiSoftbodySkinner.cs:218
216:          }
217:              else
-->218:                  Setup();
219:          }

ObiActor.Interpolate() at /Obi/Scripts/Common/Actors/ObiActor.cs:1223
1222:      if (OnInterpolate != null)
-->1223:          OnInterpolate(this);
1224:  }

ObiSoftbody.Interpolate() at /Obi/Scripts/Softbody/Actors/ObiSoftbody.cs:288
286:      SetSelfCollisions(selfCollisions);
-->288:      base.Interpolate();
289:  }

ObiSolver.Interpolate() at /Obi/Scripts/Common/Solver/ObiSolver.cs:1641
1640:      foreach (ObiActor actor in actors)
-->1641:          actor.Interpolate();
1643:  }

ObiUpdater.Interpolate() at /Obi/Scripts/Common/Updaters/ObiUpdater.cs:132
130:          foreach (ObiSolver solver in solvers)
131:              if (solver != null)
-->132:                  solver.Interpolate(stepDeltaTime, accumulatedTime);
133:      }
134:  }

ObiFixedUpdater.Update() at /Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:64
62:  {
63:      ObiProfiler.EnableProfiler();
-->64:      Interpolate(Time.fixedDeltaTime, accumulatedTime);
65:      ObiProfiler.DisableProfiler();
Reply
#2
Hi David,

Seems like your skin has exceeded the maximum number of skin influences per vertex in Unity (which is 255).

A simple way to get it under control is to reduce the "skinning max distance" parameter of your ObiSoftbodySkinner, to something like 0.2 or 0.1. Then, click "Bind skin" again. This will reduce the influence area around each vertex, ensuring the max amount of influences is respected.

For the next update, I should probably add a warning message in the Skinner UI itself when this situation happens, instead of delegating on Unity since the error message it throws is quite cryptic.

let me know if I can be of further help.
Reply
#3
I've just slightly modified the ObiSoftbodySkinner component to clamp the amount of influences to 255 after sorting them by weight, which is the best thing to do in this case imho (definitely better that showing a message).

You can find the patched file attached, once replace yours with this one there will be no need to limit the max skin radius.

let me know how it goes!


Attached Files
.cs   ObiSoftbodySkinner.cs (Size: 18.02 KB / Downloads: 21)
Reply
#4
Dedo arriba 
Actually, INCREASING the "Skinning Max Distance" solved the problem!

Which I guess makes sense: I'm scaling a small (around 1 unit) mesh up to 8x it's original size, so some vertex are probably going to be more than 0.5 units from any cluster, meaning the vertex is not being influenced by any clusters causing no weights to be assigned to it, which leads to the error.

When I increased the "Skinning Max Distance" to 2, the error went away.

Thanks for steering me towards what the issue might be related to! Sonrisa

BTW, the updated version of "ObiSoftbodySkinner.cs" did not remedy my particular issue.
Reply