From 91f14ddf3da140156c722e347b6f188210903629 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Fri, 16 Dec 2011 09:22:28 +0000 Subject: [PATCH] Fixed point cache subframe interpolation issue. Point cache interpolation was using too early start frame in cases when target frame was a subframe. This appeared as random ghost particles when rendering particle animation with full sample motion blur enabled. --- source/blender/blenkernel/intern/pointcache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 5445c990a9b..411e77de858 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1491,7 +1491,7 @@ static int ptcache_old_elemsize(PTCacheID *pid) static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2) { if(pid->cache->flag & PTCACHE_DISK_CACHE) { - int cfra1=frame-1, cfra2=frame+1; + int cfra1=frame, cfra2=frame+1; while(cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1)) cfra1--; @@ -1518,7 +1518,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int * PTCacheMem *pm = pid->cache->mem_cache.first; PTCacheMem *pm2 = pid->cache->mem_cache.last; - while(pm->next && pm->next->frame < frame) + while(pm->next && pm->next->frame <= frame) pm= pm->next; if(pm2->frame < frame) { @@ -1841,7 +1841,7 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2) /* possible to get old or interpolated result */ int BKE_ptcache_read(PTCacheID *pid, float cfra) { - int cfrai = (int)cfra, cfra1=0, cfra2=0; + int cfrai = (int)floor(cfra), cfra1=0, cfra2=0; int ret = 0; /* nothing to read to */