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 Toenne <lukas.toenne@googlemail.com>2013-10-29 18:48:25 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-10-29 18:48:25 +0400
commit2cccdd1678c3813a00e319e5f0b82919f7397153 (patch)
tree700ef9dd8e4bb4412fd695f7af2b9cb70492b8f7
parent56cf901f0380d6ae83c7193f2cad64413a683c08 (diff)
Fix for particle texture influence bug causing undefined (nan) values: When using a texture with "Particles/Strands" coordinates that in turn has a "Lifetime" influence on the particles, the texture eval
accesses the particle lifetime/dietime data before it is actually defined! This is a design flaw, but to avoid corrupted data for now just initialize the lifetime/dietime values for particles in advance before evaluating the texture.
-rw-r--r--source/blender/blenkernel/intern/particle_system.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 526d54a97fa..ac32f96d59c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2006,6 +2006,12 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
pa->lifetime = 100.0f;
}
else {
+ /* initialize the lifetime, in case the texture coordinates
+ * are from Particles/Strands, which would cause undefined values
+ */
+ pa->lifetime = part->lifetime * (1.0f - part->randlife * PSYS_FRAND(p + 21));
+ pa->dietime = pa->time + pa->lifetime;
+
/* get possible textural influence */
psys_get_texture(sim, pa, &ptex, PAMAP_LIFE, cfra);