From 136607151ee2ea916239c62db761d49dc8969050 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 28 Oct 2019 12:53:59 -0700 Subject: [PATCH] use mult instead of max to combine friction properties use 0.5 friction for ground for a demo, and also a larger grid size update description of deformable algorithm disable SVD for now, has some issue with some compilers --- examples/DeformableDemo/DeformableContact.cpp | 5 +++-- src/.DS_Store | Bin 6148 -> 6148 bytes .../btDeformableMultiBodyDynamicsWorld.cpp | 17 +++++++++++------ .../btDeformableNeoHookeanForce.h | 3 ++- src/BulletSoftBody/btSoftBodyInternals.h | 8 ++++---- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/examples/DeformableDemo/DeformableContact.cpp b/examples/DeformableDemo/DeformableContact.cpp index 2432d3e27..8712d6de8 100644 --- a/examples/DeformableDemo/DeformableContact.cpp +++ b/examples/DeformableDemo/DeformableContact.cpp @@ -105,7 +105,8 @@ void DeformableContact::initPhysics() btVector3 gravity = btVector3(0, -10, 0); m_dynamicsWorld->setGravity(gravity); getDeformableDynamicsWorld()->getWorldInfo().m_gravity = gravity; - + getDeformableDynamicsWorld()->getWorldInfo().m_sparsesdf.setDefaultVoxelsz(0.25); + getDeformableDynamicsWorld()->getWorldInfo().m_sparsesdf.Reset(); m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld); { @@ -182,7 +183,7 @@ void DeformableContact::initPhysics() psb2->setTotalMass(1); psb2->m_cfg.kKHR = 1; // collision hardness with kinematic objects psb2->m_cfg.kCHR = 1; // collision hardness with rigid body - psb2->m_cfg.kDF = 0; + psb2->m_cfg.kDF = 0.5; psb2->m_cfg.collisions = btSoftBody::fCollision::SDF_RD; psb2->m_cfg.collisions |= btSoftBody::fCollision::VF_DD; psb->translate(btVector3(3.5,0,0)); diff --git a/src/.DS_Store b/src/.DS_Store index ee616d543128a1988ca9f9dc9bb19e1f51a11544..26f6e2211eb869f996f693d2cd16705d092c3411 100644 GIT binary patch delta 707 zcmXYv&rcIU6vy9pmmj+;(kWsQby0&vP{2lwqJk+R3Zj8%fr5l)+Z|!!cDHu6E%DMA zh+f5Nki>a(_2`?J`21%}~Z)j9hZI?cJRU1pPmV(8L zlUdJl9Wldm!mmjd63cFJJncGDIbQK+)2^M*I3mfyX~RzEZNuZkwtd@rz(vC2D_*6W z7jDiQse(zyN_oL=aUZk_{ECl@gyr8?;TY8KO}m>zEZnlEb#F&!ci*XVgTslmo5^s; z6N{!#-!OzXndJ^Q?^NVSj{Bz>7k+%&Hd5S<-?JQZwon^5?id-qPyuhcrghii=1!#4 zwy%Bv0ZpIwIleMov`lY#&Jbztn3l6NTd;(cvN>xEqgPdSB0hcSu&y(OeNt-jXqPV~ z_AZb;$90X#%uv)S+<#KjSv@m@?CCR_#_E_*Ywo~#t)#OCHWAoEmwcPT_!0POm#!(Q z(i!Wf>Z(3K?Tkfhk`!vEeu~i;EfA+Htv)L`yuxd2VyiZogkZq&pauooe$z~sDNnY)IeD}(B*)5)N=Wg)XxWhe$Qz;7 PVa3l&l}tI&x-I_)AndO% delta 73 zcmZoMXfc=|#>B)qu~2NHo+2aD#(>?7lMO^zHuJOCGETn6Zn#;2gPmn!L-S^K4t@@x b!p(vl-m_tetras[j]; btMatrix3x3 P; firstPiola(psb->m_tetraScratches[j],P); - +#if USE_SVD btMatrix3x3 U, V; btVector3 sigma; singularValueDecomposition(P, U, sigma, V); @@ -194,6 +194,7 @@ public: Sigma[1][1] = sigma[1]; Sigma[2][2] = sigma[2]; P = U * Sigma * V.transpose(); +#endif // btVector3 force_on_node0 = P * (tetra.m_Dm_inverse.transpose()*grad_N_hat_1st_col); btMatrix3x3 force_on_node123 = P * tetra.m_Dm_inverse.transpose(); btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col; diff --git a/src/BulletSoftBody/btSoftBodyInternals.h b/src/BulletSoftBody/btSoftBodyInternals.h index 6e20b3222..93aa1d3c0 100644 --- a/src/BulletSoftBody/btSoftBodyInternals.h +++ b/src/BulletSoftBody/btSoftBodyInternals.h @@ -1288,7 +1288,7 @@ struct btSoftColliders c.m_node = node; c.m_face = face; c.m_weights = w; - c.m_friction = btMax(psb[0]->m_cfg.kDF, psb[1]->m_cfg.kDF); + c.m_friction = btMax (psb[0]->m_cfg.kDF, psb[1]->m_cfg.kDF); c.m_cfm[0] = ma / ms * psb[0]->m_cfg.kSHR; c.m_cfm[1] = mb / ms * psb[1]->m_cfg.kSHR; psb[0]->m_scontacts.push_back(c); @@ -1346,7 +1346,7 @@ struct btSoftColliders c.m_bary = w; // todo xuchenhan@: this is assuming mass of all vertices are the same. Need to modify if mass are different for distinct vertices c.m_weights = btScalar(2)/(btScalar(1) + w.length2()) * w; - c.m_friction = btMax(psb[0]->m_cfg.kDF, psb[1]->m_cfg.kDF); + c.m_friction = psb[0]->m_cfg.kDF * psb[1]->m_cfg.kDF; // the effective inverse mass of the face as in https://graphics.stanford.edu/papers/cloth-sig02/cloth.pdf c.m_imf = c.m_bary[0]*c.m_weights[0] * n[0]->m_im + c.m_bary[1]*c.m_weights[1] * n[1]->m_im + c.m_bary[2]*c.m_weights[2] * n[2]->m_im; c.m_c0 = btScalar(1)/(ma + c.m_imf); @@ -1408,7 +1408,7 @@ struct btSoftColliders c.m_bary = w; // todo xuchenhan@: this is assuming mass of all vertices are the same. Need to modify if mass are different for distinct vertices c.m_weights = btScalar(2)/(btScalar(1) + w.length2()) * w; - c.m_friction = btMax(psb[0]->m_cfg.kDF, psb[1]->m_cfg.kDF); + c.m_friction = psb[0]->m_cfg.kDF * psb[1]->m_cfg.kDF; // the effective inverse mass of the face as in https://graphics.stanford.edu/papers/cloth-sig02/cloth.pdf c.m_imf = c.m_bary[0]*c.m_weights[0] * n[0]->m_im + c.m_bary[1]*c.m_weights[1] * n[1]->m_im + c.m_bary[2]*c.m_weights[2] * n[2]->m_im; c.m_c0 = btScalar(1)/(ma + c.m_imf); @@ -1462,7 +1462,7 @@ struct btSoftColliders c.m_bary = w; // todo xuchenhan@: this is assuming mass of all vertices are the same. Need to modify if mass are different for distinct vertices c.m_weights = btScalar(2)/(btScalar(1) + w.length2()) * w; - c.m_friction = btMax(psb[0]->m_cfg.kDF, psb[1]->m_cfg.kDF); + c.m_friction = psb[0]->m_cfg.kDF * psb[1]->m_cfg.kDF; // the effective inverse mass of the face as in https://graphics.stanford.edu/papers/cloth-sig02/cloth.pdf c.m_imf = c.m_bary[0]*c.m_weights[0] * n[0]->m_im + c.m_bary[1]*c.m_weights[1] * n[1]->m_im + c.m_bary[2]*c.m_weights[2] * n[2]->m_im; c.m_c0 = btScalar(1)/(ma + c.m_imf);