## Position Based Meshless Plasticity

Please don't post Bullet support questions here, use the above forums instead.
ikedude
Posts: 4
Joined: Wed May 31, 2017 6:19 am

### Position Based Meshless Plasticity

Hi all,

I'm currently trying to work through a Position Based approach to a soft body. The basic idea is to take Position Based Fluids (PBF) and use a constitutive model instead of the density constraint. Since it's a meshless model I'm using the idea of an incremental deformation gradient from here and trying to use a fixed corotated constitutive model from here.

The constraint would be to minimize the energy density for each particle. Calculating the energy is relatively easy but I'm having a hard time deriving the gradient of the energy with respect to the new particle position.

The snow paper gives an equation for the derivative of the energy with respect to the deformation gradient:
energy.png (3.76 KiB) Viewed 2451 times
I believe I could just multiply that by the derivative of the deformation gradient with respect to the new positions(X is a matrix of current positions, Y is a matrix of predicted positions):
deformation.png (3.54 KiB) Viewed 2451 times
But... that's just the incremental update so it needs to be multiplied by the cumulative deformation (which for differentiation is just a constant). Since I want the gradient of the energy constraint my understanding is that I would multiply the above two derivatives (which are both 3x3 matrices) by the gradient of the shape function to end up with a 3 element vector. That is the part of PBF that I don't completely understand.
pbf_constraint_gradient.png (4.85 KiB) Viewed 2451 times
Shows the gradient of the density constraint. The gradient for each particle is summed up and used in the lambda calculation but based on the above formulation don't they end up canceling out? Since the calculation for the ith particle is actually the sum of all other particles.

I'd love some help understanding the lambda calculation in PBF or the derivative of the deformation gradient with respect to new positions.

Thanks

ikedude
Posts: 4
Joined: Wed May 31, 2017 6:19 am

### Re: Position Based Meshless Plasticity

I found a helpful implementation of the Position Based Fluids paper that showed me how the constraint is actually calculated.

https://github.com/InteractiveComputerG ... Fluids.cpp

Inside the function "computePBFLagrangeMultiplier" it sums the gradient of all neighbor particles and separately sums the squared norm of all gradients. At the end it adds the squared norm of the sum of the gradients which is the ith particle's contribution. That was the part I misunderstood, even though the signs are opposite that doesn't matter if it is summing the squared norm (where they will all be positive).

Still working through the gradient of the constraint, but I'm thinking it may be easier to use the Strain Based Dynamics approach first since that doesn't require extracting the rotation.

ikedude
Posts: 4
Joined: Wed May 31, 2017 6:19 am

### Re: Position Based Meshless Plasticity

Working through the gradient calculation using the Strain Based Dynamics approach, here's what I got (first time writing LaTeX, it's kinda funky):
partial derivative deformation.png (18.07 KiB) Viewed 2232 times
There's a problem here once you start using the SPH weights.

Depending on how you decide to apply it, is it the weight calculated for the predicted position? The current position?

Or maybe multiply each column of Y by the weight at the predicted position and each column of X by the weight at the current position?

If you multiply Y by the predicted weight than the above derivation falls apart because each column of XY depends on all 3 components, instead of giving you clean columns like above. I guess that's not a big deal, I might try both ways and see which gives good results.

raigan2
Posts: 211
Joined: Sat Aug 19, 2006 11:52 pm

### Re: Position Based Meshless Plasticity

Have you tried the approach described in Muller "Meshless Deformations Based on Shape Matching"? AFAIK that's a popular way to implement meshless soft bodies with plastic deformations in a position-based simulation that might be worth a look. This paper from the same author has some useful references: http://matthias-mueller-fischer.ch/publ ... Decomp.pdf

ikedude
Posts: 4
Joined: Wed May 31, 2017 6:19 am

### Re: Position Based Meshless Plasticity

This is a little delayed but...

I have been looking at the shape matching papers. The problem with those is even though they are "meshless", they still have the idea of an "original" position. For my purposes that doesn't really work since I'm working with a fluid. I've tried it where the current positions are considered the original position for just that frame, but it doesn't preserve volume very well and doesn't have the best performance. I'm guessing there is just too much drift per frame.

I ended up using position based fluids combined with "fake" friction. I calculate the average velocity of all the neighbor particles (using SPH weights as well) and then constrain the motion of each particle to be along that direction. It kind of works but has weird artifacts so I'm still playing with it.