[Bf-blender-cvs] [7aee4e2] gooseberry: Improved child hair curling for interpolated child particles.

Lukas Tönne noreply at git.blender.org
Wed Oct 1 18:33:19 CEST 2014


Commit: 7aee4e29972bae00839bc3f295e4cc5a8ab32168
Author: Lukas Tönne
Date:   Wed Oct 1 18:25:17 2014 +0200
Branches: gooseberry
https://developer.blender.org/rB7aee4e29972bae00839bc3f295e4cc5a8ab32168

Improved child hair curling for interpolated child particles.

The curl radius for children in interpolated mode was calculated using
the total offset from the parent particle. This leads to very large
radii when the distance is large due to sparse parents. Such behavior is
also very unrealistic because the curl radius is mostly constant and
defined by the material properties.

All the child hairs are roughly parallel by default. To simulate the
agglomeration of children into hair wisps the "flatness" parameter is
now used to clump them together.

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

M	source/blender/blenkernel/intern/particle.c

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c08f341..6ddb7ac 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1979,30 +1979,15 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	switch (type) {
 		case PART_KINK_CURL:
 		{
-			negate_v3(par_vec);
-
-			if (flat > 0.f) {
-				float proj[3];
-				project_v3_v3v3(proj, par_vec, par->vel);
-				madd_v3_v3fl(par_vec, proj, -flat);
-
-				project_v3_v3v3(proj, par_vec, kink);
-				madd_v3_v3fl(par_vec, proj, -flat);
-			}
-
-			axis_angle_to_quat(q1, kink, (float)M_PI / 2.f);
-
-			mul_qt_v3(q1, par_vec);
-
-			madd_v3_v3fl(par_vec, kink, amplitude);
-
+			float curl_offset[3];
+			
 			/* rotate kink vector around strand tangent */
-			if (t != 0.f) {
-				axis_angle_to_quat(q1, par->vel, t);
-				mul_qt_v3(q1, par_vec);
-			}
-
-			add_v3_v3v3(result, par->co, par_vec);
+			mul_v3_v3fl(curl_offset, kink, amplitude);
+			axis_angle_to_quat(q1, par->vel, t);
+			mul_qt_v3(q1, curl_offset);
+			
+			interp_v3_v3v3(par_vec, state->co, par->co, flat);
+			add_v3_v3v3(result, par_vec, curl_offset);
 			break;
 		}
 		case PART_KINK_RADIAL:




More information about the Bf-blender-cvs mailing list