PositionBasedDynamics
PositionBasedDynamics copied to clipboard
Still overlap in deformable-deformable collision simulation
I found that the collision detection about deformable bodies is implemented in this repo. https://github.com/InteractiveComputerGraphics/PositionBasedDynamics/blob/b142aad449337cc091611d79a5f1fff85ccc6c40/Simulation/DistanceFieldCollisionDetection.cpp#L349
Then I created a scene in which two soft body collide with each other. But they can still overlap with each other, although the ParticleTetContactConstraint is generated.

The comments of this line
https://github.com/InteractiveComputerGraphics/PositionBasedDynamics/blob/b142aad449337cc091611d79a5f1fff85ccc6c40/Simulation/DistanceFieldCollisionDetection.cpp#L418 shows that collisionTest perform collision test with distance field to get closest point on surface.
Is the distance field generated only once at the initialization step?
How can I use distance field when the body is deforming?
You can either recompute the distance field in each step or what is implemented in PBD, you transform the query back to the reference configuration, determine the nearest point there and transform the result back. However, this is just an approximation of the correct solution.
For the overlap I can just guess what happened. But maybe the time step was too large. Then the intersecting point is closer to the surface on the wrong side.