Commit: 9959cce4b6ec6bb698520c33d1143fef0f9a590e
Author: Lukas Tönne
Date: Fri Sep 12 12:30:13 2014 +0200
Branches: hair_immediate_fixes
https://developer.blender.org/rB9959cce4b6ec6bb698520c33d1143fef0f9a590e
Transform the constraint matrix and target solver vector z according to
the root frame transforms as well.
This ensures the hair constraints are actually in root space and applied
correctly by the solver.
===================================================================
M source/blender/blenkernel/intern/implicit.c
===================================================================
diff --git a/source/blender/blenkernel/intern/implicit.c
b/source/blender/blenkernel/intern/implicit.c
index 33b5404..f79e6f2 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -2288,10 +2288,12 @@ bool implicit_hair_volume_get_texture_data(Object
*UNUSED(ob), ClothModifierData
* This is part of the modified CG method suggested by Baraff/Witkin in
* "Large Steps in Cloth Simulation" (Siggraph 1998)
*/
-static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts
*contacts, int totcolliders, lfVector *V, fmatrix3x3 *S, lfVector *z, float dt)
+static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts
*contacts, int totcolliders, lfVector *X, lfVector *V, fmatrix3x3 *S, lfVector
*z, float dt)
{
- ClothVertex *verts = clmd->clothObject->verts;
- int numverts = clmd->clothObject->numverts;
+ Cloth *cloth = clmd->clothObject;
+ ClothVertex *verts = cloth->verts;
+ int numverts = cloth->numverts;
+ RootTransform *roots = cloth->implicit->root;
int i, j, v;
for (v = 0; v < numverts; v++) {
@@ -2343,6 +2345,17 @@ static void setup_constraint_matrix(ClothModifierData
*clmd, ColliderContacts *c
}
}
}
+
+ /* transform to root space */
+ for (v = 0; v < numverts; v++) {
+ float t[3][3];
+ copy_m3_m3(t, roots[v].rot);
+ transpose_m3(t);
+ mul_m3_m3m3(S[v].m, S[v].m, t);
+ mul_m3_m3m3(S[v].m, roots[v].rot, S[v].m);
+
+ vel_world_to_root(z[v], X[v], z[v], &roots[v]);
+ }
}
static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame),
lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX,
ListBase *effectors, float time, fmatrix3x3 *M)
@@ -2687,7 +2700,7 @@ int implicit_solver(Object *ob, float frame,
ClothModifierData *clmd, ListBase *
}
/* setup vertex constraints for pinned vertices and contacts */
- setup_constraint_matrix(clmd, contacts, totcolliders, id->V,
id->S, id->z, dt);
+ setup_constraint_matrix(clmd, contacts, totcolliders, id->X,
id->V, id->S, id->z, dt);
// damping velocity for artistic reasons
mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping,
numverts);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs