[Bf-blender-cvs] [bca2d61] hair_system: Fix for meaningless position updates during the force integration loop.

Lukas Tönne noreply at git.blender.org
Sun Aug 24 18:55:01 CEST 2014


Commit: bca2d61018a5d2186b18a7f8200f7a2a252789fe
Author: Lukas Tönne
Date:   Sun Aug 24 15:15:15 2014 +0200
Branches: hair_system
https://developer.blender.org/rBbca2d61018a5d2186b18a7f8200f7a2a252789fe

Fix for meaningless position updates during the force integration loop.

Setting the "next" state of positions inside that loop will overwrite
its own result until the last iteration. The velocities are still
integrated correctly though, only the position update was applied
incorrectly. Force calculation was also using the larger original time
step.

The fix now exposes an awkward dependency of stiffness and damping
values on the substep count. This is entirely expected, but it might
be a good idea to scale user-defined values by the inverse timestep,
so that results are comparable and can be tweaked more easily when
increasing/decreasing substeps.

===================================================================

M	source/blender/hair/intern/HAIR_solver.cpp

===================================================================

diff --git a/source/blender/hair/intern/HAIR_solver.cpp b/source/blender/hair/intern/HAIR_solver.cpp
index 15b48e3..5c46d7b 100644
--- a/source/blender/hair/intern/HAIR_solver.cpp
+++ b/source/blender/hair/intern/HAIR_solver.cpp
@@ -599,13 +599,13 @@ void Solver::do_integration(float time, float timestep, const SolverTaskData &da
 		/* calculate Point.force_accum vectors */
 		calc_forces(m_params, m_forces, time, dt, restitution_scale, m_data->t0, m_data->t1, data, contacts);
 		
-		do_velocity_integration(m_params, time, timestep, m_data->t0, m_data->t1, data);
-		
-		/* apply positional changes */
-		apply_velocity(data, time, timestep, m_data->t0, m_data->t1);
+		do_velocity_integration(m_params, time, dt, m_data->t0, m_data->t1, data);
 		
 		time += dt;
 	}
+	
+	/* apply positional changes */
+	apply_velocity(data, time, timestep, m_data->t0, m_data->t1);
 }
 
 struct SolverPoolData {




More information about the Bf-blender-cvs mailing list