Volume preserving procedural mesh deformation

Volume preserving procedural mesh deformation

I'm having difficulties trying to create a procedural mesh that deforms on impact. The deformation is meant to look and feel like metal when it is being forged. Since this is less of an aesthetic feature and more of something that would affect gameplay directly, it needs to be somewhat accurate. This means that volume of the mesh should be preserved (at least visually) such that the mesh does not gradually get too much smaller.
What I have tried:
1) Applying force on every vertex, based on the force and distance from impact point
foreach (Vector3 vertexPos in vertexList)
{
    vertexPos += (force / distanceToImpactPoint.sqrMagnitude) * impactDir;
}

This led to the entire mesh gradually becoming smaller (as mentioned earlier)
2) Take into account the dot product between the impact direction and vertex normal for each vertex, as well as lerp between impact direction and normal (to simulate sides of objects bulging out when compressed
foreach (Vector3 vertexPos in vertexList)
{
    float attenuatedForce = (force / distanceToImpactPoint.sqrMagnitude);
    float nDotD = Vector3.Dot(impactDir, currVertexNormal);
    vertexPos = attenuatedForce * nDotD * Vector3.Lerp(impactDir, currVertexNormal, nDotD);
}

This led to mesh completely splitting apart for anything that has hard shading (as there  are duplicate vertices where the edges are, and also artifacts on smooth shaded objects.
Hard Shading: 

Soft Shading (sort of works, but lots of artefacts and not volume preserving)

Also, both methods break completely if force is applied to an edge.
Does anyone know of a more elegant solution to do this?

Solutions/Answers:

Answer 1:

Due to the relatively low melting temperature of metals, they act like a fluid (sort of) when you hit them (it’ closer to a gel, but gels are also fluids technically). The higher something’s temperature is, the more viscose it gets (that’s why metal workers heat up metals bars before using them, try heating up honey to test this).

So, you can technically simulate the properties of them with a fluid simulation algorithm (like the Navier-Stokes equations) by using a very very high viscosity.

Most fluid simulators allow you to apply a force at a specific position. You can use this to apply the hit force to the material, which makes a part of the fluid more dense, thus the algorithm dissipates it to the sides. Because fluids are uncompressable (they are, but a higjer compression would create a nuclear reaction), the material won’t ever disappear.

Creating a mesh out of the data is very easy too. Most fluid simulators use a grid to store the water. You can just take this grid and process it using an algorithm like marching cubes to produce a mesh out of it.

This mesh can then get rendered and used in a mesh collider.

References