diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-10-01 20:25:17 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:03 +0300 |
commit | acf4506299f2118a41482468312418086e6f150a (patch) | |
tree | 90ebc1835838de7e62e7725d81327409be27503a /source/blender/blenkernel/intern/particle.c | |
parent | 64b9ba06a77317e26f316a363a6184f3e94c6a1f (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 34af22c2577..62c0358210f 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: |