Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-01-16 18:04:10 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-01-20 11:30:12 +0300
commit1a918cb66e45d2bfa1ac2153c08f81b09429695a (patch)
tree96e2cd207f5eaab7e305c781639ffbfc9bd28389 /source/blender/blenkernel/intern/particle_child.c
parent755734c12f132399c8e4202849f8a74e67c75471 (diff)
Fix for slow deformation-motionblur in Cycles using the new spiral kink
mode. This was caused by variation of the number of keys on child hairs due to shortening of hair curves based on euclidian distances. The other kink modes also shorten hairs, but use the parametric distance instead, which does not vary with deformation of hairs.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_child.c')
-rw-r--r--source/blender/blenkernel/intern/particle_child.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index 5bc79d132d5..fb877e44eb6 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -199,10 +199,11 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co
float spiral_par_co[3] = {0.0f, 0.0f, 0.0f};
float spiral_par_vel[3] = {0.0f, 0.0f, 0.0f};
float spiral_par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
- float len, totlen, cutlen;
+ float totlen;
+ float cut_time;
int start_index = 0, end_index = 0;
float kink_base[3];
-
+
if (ptex) {
kink_amp *= ptex->kink_amp;
kink_freq *= ptex->kink_freq;
@@ -211,19 +212,12 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co
rough_end *= ptex->roughe;
}
- totlen = 0.0f;
- for (k = 0, key = keys; k < totkeys-1; k++, key++)
- totlen += len_v3v3((key+1)->co, key->co);
-
- cutlen = max_ff(ptex->length * totlen - fabsf(kink_amp), 0.0f);
+ cut_time = (totkeys - 1) * ptex->length;
zero_v3(spiral_start);
- len = 0.0f;
for (k = 0, key = keys; k < totkeys-1; k++, key++) {
- float seglen = len_v3v3((key+1)->co, key->co);
-
- if (seglen > 0.0f && len + seglen >= cutlen) {
- float fac = (cutlen - len) / seglen;
+ if ((float)(k + 1) >= cut_time) {
+ float fac = cut_time - (float)k;
ParticleCacheKey *par = parent_keys + k;
start_index = k + 1;
@@ -238,7 +232,6 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co
break;
}
- len += seglen;
}
zero_v3(dir);