Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fracturing/Breaking Shape Matching Constraints
#4
(02-12-2020, 04:51 PM)saiacide Wrote: Thanks that makes sense. I might try and figure out how to expose the deformation matrix while I wait for the update.

Rest deformation matrices, as well as permanent (plastic) deformation matrices are stored in the constraint batches directly. You have the sources available for the Burst backend, so technically it is possible for you to modify them and expose the matrices yourself. Take a look at BurstShapeMatchingConstraintsBatch.cs.

Not possible for the Oni backend though, as that's implemented in the native precompiled lib.

(02-12-2020, 04:51 PM)saiacide Wrote: Once I have the deformation matrix could you give me some hints on how to calculate a stress value from it? The math in the shapematching constraint is pretty hairy but it looks like I would need both the rotation matrix and the deformation matrix.

It is quite hairy, yes.  Indeciso

There's 3 different matrices to consider:
- The rest deformation matrix. This describes the shape of a cluster at rest. In Burst's sources it is called "App".
- The plastic deformation matrix. This describes the temporary additional deformation that should be applied to the rest deformation matrix. In the source it's simply called "deformation".
- The current deformation matrix. It describes the current shape of a cluster. It is calculated each frame and used for two things: extract an optimal rotation for the cluster (via singular value decomposition) and (in case it goes over the plastic deformation threshold) update the plastic deformation matrix. In the source it is called "Apq", calculated from scratch every frame and not stored permanently anywhere.

In your case, you need to know how much the current deformation (including any plastic deformation) deviates from the rest deformation, excluding rotation and translation (as you're interested in detecting when a cluster is overly stretched). Line 374 of BurstShapeMatchingConstraintsBatch.cs calculates this:

Code:
// get scale matrix (A = RS so S = Rt * A) and its deviation from the identity matrix:
float4x4 deform_matrix = math.mul(math.transpose(R), math.mul(Apq_def, Aqq[i])) - float4x4.identity;

The frobenius norm of this matrix is a scalar value that can be used to determine how much stress a cluster is undergoing:

Code:
// if the amount of deformation exceeds the yield threshold:
float norm = deform_matrix.frobeniusNorm();
if (norm > plastic_yield)
{
// plastic behavior
}

So slapping this matrix into an array (one matrix per cluster) or its frobenius norm and exposing it will give you the info you need.

Some literature on the subject:
https://matthias-research.github.io/page...ticles.pdf
Reply


Messages In This Thread
RE: Fracturing/Breaking Shape Matching Constraints - by josemendez - 07-12-2020, 11:24 AM