forked from bartvdbraak/blender
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.
This commit is contained in:
parent
64b9ba06a7
commit
acf4506299
@ -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) {
|
||||
mul_v3_v3fl(curl_offset, kink, amplitude);
|
||||
axis_angle_to_quat(q1, par->vel, t);
|
||||
mul_qt_v3(q1, par_vec);
|
||||
}
|
||||
mul_qt_v3(q1, curl_offset);
|
||||
|
||||
add_v3_v3v3(result, par->co, par_vec);
|
||||
interp_v3_v3v3(par_vec, state->co, par->co, flat);
|
||||
add_v3_v3v3(result, par_vec, curl_offset);
|
||||
break;
|
||||
}
|
||||
case PART_KINK_RADIAL:
|
||||
|
Loading…
Reference in New Issue
Block a user