Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fracturing/Breaking Shape Matching Constraints
#1
I'm trying to implement a simple fracturing/tearing effect by deactivating a shape matching constraint. I can deactivate the constraints via a debug key but now I'm trying to only deactivate them if the constraint is over a certain strain threshold. Is this currently possible? I was hoping the constraints lamda would contain some useful information but for the shapematching constraints it appears to always be zero. My other idea was to store the previous frames center of mass and measure the delta but was hoping there was a better way.
Reply
#2
(30-11-2020, 10:36 PM)saiacide Wrote: I'm trying to implement a simple fracturing/tearing effect by deactivating a shape matching constraint. I can deactivate the constraints via a debug key but now I'm trying to only deactivate them if the constraint is over a certain strain threshold. Is this currently possible? I was hoping the constraints lamda would contain some useful information but for the shapematching constraints it appears to always be zero. My other idea was to store the previous frames center of mass and measure the delta but was hoping there was a better way.

Hi there,

Shape Matching constraints aren't described by a single lagrange multiplier. Instead, their use a 3x3 deformation matrix that determines how far away from their "rest state" they are. Unfortunately this is currently not exposed via the API. We will expose these matrices in upcoming updates.

Note that for a fracturing/tearing effect you'd also need to update mesh topology and skinning, which is a far from trivial thing to do.
Reply
#3
(02-12-2020, 09:43 AM)josemendez Wrote: Hi there,

Shape Matching constraints aren't described by a single lagrange multiplier. Instead, their use a 3x3 deformation matrix that determines how far away from their "rest state" they are. Unfortunately this is currently not exposed via the API. We will expose these matrices in upcoming updates.

Note that for a fracturing/tearing effect you'd also need to update mesh topology and skinning, which is a far from trivial thing to do.

Thanks that makes sense. I might try and figure out how to expose the deformation matrix while I wait for the update. 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.


Is it something like this?
Code:
float4x4 transform = math.mul(R,deformation[i]);
float stress = math.length(math.mul(transform, restComs[i]));

I'm only allowing certain clusters to break and my mesh is pre-fractured which makes updating the skinning significantly easier.
Reply
#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