diff --git a/src/osgParticle/ParticleProcessor.cpp b/src/osgParticle/ParticleProcessor.cpp index c8ba61b9a..d0e7e538a 100644 --- a/src/osgParticle/ParticleProcessor.cpp +++ b/src/osgParticle/ParticleProcessor.cpp @@ -99,10 +99,12 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) _currentTime += t - _t0; // process only if the particle system is not frozen/culled + // We need to allow at least 2 frames difference, because the particle system's lastFrameNumber + // is updated in the draw thread which may not have completed yet. if (alive && _enabled && !_ps->isFrozen() && - ((_ps->getLastFrameNumber()+1) >= (nv.getFrameStamp()->getFrameNumber()) || !_ps->getFreezeOnCull())) + (!_ps->getFreezeOnCull() || ((nv.getFrameStamp()->getFrameNumber()-_ps->getLastFrameNumber()) <= 2)) ) { // initialize matrix flags _need_ltw_matrix = true; diff --git a/src/osgParticle/ParticleSystemUpdater.cpp b/src/osgParticle/ParticleSystemUpdater.cpp index e2aeef75b..5aa481be5 100644 --- a/src/osgParticle/ParticleSystemUpdater.cpp +++ b/src/osgParticle/ParticleSystemUpdater.cpp @@ -41,7 +41,10 @@ void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv) ParticleSystem::ScopedWriteLock lock(*(ps->getReadWriteMutex())); - if (!ps->isFrozen() && (ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps->getFreezeOnCull())) + // We need to allow at least 2 frames difference, because the particle system's lastFrameNumber + // is updated in the draw thread which may not have completed yet. + if (!ps->isFrozen() && + (!ps->getFreezeOnCull() || ((nv.getFrameStamp()->getFrameNumber()-ps->getLastFrameNumber()) <= 2)) ) { ps->update(t - _t0, nv); }