[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29007] branches/render25/source/blender/ blenkernel/intern/implicit.c: Render Branch: hair collision time stepping test.

Brecht Van Lommel brecht at blender.org
Wed May 26 18:16:45 CEST 2010


Revision: 29007
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29007
Author:   blendix
Date:     2010-05-26 18:16:45 +0200 (Wed, 26 May 2010)

Log Message:
-----------
Render Branch: hair collision time stepping test. Not sure this is much
better than before but it helps in some cases. It seems to me that
without this it is taking 1.5 steps each time instead of 1.

The original paper defines vi+1/2 = (xi+1 - xi)/dt, but in our case we
already have vi+1 = (xi+1 - xi)/dt ... so there's a conflict here.

Modified Paths:
--------------
    branches/render25/source/blender/blenkernel/intern/implicit.c

Modified: branches/render25/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/implicit.c	2010-05-26 16:06:35 UTC (rev 29006)
+++ branches/render25/source/blender/blenkernel/intern/implicit.c	2010-05-26 16:16:45 UTC (rev 29007)
@@ -2127,6 +2127,9 @@
 		if(((clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED) && clmd->clothObject->bvhtree) ||
 		   (clmd->sim_parms->rigid_damp > 0.0f) || do_extra_solve)
 		{
+			// time stepping based on section Time Discretization in the paper:
+			// "Robust Treatment of Collisions, Contact and Friction for Cloth Animation"
+
 			// collisions 
 			// itstart();
 			
@@ -2170,6 +2173,14 @@
 					VECCOPY(id->Xnew[i], verts[i].tx);
 					VECCOPY(id->Vnew[i], verts[i].tv);
 					mul_v3_fl(id->Vnew[i], spf);
+
+					/* test to see if this helps make collisions a bit more stable,
+					   the algorithm used in the paper is based on velocities being
+					   defined at the midpoint, but we have velocity defined at the
+					   endpoint, so we interpolate here so we take 1 step in total
+					   instead of 1.5 (brecht) */
+					if(clmd->sim_parms->tothair)
+						interp_v3_v3v3(id->Vnew[i], id->Vnew[i], id->V[i], 0.5f);
 				}
 			}
 			





More information about the Bf-blender-cvs mailing list