(模拟)Collision, Contact and Friction for Cloth Animation
本文禁止转载
B站:Heskey0
Robust Treatment of Collision, Contact and Friction for Cloth Animation (2002 Stanford)
rest contact: 慢慢接触
high speed impact: 高速碰撞
triangle corners: 三角形的角
barycentric coordinate: 重心坐标
1. Abstract
刚体,柔体和布料碰撞的难度:
- rigid body simulations often have relatively few collisions per object (apart from resting contact)
- deformable bodies naturally give rise to large numbers of collisions varying in strength from resting contact to high speed impact.
- Two-dimensional manifolds like cloth are the worst case.
Paper Overview:
-
This paper presents a collision handling algorithm that works with any method for simulating the internal dynamics. The key idea is to combine a fail-safe geometric collision method with a fast (non-stiff) repulsion force method that models cloth thickness as well as both static and kinetic friction.
-
Since our repulsion forces handle most of the self-interaction, it is desirable to make them computationally efficient to apply. Therefore we propose using a repulsion spring model that is not stiff.
A key ingredient of our new algorithm is that we do not work directly with positions but only obtain positions by integrating velocities. Thus, given a current non-interfering state for our cloth, the collision handling problem can be reduced to finding velocities that guarantee a non-interfering state at the end of the time step.
2. Cloth Model
For the purposes of demonstrating our collision handling, we use a simple mass-spring model for the internal cloth dynamics
3. Limiting the Strain and Strain Rate
Limiting the Strain:
- A rule of thumb in computational mechanics is that a triangle edge should not change length by more than 10% in a single time step.
Limit的方法:we adjust velocities instead of positions.
- At each time step, we calculate the candidate new spring lengths using the current velocities.
- Then we apply momentum-conserving corrective impulses to the velocities to ensure that all springs are deformed by a maximum of 10% from their rest length at the end of the time step (ignoring bending springs)
- These impulses influence the future strains of surrounding springs, and thus an iterative procedure is needed to guarantee that no spring deforms to over 10% of its rest length during the time step. (类似PBD中约束投影步骤的iteration)
- 迭代法的Trade-off:
- We apply this deformation limiting procedure using a Jacobi iterative approach. (for efficiency: parallel)
- We use a Gauss-Seidel iterative approach. (for accuracy)
4. Time Discretization
We cleanly separate the time evolution of the internal cloth dynamics (and the environment around the cloth) from the collision processing algorithm.
5. Proximity and Collision Detection
怎样做Collision Detection
AABB:
- To accelerate the detection of proximities for repulsions and of intersections for collisions, we use an axis-aligned bounding box hierarchy.
- The AABB hierarchy is built bottom-up once at the beginning of the simulation.
- At each time step, we calculate the axis-aligned boxes for the repulsion calculation by taking a box around each triangle enlarged by the thickness of the cloth, and then taking the union of the extents in each axis direction as we move up the hierarchy. (discussed in section 6.2)
- We also recalculate the hierarchy for each iteration of the collision algorithm. (section 6.4)
下文中:\(\vec x_{ij}=\vec x_i-\vec x_j\).
point-triangle Collision Detection:
-
To check if a point \(\vec x_4\) is closer than some thickness h to a triangle \(\vec x_1\vec x_2\vec x_3\) with normal \(\hat n\), we first check if the point is close to the plane containing the triangle: \(||\vec x_{43}\cdot \hat n||<h\). If so, we project the point onto the plane and compute the barycentric coordinates \((w_1,w_2,w_3)\) with respect to the triangle:
\[w_1+w_2+w_3=1 \\\pmatrix{ \vec x_{13}\cdot\vec x_{13}&\vec x_{13}\cdot\vec x_{23}\\ \vec x_{13}\cdot\vec x_{23}&\vec x_{23}\cdot\vec x_{23}} \pmatrix{ w_1\\w_2}= \pmatrix{ \vec x_{13}\cdot\vec x_{43}\\ \vec x_{23}\cdot\vec x_{43}} \] -
These are the normal equations for the least-squares problem of finding the point \(w_1\vec x_1 + w_2\vec x_2 + w_3\vec x_3\) (in the plane) closest to \(\vec x_4\). If the barycentric coordinates are all within the interval \([−δ,1+δ]\) where \(δ\) is \(h\) divided by a characteristic length of the triangle, the point is close.
edge-edge Collision Detection:
-
To check if an edge \(\vec x_1\vec x_2\) is close to another edge \(\vec x_3\vec x_4\), we find the pair of points, one on each edge, that are closest and check their distance. The search for the two closest points begins by checking for the degenerate case of parallel edges, i.e. if \(||\vec x_{21}\times \vec x_{43}||\) is smaller than a round-off tolerance. If so, it reduces to a simple one-dimensional problem. Otherwise, we find the points on the infinite lines that are closest via the normal equations:
\[\pmatrix{ \vec x_{21}\cdot\vec x_{21}&-\vec x_{21}\cdot\vec x_{43}\\ -\vec x_{21}\cdot\vec x_{43}&\vec x_{43}\cdot\vec x_{43}} \pmatrix{ a\\b}= \pmatrix{ \vec x_{21}\cdot\vec x_{31}\\ -\vec x_{43}\cdot\vec x_{31}} \] -
We also save their relative positions along the edges, i.e. the weights \(0 ≤ a,b ≤ 1\) so that the points are \(\vec x_1 +a\vec x_{21}\) and \(\vec x_3 +b\vec x_{43}\).
6. Contact and Collision Response
6.1 Interpolating within the cloth
怎样将冲量施加到点
To compute the velocity of a point interior to a triangle or edge we use linear interpolation
- triangle \(\vec x_1\vec x_2 \vec x_3\): 使用该点的barycentric coordinate \(w_1,w_2,w_3\) 做插值计算velocity
- edge \(\vec x_1\vec x_2\): 使用 \((1-a)\vec v_1+a\vec v_2\) 作插值公式计算velocity(\(a\in [0,1]\) 为点在edge中的位置)
If an impulse of magnitude \(I\) in direction \(\hat n\) needs to be applied to two points in the cloth
-
we instead apply impulses to the triangle corners or edge endpoints
-
For the point-triangle case:
- the adjusted impulses: (assuming all nodes have mass \(m\))\[\tilde I=\frac{2I}{1+w^2_1+w^2_2+w^2_3}\\ \begin{aligned} \vec v^{new}_i&=\vec v_i+w_i(\tilde I/m)\hat n\quad\quad i=1,2,3\\ \vec v^{new}_4&=\vec v_4-(\tilde I/m)\hat n \end{aligned} \]
- the adjusted impulses: (assuming all nodes have mass \(m\))
-
For the edge-edge case:
- the adjusted impulses:\[\tilde I=\frac{2I}{a^2+(1-a)^2+b^2+(1-b)^2}\\ \begin{aligned} \vec v^{new}_1&=\vec v_1+(1-a)(\tilde I/m)\hat n\quad\quad&\vec v^{new}_2=\vec v_2+a(\tilde I/m)\hat n\\ \vec v^{new}_3&=\vec v_3-(1-b)(\tilde I/m)\hat n\quad\quad&\vec v^{new}_4=\vec v_4-b(\tilde I/m)\hat n \end{aligned} \]
- the adjusted impulses:
6.2 Repulsions
上一个subsection中 \(I\) 的形式是什么?
If a pair is close enough, then two kinds of repulsion forces \(F_R\) are applied:
-
an inelastic collision based force.
- apply an inelastic impulse of magnitude \(I_c = mv_N/2\) in the normal direction
-
a spring based force.
-
modeled with a spring of stiffness \(k\).
-
\[d=h-(\vec v_4-w_1\vec x_1-w_2\vec x_2-w_3\vec x_3)\cdot\hat n \]
giving a spring force of \(kd\) in the direction \(\hat n\). Multiplying by \(\Delta t\) gives the impulse.
-
we limit this so that the relative velocity change will reduce the overlap by at most some fixed fraction (e.g. .1h) in one time step \(\Delta t\). If the normal component of relative velocity \(v_N ≥ .1d/∆t\) already we apply no repulsion, otherwise we compute the impulse magnitude:
\[I_r=-\min\left(\Delta tkd, m(\frac{.1d}{\Delta t}-v_N)\right) \]
-
we incorporate a completely inelastic collision into our repulsion force
6.3 Frictions
We use Coulomb’s model for friction, both static and kinetic, with a single friction parameter \(\mu\).
Notation:
- the pre-friction relative tangential velocity: \(\vec v_T^{pre}\).
- normal force (pressure): \(F_N\).
- friction force: \(\mu F_N\).
- impulse of friction force: \(\mu F_N\Delta t\).
- change in the relative tangential velocity velocity: \(\Delta v_N=\mu F_N\Delta t/m\).
- If this is larger than \(|\vec v^{pre}_T |\), then either the cloth was slipping and stopped due to kinetic friction,
the final tangential velocity:
We apply impulses to achieve this for both point-face proximities and edge-edge proximities
6.4 Geometric Collisions
Continuous collision handling: For robust collision handling, the path of the cloth between time steps must be considered.
the next subsection for more details.
6.5 Rigid Impact Zone
[Provot 1997]Collision and self-collision handling in cloth model dedicated to design garment:
- proposed collecting the nodes involved in multiple collisions into “impact zones” which are treated as rigid bodies.
Notation:
-
Center of Mass (质心):
-
\[\vec x_{CM}=\frac{\sum m\vec x_i}{\sum m} \]
-
Its average velocity:
-
\[\vec v_{CM}=\frac{\sum m\vec v_i^{n+1/2}}{\sum m} \]
-
-
angular momentum (角动量):
-
\[\vec L=\sum_im(\vec x_i^n-\vec x_{CM}\times (\vec v^{n+1/2}-\vec v_{CM})) \]
-
-
\(3\times3\) inertia tensor: (using \(\delta\) to represent the identity tensor)
-
\[I=\sum_im\left(|\vec x_i^n-\vec x_{CM}|^2\delta-(\vec x^n_i-\vec x_{CM})\otimes(\vec x_i^n-\vec x_{CM})\right) \]
-
-
the rigid body angular velocity (角速度):
-
\[\vec\omega=I^{-1}\vec L \]
-
-
the fixed and rotating components of the position:
-
\[\vec x_F=(\vec x_i-\vec x_{CM})\cdot\frac{\vec \omega}{|\vec\omega|}\frac{\vec \omega}{|\vec\omega|}\\ \vec x_R=\vec x_i-\vec x_{CM}-\vec x_F \]
-
the final position:
the new average velocity:
6.6 Updating the Final Velocity
见[Baraff 1998]Large step in cloth Simulation
7. Post-Processing with Subdivision
Sharp folds and wrinkles in the cloth mesh give undesirable angular features when rendered as plain triangles
这里不做展开