[Bf-blender-cvs] [646e465] temp_merge_gooseberry_hair: Improved child hair curling for interpolated child particles.

Lukas Tönne noreply at git.blender.org
Mon Jan 19 20:49:52 CET 2015


Commit: 646e465e2f7d8f553324aef3521b6fa81e9863c5
Author: Lukas Tönne
Date:   Wed Oct 1 18:25:17 2014 +0200
Branches: temp_merge_gooseberry_hair
https://developer.blender.org/rB646e465e2f7d8f553324aef3521b6fa81e9863c5

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 a98a562..0459ba8 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1978,30 +1978,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