P30
Constrained Dynamics
要解决的问题
A critical problem exists: what if constraints/forces are very very stiff? Or infinitely stiff?
✅ 此算法用于处理 very very stiff 的场景即约束必须严格满足,而前面算法需要做很多次迭代才能产生这种效果(计算量大)。
✅ 此算法常用于衣服、刚体、人体。比如人体的关节联结,是一种非常stiff的约束。
根据约束建立模型
Compliant constraint
ϕe(x)=||xei−xej||−Le
E(x)=∑e12k(||xei−xej||−Le)2=12ϕT(x)C−1ϕ(x)
✅ E(X)=∑e12k(ϕe(x))2
f(x)=−∇E=−(∂E∂ϕ∂ϕ∂x)T=−JTC−1ϕ=JTλ
Let N be the number of vertices and E be the number of constraints,
约束 | ϕ(x)∈RE | ✅ ϕe=[ϕ0ϕ1⋮ϕE] |
Compliant matrix | C=[1/k◻◻◻1/k◻◻◻⋱]∈RE×E | ✅ C称为软度矩阵、 stiffness:挺度,compliant:软度 |
Jacobian | J=∂ϕ∂x∈RE×3N | |
Dual variables (Lagrangian multipliers) | λ=−C−1ϕ∈RE | ✅ λ 是人为引入的变量,称为拉格朗日算子。 |
✅ E 和 f 变成了关于两个变量(x、λ)的函数。
✅把能量写成约束的形式
E(x)=12ϕT(x)C−1λf(x)=JTλ 根据E(x)和f(x)做隐式积分
转化为隐式积分问题
P31
By implicit integration, we get:
Mvnew−∆tJTλnew=Mv
✅ 动量守衡公式:Mv′−Mv=Ft=冲量
✅ 此处新 λnew来计算 F. 说明是 Implicit
Meanwhile, Cλnew=−ϕnew≈−ϕ−J(xnew−x)≈−ϕ−∆tJvnew
✅ 对−ϕnew 的泰勒展开
✅J是上页中的Jacobian.
[M−∆tJT∆tJC][vnewλnew][Mv−ϕ]
✅ 最后的矩阵公式由上面两个公式整理合并得到。
xnew−x=△t⋅v
解隐式积分
P32
Now we have a system with two sets of variables: the primal variable x (or v=x ̇) and the dual variable λ.
✅ 之前的隐式积分只有一个变量,此处的隐式积分有两个变量。需要同时解出两个变量。
- Method 1: We can solve the two variables by a direct solver together, in a primal-dual fashion:
[M−∆tJT∆tJC][vnewλnew]=[Mv−ϕ]
✅ 注意:Method 1 中的矩阵有可能不正定、因此很多数学方法用不了。
- Method 2: We can reduce the system by Schur complement and solve λnew first.
✅ Method 2 的消元过程不容易构造、尤其是当矩阵比较复杂时。
(∆t2JM−1JT+C)λnew=−ϕ−∆tJv
vnew⟵v+−∆tM−1JTλnew
✅ 用哪种方法取决于应用场景
优点
Infinite stiffness? C⟶0.
✅ 此方法将软硬度量解耦出来,并用矩阵C来表示,使得可以方便控制软硬度,例如让c=0 来表示 infinite stiffness.
应用
Articulated Rigid Bodies (ragdoll animation)
P34
Stable Constrained Dynamics
✅ 没有展开讲,见after reading中的论文
From a mass-spring system, we know spring Hessian (tangent stiffness) is:
H(x)=∑e=(i,j)[◻◻◻◻◻He−He◻◻−HeHe◻◻◻◻◻]
According to constrained dynamics:f(x)=JTλ and λ=−C−1ϕ, so:
Je=∂ϕe∂x=[xTij||xij||−xTij||xij||]
P35
Stable Constrained Dynamics
According Lecture 5, Page 16, implicit integration is:
(1∆t2M+H(x[0]))∆x=1∆t2M(∆tv[0])+f(x[0])
⇓
(M+∆t2H(x[0]))vnew=Mv[0]+∆tf(x[0])
Missing geometric stiffness matrix here…
P36
After-Class Reading (optional)
Tournier et al. 2015. Stable Constrained Dynamics. TOG (SIGGRAPH).
✅ Method 2 Gauss 消元,如果把λ消掉,会得到一个基本上与隐式积分相似的公式,唯一的区别是H上略有不同 —— 隐式积分多了一项。如果把用这一项加回去,会使constrain dynamic 变得稳定。
本文出自CaterpillarStudyGroup,转载请注明出处。
https://caterpillarstudygroup.github.io/GAMES103_mdbook/