[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42663] trunk/blender/source/blender/ blenkernel/intern/pointcache.c: Fixed point cache subframe interpolation issue.

Miika Hamalainen miika.hamalainen at kolumbus.fi
Fri Dec 16 10:22:51 CET 2011


Revision: 42663
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42663
Author:   miikah
Date:     2011-12-16 09:22:28 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/pointcache.c

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-12-16 07:27:56 UTC (rev 42662)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-12-16 09:22:28 UTC (rev 42663)
@@ -1491,7 +1491,7 @@
 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 @@
 		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 @@
 /* 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 */




More information about the Bf-blender-cvs mailing list